Could you please share how you did it? It didn't work for me.
From: Cook, Jonathan E. (Fed) <jonathan.cook@xxxxxxxx>
Sent: Friday, May 28, 2021 1:58:54 AM
To: Sai Mukund Sagar Deshpande <saimukunds@xxxxxxxxxxxxxxxxx>; pjsip@xxxxxxxxxxxxxxx <pjsip@xxxxxxxxxxxxxxx>
Subject: RE: Only use SIP signalling and disable pjmedia RTP
Sent: Friday, May 28, 2021 1:58:54 AM
To: Sai Mukund Sagar Deshpande <saimukunds@xxxxxxxxxxxxxxxxx>; pjsip@xxxxxxxxxxxxxxx <pjsip@xxxxxxxxxxxxxxx>
Subject: RE: Only use SIP signalling and disable pjmedia RTP
I could not find a way to prevent stream creation so I waited until the streams were created and disconnected them.
Regards,
Jonathan Cook
-----Original Message-----
From: Sai Mukund Sagar Deshpande <saimukunds@xxxxxxxxxxxxxxxxx>
Sent: Thursday, May 27, 2021 1:09 PM
To: Cook, Jonathan E. (Fed) <jonathan.cook@xxxxxxxx>; pjsip@xxxxxxxxxxxxxxx
Subject: Re: Only use SIP signalling and disable pjmedia RTP
Hi Jonathan,
Thanks for your response. Your suggestions helped me dig deeper into code and explore further.
In a normal example below
05:19:49.416 pjsua_call.c .....Call 3: received updated media offer
05:19:49.416 pjsua_media.c ......Call 3: re-initializing media..
05:19:49.416 pjsua_media.c .......Media index 0 selected for audio call 3
05:19:49.418 pjsua_media.c ......Call 3: updating media..
05:19:49.419 pjsua_media.c ........Media stream call03:0 is destroyed
05:19:49.419 pjsua_aud.c .......Audio channel update..
05:19:49.420 strm0xdeaf34 ........VAD temporarily disabled
05:19:49.420 strm0xdeaf34 ........Encoder stream started
05:19:49.421 strm0xdeaf34 ........Decoder stream started
05:19:49.421 pjsua_media.c .......Audio updated, stream #0: G722
(sendrecv)
05:19:49.421 pjsua_app.c ......Call 3 media 0 [type=audio], status
is Active
05:19:49.421 pjsua_aud.c ......Conf connect: 3 --> 0
05:19:49.421 conference.c .......Port 3 (sip:2005@192.168.1.152)
transmitting to port 0 (Master/sound)
05:19:49.421 pjsua_aud.c ......Conf connect: 0 --> 3
05:19:49.422 conference.c .......Port 0 (Master/sound) transmitting
to port 3 (sip:2005@192.168.1.152)
05:19:49.422 pjsua_core.c ........TX 953 bytes Response msg
200/INVITE/cseq=13507 (tdta0xe02964) to UDP 192.168.1.2:5060:
I tried calling the snippet you shared earlier, in on_call_media_update(pjsua_app.c). needed to include pjsua_internal.h to directly access the structures in snippet, but it works.
**********The user is 2003 (pjsua_get_var ()) --> retrieving internal variable.
***********00:05:07.613 strm0x7060dc !...Unable to receive RTP
packet, recv() returned 70014: Operation cancelled (PJ_ECANCELLED)
00:05:07.619 strm0x7060dc ...RTCP recv() error: Operation cancelled
(PJ_ECANCELLED) [err:70014]
00:05:07.622 pjsua_core.c ....TX 952 bytes Response msg
200/INVITE/cseq=10918 (tdta0x701fcc) to UDP 192.168.1.2:5060:
*********** Looks like ports got closed.
--end msg--
00:05:07.629 pjsua_call.c .....Call 0: received updated
media offer
00:05:07.630 pjsua_media.c ....Bus error
But, after a call is confirmed, streams are getting created where on_rx_rtp and on_rx_rtcp callbacks are registered. Closing transport media, will crash the process if transport media is closed(unable to recv error, followed by Bus error).
My SLIC/DSP software handles codec information, packetization periods etc., and other parameters. It only needs the rtp_cfg information. So, could we disable stream creation and audio device call back in pjmedia?
Or should we disconnect the media elsewhere?
Regards,
SMS
On Wed, 2021-05-26 at 22:47 +0000, Cook, Jonathan E. (Fed) wrote:
> This can be done.
> First you will want to extract the RTP port numbers that pjsip has
> negotiated.
> pj::MediaTransportInfo transInfo = getMedTransportInfo(0);
> transInfo.localRtpName will contain the local port pj::StreamInfo
> streamInfo = getStreamInfo(0); streamInfo.remoteRtpAddress will
> contain the remote port
>
> Then you have to disconnect the media.
> pj::CallInfo ci = getInfo();
> pjsua_call *call = &pjsua_var.calls[ci.id]; // Iterate all the call
> medias for (mi = 0; mi < call->med_cnt; ++mi) {
> pj_status_t status=PJ_SUCCESS;
> pjsua_call_media *call_med = &call->media[mi];
> // disconnect media so RTP block can use it
> if (call_med->tp_st > PJSUA_MED_TP_IDLE) {
> pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_IDLE);
> pjmedia_transport_media_stop(call_med->tp);
> }
> pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_NULL);
> status = pjmedia_transport_close(call_med->tp);
> call->med_cnt=0;
> call->med_prov_cnt=0;
> if (status!=PJ_SUCCESS){
> //display error
> }
> }
> call->med_prov_cnt = 0;
>
> Finally, you can use the RTP ports in your application.
>
>
> -----Original Message-----
> From: Sai Mukund Sagar Deshpande via pjsip <pjsip@xxxxxxxxxxxxxxx>
> Sent: Wednesday, May 26, 2021 10:16 AM
> To: pjsip@xxxxxxxxxxxxxxx
> Cc: Sai Mukund Sagar Deshpande <saimukunds@xxxxxxxxxxxxxxxxx>
> Subject: Only use SIP signalling and disable pjmedia RTP
>
> Hi,
>
> I have an application (SLIC/DSP software) on our embedded device (has
> POTS ports) that handles RTP incoming and outgoing traffic once RTP
> dest IP/port and local RTP port are provided.
>
> I want to extract RTP src/dest port information from SIP messages and
> pass on to this application during call creation, so that it can
> manage RTP streams.
>
> Till now, I am able to establish SIP calls on our device but audio is
> not working as pjsip opens RTP socket which I want to open on my RTP
> application.
>
> # netstat -anp | grep 400
> udp 0 0
> 0.0.0.0:4000 0.0.0.0:* 1571/pjsu
> a-
> mips-unk
> udp 0 0
> 0.0.0.0:4001 0.0.0.0:* 1571/pjsu
> a-
> mips-unk
> udp 0 6400
>
>
> Is it possible to do this easily? i.e., to use pjsip only for SIP
> signalling and disable RTP socket creation in pjmedia.
>
>
> Regards,
> SMS
> _______________________________________________
> Visit our blog:
> https://gcc02.safelinks.protection.outlook.com/?url="">.
> pjsip.org%2F&data=""> > 54134fc8d08d92146b8b7%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C1%7C637
> 577409913774659%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2
> luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=3mA96ZTawVVx5plF
> nCC8M%2FljYDv5KODJUE6fr8%2FmbeM%3D&reserved=0
>
> pjsip mailing list -- pjsip@xxxxxxxxxxxxxxx To unsubscribe send an
> email to pjsip-leave@xxxxxxxxxxxxxxx
Regards,
Jonathan Cook
-----Original Message-----
From: Sai Mukund Sagar Deshpande <saimukunds@xxxxxxxxxxxxxxxxx>
Sent: Thursday, May 27, 2021 1:09 PM
To: Cook, Jonathan E. (Fed) <jonathan.cook@xxxxxxxx>; pjsip@xxxxxxxxxxxxxxx
Subject: Re: Only use SIP signalling and disable pjmedia RTP
Hi Jonathan,
Thanks for your response. Your suggestions helped me dig deeper into code and explore further.
In a normal example below
05:19:49.416 pjsua_call.c .....Call 3: received updated media offer
05:19:49.416 pjsua_media.c ......Call 3: re-initializing media..
05:19:49.416 pjsua_media.c .......Media index 0 selected for audio call 3
05:19:49.418 pjsua_media.c ......Call 3: updating media..
05:19:49.419 pjsua_media.c ........Media stream call03:0 is destroyed
05:19:49.419 pjsua_aud.c .......Audio channel update..
05:19:49.420 strm0xdeaf34 ........VAD temporarily disabled
05:19:49.420 strm0xdeaf34 ........Encoder stream started
05:19:49.421 strm0xdeaf34 ........Decoder stream started
05:19:49.421 pjsua_media.c .......Audio updated, stream #0: G722
(sendrecv)
05:19:49.421 pjsua_app.c ......Call 3 media 0 [type=audio], status
is Active
05:19:49.421 pjsua_aud.c ......Conf connect: 3 --> 0
05:19:49.421 conference.c .......Port 3 (sip:2005@192.168.1.152)
transmitting to port 0 (Master/sound)
05:19:49.421 pjsua_aud.c ......Conf connect: 0 --> 3
05:19:49.422 conference.c .......Port 0 (Master/sound) transmitting
to port 3 (sip:2005@192.168.1.152)
05:19:49.422 pjsua_core.c ........TX 953 bytes Response msg
200/INVITE/cseq=13507 (tdta0xe02964) to UDP 192.168.1.2:5060:
I tried calling the snippet you shared earlier, in on_call_media_update(pjsua_app.c). needed to include pjsua_internal.h to directly access the structures in snippet, but it works.
**********The user is 2003 (pjsua_get_var ()) --> retrieving internal variable.
***********00:05:07.613 strm0x7060dc !...Unable to receive RTP
packet, recv() returned 70014: Operation cancelled (PJ_ECANCELLED)
00:05:07.619 strm0x7060dc ...RTCP recv() error: Operation cancelled
(PJ_ECANCELLED) [err:70014]
00:05:07.622 pjsua_core.c ....TX 952 bytes Response msg
200/INVITE/cseq=10918 (tdta0x701fcc) to UDP 192.168.1.2:5060:
*********** Looks like ports got closed.
--end msg--
00:05:07.629 pjsua_call.c .....Call 0: received updated
media offer
00:05:07.630 pjsua_media.c ....Bus error
But, after a call is confirmed, streams are getting created where on_rx_rtp and on_rx_rtcp callbacks are registered. Closing transport media, will crash the process if transport media is closed(unable to recv error, followed by Bus error).
My SLIC/DSP software handles codec information, packetization periods etc., and other parameters. It only needs the rtp_cfg information. So, could we disable stream creation and audio device call back in pjmedia?
Or should we disconnect the media elsewhere?
Regards,
SMS
On Wed, 2021-05-26 at 22:47 +0000, Cook, Jonathan E. (Fed) wrote:
> This can be done.
> First you will want to extract the RTP port numbers that pjsip has
> negotiated.
> pj::MediaTransportInfo transInfo = getMedTransportInfo(0);
> transInfo.localRtpName will contain the local port pj::StreamInfo
> streamInfo = getStreamInfo(0); streamInfo.remoteRtpAddress will
> contain the remote port
>
> Then you have to disconnect the media.
> pj::CallInfo ci = getInfo();
> pjsua_call *call = &pjsua_var.calls[ci.id]; // Iterate all the call
> medias for (mi = 0; mi < call->med_cnt; ++mi) {
> pj_status_t status=PJ_SUCCESS;
> pjsua_call_media *call_med = &call->media[mi];
> // disconnect media so RTP block can use it
> if (call_med->tp_st > PJSUA_MED_TP_IDLE) {
> pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_IDLE);
> pjmedia_transport_media_stop(call_med->tp);
> }
> pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_NULL);
> status = pjmedia_transport_close(call_med->tp);
> call->med_cnt=0;
> call->med_prov_cnt=0;
> if (status!=PJ_SUCCESS){
> //display error
> }
> }
> call->med_prov_cnt = 0;
>
> Finally, you can use the RTP ports in your application.
>
>
> -----Original Message-----
> From: Sai Mukund Sagar Deshpande via pjsip <pjsip@xxxxxxxxxxxxxxx>
> Sent: Wednesday, May 26, 2021 10:16 AM
> To: pjsip@xxxxxxxxxxxxxxx
> Cc: Sai Mukund Sagar Deshpande <saimukunds@xxxxxxxxxxxxxxxxx>
> Subject: Only use SIP signalling and disable pjmedia RTP
>
> Hi,
>
> I have an application (SLIC/DSP software) on our embedded device (has
> POTS ports) that handles RTP incoming and outgoing traffic once RTP
> dest IP/port and local RTP port are provided.
>
> I want to extract RTP src/dest port information from SIP messages and
> pass on to this application during call creation, so that it can
> manage RTP streams.
>
> Till now, I am able to establish SIP calls on our device but audio is
> not working as pjsip opens RTP socket which I want to open on my RTP
> application.
>
> # netstat -anp | grep 400
> udp 0 0
> 0.0.0.0:4000 0.0.0.0:* 1571/pjsu
> a-
> mips-unk
> udp 0 0
> 0.0.0.0:4001 0.0.0.0:* 1571/pjsu
> a-
> mips-unk
> udp 0 6400
>
>
> Is it possible to do this easily? i.e., to use pjsip only for SIP
> signalling and disable RTP socket creation in pjmedia.
>
>
> Regards,
> SMS
> _______________________________________________
> Visit our blog:
> https://gcc02.safelinks.protection.outlook.com/?url="">.
> pjsip.org%2F&data=""> > 54134fc8d08d92146b8b7%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C1%7C637
> 577409913774659%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2
> luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=3mA96ZTawVVx5plF
> nCC8M%2FljYDv5KODJUE6fr8%2FmbeM%3D&reserved=0
>
> pjsip mailing list -- pjsip@xxxxxxxxxxxxxxx To unsubscribe send an
> email to pjsip-leave@xxxxxxxxxxxxxxx
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list -- pjsip@xxxxxxxxxxxxxxx To unsubscribe send an email to pjsip-leave@xxxxxxxxxxxxxxx