There's presently no way (that I have found) through the high-level API to specify that the loopback address should be included as a host candidate in the ICE transport without modifying pjsua itself. I need this feature as I'm working on a product which provides media streams from connected devices to an in-browser application that *may* be run with no network connection (e.g., in highly remote locations). In such cases the ICE transport doesn't provide any candidates by default, as it has no active network interfaces to include.
The documentation for on_create_media_transport suggests it's possible to replace the existing media transport for a call with an entirely new one. I'm attempting to do this with the ICE transport when provided with a particular flag. However, while mentioned in the documentation, there appear to be no examples of this being done anywhere I can find, and so I am stuck throwing things against the wall to see if they stick.
I have attempted any number of approaches and received different errors depending on the circumstances.
One approach was to replace the transport associated with the call_media (call->media[media_idx].tp = new_tp) while returning NULL from the on_create_media_function. This results in the call being terminated because the media is "Temporarily Unavailable" (presumably).
The other approach, which I believe to be the correct one, is to detach the current transport from the media stream and return the new one from the on_create_media_transport function. Unfortunately, when I do this I get a "SIP Failure Code" (406 Not Acceptable). I *believe* this is because I wind up with repeated candidate lines (at least that is what appears to happen when preparing the SDP response).
Attached you will find a copy of the log output from PJSIP, as well as my on_create_media_transport function (which is mostly ripped from pjsua-lib's pjsua_media.c's create_ice_media_transport function). I would appreciate any help y'all could offer.
One approach was to replace the transport associated with the call_media (call->media[media_idx].tp = new_tp) while returning NULL from the on_create_media_function. This results in the call being terminated because the media is "Temporarily Unavailable" (presumably).
The other approach, which I believe to be the correct one, is to detach the current transport from the media stream and return the new one from the on_create_media_transport function. Unfortunately, when I do this I get a "SIP Failure Code" (406 Not Acceptable). I *believe* this is because I wind up with repeated candidate lines (at least that is what appears to happen when preparing the SDP response).
Attached you will find a copy of the log output from PJSIP, as well as my on_create_media_transport function (which is mostly ripped from pjsua-lib's pjsua_media.c's create_ice_media_transport function). I would appreciate any help y'all could offer.
11:08:27.628 os_core_unix.c !pjlib 2.1-svn for POSIX initialized 11:08:27.669 sip_endpoint.c .Creating endpoint instance... 11:08:27.669 pjlib .select() I/O Queue created (0x7f9a28010118) 11:08:27.669 sip_endpoint.c .Module "mod-msg-print" registered 11:08:27.669 sip_transport. .Transport manager created. 11:08:27.669 pjsua_core.c .PJSUA state changed: NULL --> CREATED 11:08:27.670 sip_endpoint.c .Module "mod-pjsua-log" registered 11:08:27.670 sip_endpoint.c .Module "mod-tsx-layer" registered 11:08:27.670 sip_endpoint.c .Module "mod-stateful-util" registered 11:08:27.670 sip_endpoint.c .Module "mod-ua" registered 11:08:27.670 sip_endpoint.c .Module "mod-100rel" registered 11:08:27.670 sip_endpoint.c .Module "mod-pjsua" registered 11:08:27.670 sip_endpoint.c .Module "mod-invite" registered 11:08:27.670 pjlib ..select() I/O Queue created (0x7f9a28021d98) 11:08:27.673 sip_endpoint.c .Module "mod-evsub" registered 11:08:27.673 sip_endpoint.c .Module "mod-presence" registered 11:08:27.673 evsub.c .Event pkg "presence" registered by mod-presence 11:08:27.673 sip_endpoint.c .Module "mod-mwi" registered 11:08:27.673 evsub.c .Event pkg "message-summary" registered by mod-mwi 11:08:27.673 sip_endpoint.c .Module "mod-refer" registered 11:08:27.673 evsub.c .Event pkg "refer" registered by mod-refer 11:08:27.673 sip_endpoint.c .Module "mod-pjsua-pres" registered 11:08:27.673 sip_endpoint.c .Module "mod-pjsua-im" registered 11:08:27.673 sip_endpoint.c .Module "mod-pjsua-options" registered 11:08:27.673 pjsua_core.c .1 SIP worker threads created 11:08:27.673 pjsua_core.c .pjsua version 2.1-svn for Linux-4.7.4.1/x86_64/glibc-2.24 initialized 11:08:27.673 pjsua_core.c .PJSUA state changed: CREATED --> INIT 11:08:27.673 sip_endpoint.c Module "mod-default-handler" registered 11:08:27.719 pjsua_core.c SIP UDP socket reachable at 192.168.1.148:5066 11:08:27.719 udp0x7f9a28035 SIP UDP transport started, published address is 192.168.1.148:5066 11:08:27.719 pjsua_acc.c Adding account: id=<sip:192.168.1.148:5066> 11:08:27.719 pjsua_acc.c .Account <sip:192.168.1.148:5066> added with id 0 11:08:27.719 pjsua_acc.c Modifying accunt 0 11:08:27.719 pjsua_acc.c Acc 0: setting online status to 1.. 11:08:27.719 pjsua_acc.c Adding account: id=sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx 11:08:27.719 pjsua_acc.c .Account sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx added with id 1 11:08:27.719 pjsua_acc.c .Acc 1: setting registration.. 11:08:27.719 endpoint ..Request msg REGISTER/cseq=50021 (tdta0x7f9a2803a320) created. 11:08:27.719 tsx0x7f9a2803c ...Transaction created for Request msg REGISTER/cseq=50022 (tdta0x7f9a2803a320) 11:08:27.719 tsx0x7f9a2803c ..Sending Request msg REGISTER/cseq=50022 (tdta0x7f9a2803a320) in state Null 11:08:27.719 sip_resolve.c ...Target '127.0.0.1:5070' type=Unspecified resolved to '127.0.0.1:5070' type=UDP (UDP transport) 11:08:27.719 pjsua_core.c ...TX 745 bytes Request msg REGISTER/cseq=50022 (tdta0x7f9a2803a320) to UDP 127.0.0.1:5070: REGISTER sip:127.0.0.1:5070 SIP/2.0 Via: SIP/2.0/UDP 127.0.0.1:5066;rport;branch=z9hG4bKPjbc8ff63d-c160-4d65-bef2-234a0948d374 Max-Forwards: 70 From: <sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx>;tag=499d3236-6c88-48f6-b81a-351dcd7284c5 To: <sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx> Call-ID: c140af27-14f0-4bab-89d9-50e9585f0c20 CSeq: 50022 REGISTER User-Agent: PJSUA v2.1-svn Linux-4.7.4.1/x86_64/glibc-2.24 Contact: <sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@127.0.0.1:5066;ob>;+sip.ice Expires: 300 Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS Content-Length: 0 --end msg-- 11:08:27.719 tsx0x7f9a2803c ...State changed from Null to Calling, event=TX_MSG 11:08:27.719 pjsua_acc.c ..Acc 1: Registration sent 11:08:27.719 pjsua_acc.c Acc 1: setting online status to 1.. 11:08:27.719 pjsua_core.c PJSUA state changed: INIT --> STARTING 11:08:27.719 sip_endpoint.c .Module "mod-unsolicited-mwi" registered 11:08:27.719 pjsua_core.c .PJSUA state changed: STARTING --> RUNNING 11:08:27.719 main.c Ready: Success >>>> Account list: [ 0] <sip:192.168.1.148:5066>: does not register Online status: Online *[ 1] sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx: 100/In Progress (expires=0) Online status: Online Buddy list: -none- +=============================================================================+ | Call Commands: | Buddy, IM & Presence: | Account: | | | | | | m Make new call | +b Add new buddy .| +a Add new accnt | | M Make multiple calls | -b Delete buddy | -a Delete accnt. | | a Answer call | i Send IM | !a Modify accnt. | | h Hangup call (ha=all) | s Subscribe presence | rr (Re-)register | | H Hold call | u Unsubscribe presence | ru Unregister | | v re-inVite (release hold) | t ToGgle Online status | > Cycle next ac.| | U send UPDATE | T Set online status | < Cycle prev ac.| | ],[ Select next/prev call +--------------------------+-------------------+ | x Xfer call | Media Commands: | Status & Config: | | X Xfer with Replaces | | | | # Send RFC 2833 DTMF | cl List ports | d Dump status | | * Send DTMF with INFO | cc Connect port | dd Dump detailed | | dq Dump curr. call quality | cd Disconnect port | dc Dump config | | | V Adjust audio Volume | f Save config | | S Send arbitrary REQUEST | Cp Codec priorities | | +-----------------------------------------------------------------------------+ | Video: "vid help" for more info | +-----------------------------------------------------------------------------+ | q QUIT L ReLoad sleep MS echo [0|1|txt] n: detect NAT type | +=============================================================================+ You have 0 active call >>> 11:08:27.723 sip_endpoint.c !Processing incoming message: Response msg 200/REGISTER/cseq=50022 (rdata0x7f9a28036d88) 11:08:27.724 pjsua_core.c .RX 560 bytes Response msg 200/REGISTER/cseq=50022 (rdata0x7f9a28036d88) from UDP 127.0.0.1:5070: SIP/2.0 200 Ok Via: SIP/2.0/UDP 127.0.0.1:5066;rport=5066;branch=z9hG4bKPjbc8ff63d-c160-4d65-bef2-234a0948d374;received=127.0.0.1 To: <sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx> From: <sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx>;tag=499d3236-6c88-48f6-b81a-351dcd7284c5 call-id: c140af27-14f0-4bab-89d9-50e9585f0c20 CSeq: 50022 REGISTER Contact: <sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@127.0.0.1:5066;ob>;+sip.ice content-length: 0 --end msg-- 11:08:27.724 tsx0x7f9a2803c .Incoming Response msg 200/REGISTER/cseq=50022 (rdata0x7f9a28036d88) in state Calling 11:08:27.724 tsx0x7f9a2803c ..State changed from Calling to Completed, event=RX_MSG 11:08:27.724 pjsua_acc.c ....SIP outbound status for acc 1 is not active 11:08:27.724 pjsua_acc.c ....sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx: registration success, status=200 (Ok), will re-register in 300 seconds 11:08:27.724 pjsua_acc.c ....Keep-alive timer started for acc 1, destination:127.0.0.1:5070, interval:15s 11:08:32.724 tsx0x7f9a2803c Timeout timer event 11:08:32.724 tsx0x7f9a2803c .State changed from Completed to Terminated, event=TIMER 11:08:32.724 tsx0x7f9a2803c Timeout timer event 11:08:32.724 tsx0x7f9a2803c .State changed from Terminated to Destroyed, event=TIMER 11:08:32.724 tdta0x7f9a2803 ..Destroying txdata Request msg REGISTER/cseq=50022 (tdta0x7f9a2803a320) 11:08:32.724 tsx0x7f9a2803c Transaction destroyed! 11:08:37.683 sip_endpoint.c Processing incoming message: Request msg INVITE/cseq=129 (rdata0x7f9a20000908) 11:08:37.683 pjsua_core.c .RX 2569 bytes Request msg INVITE/cseq=129 (rdata0x7f9a20000908) from UDP 127.0.0.1:5070: INVITE sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@127.0.0.1:5066;ob SIP/2.0 Via: SIP/2.0/UDP 0.0.0.0:5070;branch=z9hG4bK712026;rport Via: SIP/2.0/WS hfl5bnfaqcg2.invalid;branch=z9hG4bK3316125;received=sid-diWiN5pCTpRC_7_iAAAA.invalid;rport=5065 max-forwards: 69 To: <sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b%24local@xxxxxxxxxxxxxxxxxxxxxxxxxxx> From: "admin" <sip:sid-diWiN5pCTpRC_7_iAAAA%24local@xxxxxxxxxxxxxxxxxxxxxxxxxxx>;tag=62hn72cv48 call-id: qbmdknorpddhl0j6n7gq CSeq: 129 INVITE Contact: <sip:sggmscv2@hfl5bnfaqcg2.invalid;transport=ws;ob> content-type: application/sdp session-expires: 90 allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO supported: timer,ice,replaces,outbound user-agent: JsSIP 2.0.0 content-length: 1772 v=0 o=- 3240710545115971611 2 IN IP4 127.0.0.1 s=- t=0 0 a=group:BUNDLE video a=msid-semantic: WMS m=video 50202 RTP/SAVPF 100 101 107 116 117 96 97 99 98 c=IN IP4 192.168.1.148 a=rtcp:47029 IN IP4 192.168.1.148 a=candidate:2207368823 1 udp 2122260223 192.168.1.148 50202 typ host generation 0 network-id 1 a=candidate:2207368823 2 udp 2122260222 192.168.1.148 47029 typ host generation 0 network-id 1 a=candidate:3440523911 1 tcp 1518280447 192.168.1.148 9 typ host tcptype active generation 0 network-id 1 a=candidate:3440523911 2 tcp 1518280446 192.168.1.148 9 typ host tcptype active generation 0 network-id 1 a=ice-ufrag:6CVgW9ZUjGVPchN7 a=ice-pwd:3UMzS++8zFPzmjpasTeTpmK5 a=fingerprint:sha-256 BD:C1:F1:C9:63:02:74:99:91:CA:AC:61:92:BC:0D:74:AF:5A:09:E2:2F:72:E2:93:A7:36:72:64:EE:70:8A:DC a=setup:actpass a=mid:video a=extmap:2 urn:ietf:params:rtp-hdrext:toffset a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time a=extmap:4 urn:3gpp:video-orientation a=recvonly a=rtcp-mux a=rtcp-rsize a=rtpmap:100 VP8/90000 a=rtcp-fb:100 ccm fir a=rtcp-fb:100 nack a=rtcp-fb:100 nack pli a=rtcp-fb:100 goog-remb a=rtcp-fb:100 transport-cc a=rtpmap:101 VP9/90000 a=rtcp-fb:101 ccm fir a=rtcp-fb:101 nack a=rtcp-fb:101 nack pli a=rtcp-fb:101 goog-remb a=rtcp-fb:101 transport-cc a=rtpmap:107 H264/90000 a=rtcp-fb:107 ccm fir a=rtcp-fb:107 nack a=rtcp-fb:107 nack pli a=rtcp-fb:107 goog-remb a=rtcp-fb:107 transport-cc a=fmtp:107 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f a=rtpmap:116 red/90000 a=rtpmap:117 ulpfec/90000 a=rtpmap:96 rtx/90000 a=fmtp:96 apt=100 a=rtpmap:97 rtx/90000 a=fmtp:97 apt=101 a=rtpmap:99 rtx/90000 a=fmtp:99 apt=107 a=rtpmap:98 rtx/90000 a=fmtp:98 apt=116 --end msg-- 11:08:37.683 pjsua_call.c .Incoming Request msg INVITE/cseq=129 (rdata0x7f9a20000908) 11:08:37.683 tsx0x7f9a20004 ...Transaction created for Request msg INVITE/cseq=129 (rdata0x7f9a20000908) 11:08:37.683 tsx0x7f9a20004 ..Incoming Request msg INVITE/cseq=129 (rdata0x7f9a20000908) in state Null 11:08:37.683 tsx0x7f9a20004 ...State changed from Null to Trying, event=RX_MSG 11:08:37.683 dlg0x7f9a20003 ....Transaction tsx0x7f9a20004ae8 state changed to Trying 11:08:37.683 dlg0x7f9a20003 ..UAS dialog created 11:08:37.683 dlg0x7f9a20003 ..Module mod-invite added as dialog usage, data=0x7f9a20005eb8 11:08:37.683 dlg0x7f9a20003 ...Session count inc to 2 by mod-invite 11:08:37.683 inv0x7f9a20003 ..UAS invite session created for dialog dlg0x7f9a20003888 11:08:37.683 pjsua_media.c ..Call 0: initializing media.. altVid: pjsua_vid_channel_init 11:08:37.683 icetp00 ...Creating ICE stream transport with 2 component(s) 11:08:37.683 stuntp0x7f9a20 ....SO_RCVBUF set to 212992 11:08:37.683 stuntp0x7f9a20 ....SO_SNDBUF set to 212992 11:08:37.731 icetp00 ....Comp 1: host candidate 192.168.1.148:53372 added 11:08:37.731 icetp00 ....Comp 1: host candidate 172.17.0.1:53372 added 11:08:37.731 stuntp0x7f9a20 ....SO_RCVBUF set to 212992 11:08:37.731 stuntp0x7f9a20 ....SO_SNDBUF set to 212992 11:08:37.778 icetp00 ....Comp 2: host candidate 192.168.1.148:53054 added 11:08:37.778 icetp00 ....Comp 2: host candidate 172.17.0.1:53054 added 11:08:37.778 icetp00 ....ICE stream transport 0x7f9a20009588 created 11:08:37.778 pjsua_media.c ...Media index 0 selected for audio call 0 11:08:37.778 endpoint ...Response msg 100/INVITE/cseq=129 (tdta0x7f9a2000fa00) created 11:08:37.778 dlg0x7f9a20003 ...Initial answer Response msg 100/INVITE/cseq=129 (tdta0x7f9a2000fa00) 11:08:37.778 inv0x7f9a20003 ...Sending Response msg 100/INVITE/cseq=129 (tdta0x7f9a2000fa00) 11:08:37.778 dlg0x7f9a20003 ....Sending Response msg 100/INVITE/cseq=129 (tdta0x7f9a2000fa00) 11:08:37.778 tsx0x7f9a20004 ....Sending Response msg 100/INVITE/cseq=129 (tdta0x7f9a2000fa00) in state Trying 11:08:37.778 pjsua_core.c .....TX 477 bytes Response msg 100/INVITE/cseq=129 (tdta0x7f9a2000fa00) to UDP 127.0.0.1:5070: SIP/2.0 100 Trying Via: SIP/2.0/UDP 0.0.0.0:5070;rport=5070;received=127.0.0.1;branch=z9hG4bK712026 Via: SIP/2.0/WS hfl5bnfaqcg2.invalid;rport=5065;received=sid-diWiN5pCTpRC_7_iAAAA.invalid;branch=z9hG4bK3316125 Call-ID: qbmdknorpddhl0j6n7gq From: "admin" <sip:sid-diWiN5pCTpRC_7_iAAAA$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx>;tag=62hn72cv48 To: <sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx> CSeq: 129 INVITE Content-Length: 0 --end msg-- 11:08:37.778 tsx0x7f9a20004 .....State changed from Trying to Proceeding, event=TX_MSG 11:08:37.778 dlg0x7f9a20003 ......Transaction tsx0x7f9a20004ae8 state changed to Proceeding 11:08:37.778 pjsua_call.c ..Answering call 0: code=200 11:08:37.778 pjsua_call.c ...Pending answering call 0 upon completion of media transport 11:08:37.780 ssl0x7f9a2000c pj_ssl_sock_set_certificate ret: 0 11:08:37.785 srtp0x7f9a2000 SRTP underlying transport name: icetp00, is_ice: 1 11:08:37.785 icetp00 ICE stream transport 0x7f9a20009588 destroy request.. 11:08:37.785 stuntp0x7f9a20 .STUN sock 0x7f9a2000a458 request, ref_cnt=8 11:08:37.785 stuntp0x7f9a20 .STUN session 0x7f9a2000b898 destroy request, ref_cnt=8 11:08:37.785 stuntp0x7f9a20 .STUN sock 0x7f9a2000d298 request, ref_cnt=5 11:08:37.785 stuntp0x7f9a20 .STUN session 0x7f9a2000e6d8 destroy request, ref_cnt=5 11:08:37.785 icetp00 .ICE stream transport 0x7f9a20009588 destroyed 11:08:37.785 .STUN sock 0x7f9a2000a458 destroyed 11:08:37.785 stun_session.c .STUN session 0x7f9a2000b898 destroyed 11:08:37.785 .STUN sock 0x7f9a2000d298 destroyed 11:08:37.785 stun_session.c .STUN session 0x7f9a2000e6d8 destroyed 11:08:37.785 icetp01 Creating ICE stream transport with 2 component(s) 11:08:37.785 stuntp0x7f9a20 .SO_RCVBUF set to 212992 11:08:37.785 stuntp0x7f9a20 .SO_SNDBUF set to 212992 11:08:37.830 icetp01 .Comp 1: host candidate 192.168.1.148:4085 added 11:08:37.830 icetp01 .Comp 1: host candidate 172.17.0.1:4085 added 11:08:37.830 stuntp0x7f9a20 .SO_RCVBUF set to 212992 11:08:37.830 stuntp0x7f9a20 .SO_SNDBUF set to 212992 11:08:37.881 icetp01 .Comp 2: host candidate 192.168.1.148:4295 added 11:08:37.882 icetp01 .Comp 2: host candidate 172.17.0.1:4295 added 11:08:37.882 icetp01 .ICE stream transport 0x7f9a20032968 created 11:08:37.983 icetp01 ICE session created, comp_cnt=2, role is Controlled agent 11:08:37.983 icetp01 ICE nomination type set to aggressive 11:08:37.983 icetp01 Candidate 0 added: comp_id=1, type=host, foundation=Hc0a80194, addr=192.168.1.148:4085, base=192.168.1.148:4085, prio=0x7effffff (2130706431) 11:08:37.983 icetp01 Candidate 1 added: comp_id=1, type=host, foundation=Hac110001, addr=172.17.0.1:4085, base=172.17.0.1:4085, prio=0x7effffff (2130706431) 11:08:37.983 icetp01 Candidate 2 added: comp_id=2, type=host, foundation=Hc0a80194, addr=192.168.1.148:4295, base=192.168.1.148:4295, prio=0x7efffffe (2130706430) 11:08:37.983 icetp01 Candidate 3 added: comp_id=2, type=host, foundation=Hac110001, addr=172.17.0.1:4295, base=172.17.0.1:4295, prio=0x7efffffe (2130706430) 11:08:37.983 pjsua_call.c Error creating SDP answer: Invalid SDP media transport protocol (PJMEDIA_SDP_EINPROTO) [status=220036] 11:08:37.983 inv0x7f9a20003 .Sending Response msg 406/INVITE/cseq=129 (tdta0x7f9a2000fa00) 11:08:37.983 dlg0x7f9a20003 ..Sending Response msg 406/INVITE/cseq=129 (tdta0x7f9a2000fa00) 11:08:37.983 tsx0x7f9a20004 ..Sending Response msg 406/INVITE/cseq=129 (tdta0x7f9a2000fa00) in state Proceeding 11:08:37.983 pjsua_core.c ...TX 526 bytes Response msg 406/INVITE/cseq=129 (tdta0x7f9a2000fa00) to UDP 127.0.0.1:5070: SIP/2.0 406 Not Acceptable Via: SIP/2.0/UDP 0.0.0.0:5070;rport=5070;received=127.0.0.1;branch=z9hG4bK712026 Via: SIP/2.0/WS hfl5bnfaqcg2.invalid;rport=5065;received=sid-diWiN5pCTpRC_7_iAAAA.invalid;branch=z9hG4bK3316125 Call-ID: qbmdknorpddhl0j6n7gq From: "admin" <sip:sid-diWiN5pCTpRC_7_iAAAA$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx>;tag=62hn72cv48 To: <sip:examcameralow.e5f6c85d-5023-4963-9617-acc08a316e1b$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx>;tag=4a280f48-9ddd-49d7-a413-4a478f2773c4 CSeq: 129 INVITE Content-Length: 0 --end msg-- 11:08:37.983 tsx0x7f9a20004 ...State changed from Proceeding to Completed, event=TX_MSG 11:08:37.983 dlg0x7f9a20003 ....Transaction tsx0x7f9a20004ae8 state changed to Completed 11:08:37.983 pjsua_app.c ......Call 0 is DISCONNECTED [reason=406 (Not Acceptable)] 11:08:37.983 pjsua_app.c ......Call 0 disconnected, dumping media stats.. 11:08:37.983 pjsua_app_comm ...... [DISCONNCTD] To: "admin" <sip:sid-diWiN5pCTpRC_7_iAAAA$local@xxxxxxxxxxxxxxxxxxxxxxxxxxx>;tag=62hn72cv48 Call time: 00h:00m:00s, 1st res in 300 ms, conn in 0ms 11:08:37.983 pjsua_media.c ......Call 0: deinitializing media.. 11:08:37.983 icetp01 .......Stopping ICE, reason=media stop requested 11:08:37.983 icetp01 .......Destroying ICE session 0x7f9a200092f8 11:08:37.983 stuse0x7f9a200 .......STUN session 0x7f9a2000e8a8 destroy request, ref_cnt=11 11:08:37.983 stuse0x7f9a200 .......STUN session 0x7f9a2000bb28 destroy request, ref_cnt=10 11:08:37.983 icetp01 .......ICE stream transport 0x7f9a20032968 destroy request.. 11:08:37.983 stuntp0x7f9a20 ........STUN sock 0x7f9a20012988 request, ref_cnt=8 11:08:37.983 stuntp0x7f9a20 ........STUN session 0x7f9a20033418 destroy request, ref_cnt=8 11:08:37.983 stuntp0x7f9a20 ........STUN sock 0x7f9a20034628 request, ref_cnt=5 11:08:37.983 stuntp0x7f9a20 ........STUN session 0x7f9a2000d698 destroy request, ref_cnt=5 11:08:37.983 icetp01 ........ICE stream transport 0x7f9a20032968 destroyed 11:08:37.984 ........STUN sock 0x7f9a20012988 destroyed 11:08:37.984 stun_session.c ........STUN session 0x7f9a20033418 destroyed 11:08:37.984 ........STUN sock 0x7f9a20034628 destroyed 11:08:37.984 stun_session.c ........STUN session 0x7f9a2000d698 destroyed 11:08:37.984 ice_session.c ........ICE session 0x7f9a200092f8 destroyed 11:08:37.984 stun_session.c ........STUN session 0x7f9a2000e8a8 destroyed 11:08:37.984 stun_session.c ........STUN session 0x
static pjmedia_transport* on_create_media_transport(pjsua_call_id call_id, unsigned media_idx, pjmedia_transport *base_tp, unsigned flags) { // We *might* want to replace the ICE media transport if (base_tp->type != PJMEDIA_TRANSPORT_TYPE_ICE) return base_tp; pjmedia_transport_detach(base_tp, NULL); char name[32]; pjmedia_transport *new_tp; pj_ice_strans_cfg ice_cfg; pjmedia_ice_cb ice_cb; pjsua_call *call = &pjsua_var.calls[call_id]; pjsua_call_media *call_med = &call->media[media_idx]; pjsua_acc_config *acc_cfg = &pjsua_var.acc[call->acc_id].cfg; pj_ice_strans_cfg_default(&ice_cfg); pj_stun_config_init(&ice_cfg.stun_cfg, &pjsua_var.cp.factory, 0, pjsip_endpt_get_ioqueue(pjsua_var.endpt), pjsip_endpt_get_timer_heap(pjsua_var.endpt)); ice_cfg.af = pj_AF_INET(); ice_cfg.resolver = pjsua_var.resolver; ice_cfg.opt = acc_cfg->ice_cfg.ice_opt; if (acc_cfg->ice_cfg.ice_max_host_cands >= 0) { ice_cfg.stun.max_host_cands = acc_cfg->ice_cfg.ice_max_host_cands; } pjsua_transport_config tp_cfg; pjsua_transport_config_default(&tp_cfg); tp_cfg.port = DEFAULT_RTP_PORT; pj_sockaddr_init(ice_cfg.af, &ice_cfg.stun.cfg.bound_addr, &tp_cfg.bound_addr, (pj_uint16_t)tp_cfg.port); ice_cfg.stun.cfg.port_range = (pj_uint16_t)tp_cfg.port_range; if (tp_cfg.port != 0 && ice_cfg.stun.cfg.port_range == 0) ice_cfg.stun.cfg.port_range = (pj_uint16_t)(pjsua_var.ua_cfg.max_calls * 10); /* Copy QoS setting to STUN setting */ ice_cfg.stun.cfg.qos_type = tp_cfg.qos_type; pj_memcpy(&ice_cfg.stun.cfg.qos_params, &tp_cfg.qos_params, sizeof(tp_cfg.qos_params)); ice_cfg.stun.loop_addr = PJ_TRUE; /* Configure packet size for STUN and TURN sockets */ ice_cfg.stun.cfg.max_pkt_size = PJMEDIA_MAX_MRU; ice_cfg.turn.cfg.max_pkt_size = PJMEDIA_MAX_MRU; int comp_cnt = 1; if (PJMEDIA_ADVERTISE_RTCP && !acc_cfg->ice_cfg.ice_no_rtcp) { ++comp_cnt; } pj_bzero(&ice_cb, sizeof(pjmedia_ice_cb)); ice_cb.on_ice_complete = &on_ice_complete; pj_ansi_snprintf(name, sizeof(name), "icetp%02d", call_med->idx + 1); call_med->tp_ready = PJ_EPENDING; pjmedia_ice_create3(pjsua_var.med_endpt, name, comp_cnt, &ice_cfg, &ice_cb, 0, call_med, &call_med->tp); pj_bool_t has_pjsua_lock = PJSUA_LOCK_IS_LOCKED(); if (has_pjsua_lock) PJSUA_UNLOCK(); while (call_med->tp_ready == PJ_EPENDING) { pjsua_handle_events(100); } if (has_pjsua_lock) PJSUA_LOCK(); if (call_med->tp_ready != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Error initializing ICE media transport", call_med->tp_ready); } pjmedia_transport_simulate_lost(call_med->tp, PJMEDIA_DIR_ENCODING, pjsua_var.media_cfg.tx_drop_pct); pjmedia_transport_simulate_lost(call_med->tp, PJMEDIA_DIR_DECODING, pjsua_var.media_cfg.rx_drop_pct); return call_med->tp; }
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org