Closed EricBourque closed 1 week ago
Calling the PSTN is generally just the same as callling any other SIP end point.
You should be able to sue the simpler SIPUserAgent.Call overload. The full SIPCallDescriptor
is only needed when more exotic parameters are required.
So if I want to call a phone number, what should the destination be? For example I want to call +4179 435 0001, var callResult = await ua.Call("41794350001", "myuser", "mypass", rtpSession); That gives me a SIPClientUserAgent DNS failure resolving 41795155526 in 2255.21ms. Call cannot proceed.
var callResult = await ua.Call("sip:+41794350001@yourprovider.com", "myuser", "mypass", rtpSession);
Thanks for the quick feedback, you are fast! I think I am very close now. FYI, I did test this with a payed C# voice SDK so I know it is not some issue with the SIP trunk. [17:50:54 DBG] Starting SIPRegistrationUserAgent for sip:myuser@sip.telnyx.com, callback period 175s. [17:50:54 DBG] Starting registration for sip:myuser@sip.telnyx.com. [17:50:54 DBG] Request Sent udp:192.168.1.201:5060<-udp:192.76.120.10:5060: REGISTER sip:sip.telnyx.com SIP/2.0. [17:50:54 DBG] Response Received udp:0.0.0.0:5060<-udp:192.76.120.10:5060: REGISTER 401 Unauthorized. [17:50:54 DBG] Server response Unauthorised received for sip:myuser@sip.telnyx.com. [17:50:54 DBG] SIP DNS SRV for sip:sip.telnyx.com resolved to sip-anycast1.telnyx.com. and port 5060. [17:50:54 DBG] Request Sent udp:192.168.1.201:5060<-udp:192.76.120.10:5060: REGISTER sip:sip.telnyx.com SIP/2.0. [17:50:55 DBG] Response Received udp:0.0.0.0:5060<-udp:192.76.120.10:5060: REGISTER 200 OK. [17:50:55 DBG] Server auth response Ok received for sip:myuser@sip.telnyx.com. [17:50:55 DBG] SIPRegistrationUserAgent was successful, scheduling next registration to sip:myuser@sip.telnyx.com in 173s. [17:51:22 DBG] calling sip:41794144424@sip.telnyx.com. [17:51:22 DBG] Starting call to sip:41794144424@sip.telnyx.com. [17:51:22 DBG] SIP DNS SRV for sip:41794144424@sip.telnyx.com resolved to sip-anycast1.telnyx.com. and port 5060. [17:51:22 DBG] Call progressing, resolved sip:41794144424@sip.telnyx.com to udp:192.76.120.10:5060. DNS lookup result for sip:41794144424@sip.telnyx.com: udp:192.76.120.10:5060.
[17:51:23 DBG] CreateBoundUdpSocket successfully bound on [::]:57724, dual mode True.
[17:51:23 DBG] CreateBoundUdpSocket successfully bound on [::]:57725, dual mode True. [17:51:23 DBG] Successfully bound RTP socket [::]:57724 (dual mode True) and control socket [::]:57725 (dual mode True). [17:51:23 DBG] RTPChannel for [::]:57724 started.
[17:51:23 DBG] CreateBoundUdpSocket successfully bound on [::]:57726, dual mode True.
[17:51:23 DBG] CreateBoundUdpSocket successfully bound on [::]:57727, dual mode True. [17:51:23 DBG] Successfully bound RTP socket [::]:57726 (dual mode True) and control socket [::]:57727 (dual mode True). [17:51:23 DBG] RTPChannel for [::]:57726 started. [17:51:23 DBG] SIPClientUserAgent attempting to resolve sip.telnyx.com. [17:51:23 DBG] SIP DNS SRV for sip:41794144424@sip.telnyx.com resolved to sip-anycast1.telnyx.com. and port 5060. [17:51:23 DBG] SIPClientUserAgent resolved sip.telnyx.com to udp:192.76.120.10:5060 in 28.34ms. [17:51:23 DBG] UAC commencing call to sip:41794144424@sip.telnyx.com:5060. [17:51:23 DBG] Request Sent udp:192.168.1.201:5060<-udp:192.76.120.10:5060: INVITE sip:41794144424@sip.telnyx.com SIP/2.0. [17:51:23 DBG] Response Received udp:0.0.0.0:5060<-udp:192.76.120.10:5060: INVITE 100 Telnyx Trying. [17:51:23 DBG] Information response 100 Telnyx Trying for sip:41794144424@sip.telnyx.com. [17:51:23 DBG] Call trying: 100 Telnyx Trying. [17:51:23 DBG] Response Received udp:0.0.0.0:5060<-udp:192.76.120.10:5060: INVITE 407 Proxy Authentication Required. [17:51:23 DBG] Request Sent udp:192.168.1.201:5060<-udp:192.76.120.10:5060: ACK sip:41794144424@sip.telnyx.com SIP/2.0. [17:51:24 DBG] Response 407 Proxy Authentication Required for sip:41794144424@sip.telnyx.com. [17:51:24 DBG] Forward leg failed, authentication was requested but no credentials were available. [17:51:24 WRN] Call attempt to sip:41794144424@sip.telnyx.com failed with Authentication requested when no credentials available. [17:51:24 DBG] Call failed: Authentication requested when no credentials available. [17:51:24 DBG] Ready
Did you set the username and password on your call attempt?
[17:51:24 DBG] Forward leg failed, authentication was requested but no credentials were available.
[17:51:24 WRN] Call attempt to sip:41794144424@sip.telnyx.com failed with Authentication requested when no credentials available.
[17:51:24 DBG] Call failed: Authentication requested when no credentials available.
Note that registrations and calls are separate SIP worklfows. You probably don't need to register to place an outgoing call. Typically you only need to register if you want to receive a call.
Yes I did. I also found this thread if it helps: http://forum.sipsorcery.com/viewtopic.php?t=2910 I have tried GetStartedNetFramework and SIPCallServer with and without registration.
Here is the output with the simple GetStartedFramework. SIPSorcery Getting Started Demo
[18:18:44 DBG] CreateBoundUdpSocket even port required, closing socket on [::]:54149 and retrying on 54150.
[18:18:44 DBG] CreateBoundUdpSocket successfully bound on [::]:54151, dual mode True. [18:18:44 DBG] Successfully bound RTP socket [::]:54150 (dual mode True) and control socket [::]:54151 (dual mode True). [18:18:44 DBG] RTPChannel for [::]:54150 started. [18:18:44 DBG] SIPClientUserAgent attempting to resolve sip.telnyx.com. [18:18:45 DBG] SIP DNS SRV for sip:+41795144424@sip.telnyx.com resolved to sip-anycast1.telnyx.com. and port 5060. [18:18:45 DBG] SIPClientUserAgent resolved sip.telnyx.com to udp:192.76.120.10:5060 in 135.51ms. [18:18:45 DBG] UAC commencing call to sip:+41795144424@sip.telnyx.com:5060. [18:18:45 DBG] CreateBoundUdpSocket attempting to create and bind UDP socket(s) on 0.0.0.0:0. [18:18:45 DBG] CreateBoundUdpSocket successfully bound on 0.0.0.0:54155. [18:18:45 INF] SIP UDP Channel created for udp:0.0.0.0:54155. [18:18:45 DBG] Information response 100 Telnyx Trying for sip:+41795144424@sip.telnyx.com. [18:18:45 INF] Call attempt to sip:+41795144424@sip.telnyx.com received a trying response INVITE 100 Telnyx Trying. [18:18:45 DBG] Response 407 Proxy Authentication Required for sip:+41795144424@sip.telnyx.com. [18:18:45 DBG] Information response 100 Telnyx Trying for sip:+41795144424@sip.telnyx.com. [18:18:45 INF] Call attempt to sip:+41795144424@sip.telnyx.com received a trying response INVITE 100 Telnyx Trying. [18:18:46 DBG] Information response 180 Ringing for sip:+41795144424@sip.telnyx.com. [18:18:46 INF] Call attempt to sip:+41795144424@sip.telnyx.com received a ringing response INVITE 180 Ringing. [18:18:46 DBG] Response 503 Service Unavailable for sip:+41795144424@sip.telnyx.com. [18:18:46 WRN] Call attempt was answered with failure response INVITE 503 Service Unavailable. Call result failure.
Wireshark trace: INVITE sip:+41795144424@sip.telnyx.com SIP/2.0 Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bK142db5f5bde24a76a472785dc9f4653c;rport To: sip:+41795144424@sip.telnyx.com:5060 From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 1 INVITE Contact: sip:myuser@192.168.1.201:50637 Max-Forwards: 70 User-Agent: sipsorcery_v6.0.4.0 Supported: replaces, norefersub, 100rel Content-Length: 310 Content-Type: application/sdp
v=0 o=- 1015631504 0 IN IP4 127.0.0.1 s=sipsorcery c=IN IP4 192.168.1.201 t=0 0 m=audio 50632 RTP/AVP 0 8 9 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=ssrc:1637024955 cname:7cdd2e40-90ce-4009-8657-c551c20b80ca INVITE sip:+41795144424@sip.telnyx.com SIP/2.0 Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bK142db5f5bde24a76a472785dc9f4653c;rport To: sip:+41795144424@sip.telnyx.com:5060 From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 1 INVITE Contact: sip:myuser@192.168.1.201:50637 Max-Forwards: 70 User-Agent: sipsorcery_v6.0.4.0 Supported: replaces, norefersub, 100rel Content-Length: 310 Content-Type: application/sdp
v=0 o=- 1015631504 0 IN IP4 127.0.0.1 s=sipsorcery c=IN IP4 192.168.1.201 t=0 0 m=audio 50632 RTP/AVP 0 8 9 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=ssrc:1637024955 cname:7cdd2e40-90ce-4009-8657-c551c20b80ca SIP/2.0 100 Telnyx Trying Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bK142db5f5bde24a76a472785dc9f4653c;rport=50637;received=178.199.204.246 To: sip:+41795144424@sip.telnyx.com:5060 From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 1 INVITE Server: Telnyx SIP Proxy Content-Length: 0
SIP/2.0 407 Proxy Authentication Required Via: SIP/2.0/UDP 192.168.1.201:50637;received=178.199.204.246;branch=z9hG4bK142db5f5bde24a76a472785dc9f4653c;rport=50637 From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR To: sip:+41795144424@sip.telnyx.com:5060;tag=Hgc70XHg540tm Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 1 INVITE Accept: application/sdp Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REFER, NOTIFY Supported: path Allow-Events: talk, hold, conference, refer Proxy-Authenticate: Digest realm="sip.telnyx.com", nonce="e6b88032-be55-4cec-b461-6cf196868987", algorithm=MD5, qop="auth", opaque="f217c8ce-c56a-4a7b-bdeb-a6598a1f4062/10.13.38.4" Content-Length: 0
ACK sip:+41795144424@sip.telnyx.com SIP/2.0 Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bK142db5f5bde24a76a472785dc9f4653c;rport To: sip:+41795144424@sip.telnyx.com:5060;tag=Hgc70XHg540tm From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 1 ACK Max-Forwards: 70 Content-Length: 0
ACK sip:+41795144424@sip.telnyx.com SIP/2.0 Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bK142db5f5bde24a76a472785dc9f4653c;rport To: sip:+41795144424@sip.telnyx.com:5060;tag=Hgc70XHg540tm From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 1 ACK Max-Forwards: 70 Content-Length: 0
INVITE sip:+41795144424@sip.telnyx.com SIP/2.0 Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bKdca14f7d68bd4fffb42e61089fe1e3d8;rport To: sip:+41795144424@sip.telnyx.com:5060 From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 2 INVITE Contact: sip:myuser@192.168.1.201:50637 Max-Forwards: 70 User-Agent: sipsorcery_v6.0.4.0 Proxy-Authorization: Digest username="myuser",realm="sip.telnyx.com",nonce="e6b88032-be55-4cec-b461-6cf196868987",uri="sip:+41795144424@sip.telnyx.com",response="cf05d0adf0e6f3a67b9c03b746dc6799",cnonce="1234114341",nc=00000001,qop=auth,opaque="f217c8ce-c56a-4a7b-bdeb-a6598a1f4062/10.13.38.4",algorithm=MD5 Supported: replaces, norefersub, 100rel Content-Length: 310 Content-Type: application/sdp
v=0 o=- 1015631504 0 IN IP4 127.0.0.1 s=sipsorcery c=IN IP4 192.168.1.201 t=0 0 m=audio 50632 RTP/AVP 0 8 9 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=ssrc:1637024955 cname:7cdd2e40-90ce-4009-8657-c551c20b80ca INVITE sip:+41795144424@sip.telnyx.com SIP/2.0 Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bKdca14f7d68bd4fffb42e61089fe1e3d8;rport To: sip:+41795144424@sip.telnyx.com:5060 From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 2 INVITE Contact: sip:myuser@192.168.1.201:50637 Max-Forwards: 70 User-Agent: sipsorcery_v6.0.4.0 Proxy-Authorization: Digest username="myuser",realm="sip.telnyx.com",nonce="e6b88032-be55-4cec-b461-6cf196868987",uri="sip:+41795144424@sip.telnyx.com",response="cf05d0adf0e6f3a67b9c03b746dc6799",cnonce="1234114341",nc=00000001,qop=auth,opaque="f217c8ce-c56a-4a7b-bdeb-a6598a1f4062/10.13.38.4",algorithm=MD5 Supported: replaces, norefersub, 100rel Content-Length: 310 Content-Type: application/sdp
v=0 o=- 1015631504 0 IN IP4 127.0.0.1 s=sipsorcery c=IN IP4 192.168.1.201 t=0 0 m=audio 50632 RTP/AVP 0 8 9 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=ssrc:1637024955 cname:7cdd2e40-90ce-4009-8657-c551c20b80ca SIP/2.0 100 Telnyx Trying Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bKdca14f7d68bd4fffb42e61089fe1e3d8;rport=50637;received=178.199.204.246 To: sip:+41795144424@sip.telnyx.com:5060 From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 2 INVITE Server: Telnyx SIP Proxy Content-Length: 0
SIP/2.0 180 Ringing Via: SIP/2.0/UDP 192.168.1.201:50637;received=178.199.204.246;branch=z9hG4bKdca14f7d68bd4fffb42e61089fe1e3d8;rport=50637 Record-Route: <sip:10.255.0.1;transport=tcp;r2=on;lr;ftag=RROJYMXRUR> Record-Route: <sip:192.76.120.10;r2=on;lr;ftag=RROJYMXRUR> From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR To: sip:+41795144424@sip.telnyx.com:5060;tag=jS5Z2r2K2DQDg Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 2 INVITE Contact: sip:+41795144424@10.13.38.4:5070;transport=tcp Accept: application/sdp Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REFER, NOTIFY Supported: path Allow-Events: talk, hold, conference, refer Content-Length: 0 X-Telnyx-Session-ID: 90f3202e-7628-11ec-aaa5-02420a0d7f68 X-Telnyx-Leg-ID: 90f30fc6-7628-11ec-b7b7-02420a0d7f68
SIP/2.0 503 Service Unavailable Via: SIP/2.0/UDP 192.168.1.201:50637;received=178.199.204.246;branch=z9hG4bKdca14f7d68bd4fffb42e61089fe1e3d8;rport=50637 Max-Forwards: 69 From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR To: sip:+41795144424@sip.telnyx.com:5060;tag=jS5Z2r2K2DQDg Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 2 INVITE Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REFER, NOTIFY Supported: path Allow-Events: talk, hold, conference, refer Reason: Q.850;cause=41;text="NORMAL_TEMPORARY_FAILURE" Content-Length: 0
ACK sip:+41795144424@sip.telnyx.com SIP/2.0 Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bKdca14f7d68bd4fffb42e61089fe1e3d8;rport To: sip:+41795144424@sip.telnyx.com:5060;tag=jS5Z2r2K2DQDg From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 2 ACK Max-Forwards: 70 Proxy-Authorization: Digest username="myuser",realm="sip.telnyx.com",nonce="e6b88032-be55-4cec-b461-6cf196868987",uri="sip:+41795144424@sip.telnyx.com",response="cf05d0adf0e6f3a67b9c03b746dc6799",cnonce="1234114341",nc=00000001,qop=auth,opaque="f217c8ce-c56a-4a7b-bdeb-a6598a1f4062/10.13.38.4",algorithm=MD5 Content-Length: 0
ACK sip:+41795144424@sip.telnyx.com SIP/2.0 Via: SIP/2.0/UDP 192.168.1.201:50637;branch=z9hG4bKdca14f7d68bd4fffb42e61089fe1e3d8;rport To: sip:+41795144424@sip.telnyx.com:5060;tag=jS5Z2r2K2DQDg From: sip:myuser@sip.telnyx.com;tag=RROJYMXRUR Call-ID: f7dc954724b34a1b930df4232030e0ae CSeq: 2 ACK Max-Forwards: 70 Proxy-Authorization: Digest username="myuser",realm="sip.telnyx.com",nonce="e6b88032-be55-4cec-b461-6cf196868987",uri="sip:+41795144424@sip.telnyx.com",response="cf05d0adf0e6f3a67b9c03b746dc6799",cnonce="1234114341",nc=00000001,qop=auth,opaque="f217c8ce-c56a-4a7b-bdeb-a6598a1f4062/10.13.38.4",algorithm=MD5 Content-Length: 0
ping
[18:18:46 DBG] Response 503 Service Unavailable for sip:+41795144424@sip.telnyx.com.
That looks to be your problem. Have you tried different number ofrmats? Perhaps you need to use 00 instead of +.
Yes, I have tried 00, + and just 41... Always the same answer. I could try with a different SIP trunk but this one works fine with other softphones.
Ok, could be some other SIP interop issue then. It's a bit beyond the support offered on this repo to track that down unless someone else reading this happens to have solved the same problem.
Well.. I could try to get it working by comparing the wireshark to a wireshark from a different softphone that actually works but this could take allot of time. Would you consider accepting modifications to the source code if I can find what is wrong?
Would you consider accepting modifications to the source code if I can find what is wrong?
Sure, PR's are always welcome!
Just before I commit to this, can I have a 10-15 minute call with you (manager?) at some point? I want to go through what I plan to use sipsorcery for. My company works with audio/video streaming tech.
Can't help you with that one, sorry.
I did some consulting in the SIP/WebRTC space related to this project for a little while but then got a real job again. Other than snatches of time to sporadically maintain this library I don't have any bandwidth for anything else at all.
SIP Provider issue, nothing to do with this library.
Is is possible to call a local/international phone number? I am using a SIP provider, the registration is successfull. How parameter do I need to use in SIPUserAgent.Call to call a GSM phone number? Do I need to use the complex SIPCallDescriptor? What should I fill in? Thanks