Outbound Gateway Name

Status
Not open for further replies.

Circuitsoft

New Member
Aug 28, 2019
6
0
1
38
I'm getting authentication errors when attempting to register my outbound gateway.

The Register String that they're seeing is "sip:gw+(gateway_uuid)@(my_ip):5080;transport=udp;gw=(gateway_uuid)/FreeSwitch" but they're expecting "sip:(trunk_number)@(my_ip):5080". How can I change that. The only place I see (gateway_uuid) in the generated XML configs is in the <gateway name="..."> section of sofia.conf.xml, but taht doesn't seem to be changeable in the FusionPBX UI. Is there something else I should be doing?
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
You will need to provide more information to get any useful help.

From what I can guess, what you are calling the "Register String" looks just like Contact header, it would be helpful to see the whole packet. You should not need to worry about the gateway UUID. What have to put in on the gateway configuration page?

In most register scenarios, a register request will be send and the provider will respond with a 401 unauthorized that contains a WWW-Authenticate header, this header contains the realm and a nonce to encrypt the password against. The register request is then re-sent with an Authorization header containing the response. If the credentials are OK the provider will respond with a 200 OK. Here is an example packet exchange:
Code:
U 2019/10/01 14:12:57.990221 185.xxx.xxx.xxx:5080 -> xxx.xxx.xxx.42:5060
REGISTER sip:sip.myprovider.net;transport=udp SIP/2.0.
Via: SIP/2.0/UDP 185.xxx.xxx.xxx:5080;rport;branch=z9hG4bKaNZmSj7m21gKg.
Max-Forwards: 70.
From: <sip:USER001@sip.myprovider.net>;tag=D8gZDmpD5N6Dc.
To: <sip:USER001@sip.myprovider.net>.
Call-ID: 5f2ee6a3-0edd-4faf-9487-a6bc2a784f2f.
CSeq: 9129515 REGISTER.
Contact: <sip:gw+d10034ea-1654-4cf0-8a20-9bd23139ae96@185.xxx.xxx.xxx:5080;transport=udp;gw=d10034ea-1654-4cf0-8a20-9bd23139ae96>.
Expires: 800.
User-Agent: A2ESCM.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY.
Supported: timer, path, replaces.
Content-Length: 0.
.

#
U 2019/10/01 14:12:57.990409 xxx.xxx.xxx.42:5060 -> 185.xxx.xxx.xxx:5080
SIP/2.0 401 Unauthorized.
Via: SIP/2.0/UDP 185.xxx.xxx.xxx:5080;received=185.xxx.xxx.xxx;rport=5080;branch=z9hG4bKaNZmSj7m21gKg.
From: <sip:USER001@sip.myprovider.net>;tag=D8gZDmpD5N6Dc.
To: <sip:USER001@sip.myprovider.net>;tag=bf00e474ce6e8ea13a5a8aca6f9bb7a6.2bc5.
Call-ID: 5f2ee6a3-0edd-4faf-9487-a6bc2a784f2f.
CSeq: 9129515 REGISTER.
WWW-Authenticate: Digest realm="sip.myprovider.net", nonce="5d9350f700013449133680e63a9a3feb4579f65232eb9e70", qop="auth", stale=true.
Server: A2ES-IP-Exchange.
Content-Length: 0.
.

#
U 2019/10/01 14:12:57.991015 185.xxx.xxx.xxx:5080 -> xxx.xxx.xxx.42:5060
REGISTER sip:sip.myprovider.net;transport=udp SIP/2.0.
Via: SIP/2.0/UDP 185.xxx.xxx.xxx:5080;rport;branch=z9hG4bKByrDUDrrZa75B.
Max-Forwards: 70.
From: <sip:USER001@sip.myprovider.net>;tag=D8gZDmpD5N6Dc.
To: <sip:USER001@sip.myprovider.net>.
Call-ID: 5f2ee6a3-0edd-4faf-9487-a6bc2a784f2f.
CSeq: 9129516 REGISTER.
Contact: <sip:gw+d10034ea-1654-4cf0-8a20-9bd23139ae96@185.xxx.xxx.xxx:5080;transport=udp;gw=d10034ea-1654-4cf0-8a20-9bd23139ae96>.
Expires: 800.
User-Agent: A2ESCM.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY.
Supported: timer, path, replaces.
Authorization: Digest username="USER001", realm="sip.myprovider.net", nonce="5d9350f700013449133680e63a9a3feb4579f65232eb9e70", cnonce="B1YskV7wEjiPbna0eJ6SUg", algorithm=MD5, uri="sip:sip.myprovider.net;transport=udp", response="fddb102e253f7c50b8b44f31dcbd0aec", qop=auth, nc=00000001.
Content-Length: 0.
.

#
U 2019/10/01 14:12:57.992327 xxx.xxx.xxx.42:5060 -> 185.xxx.xxx.xxx:5080
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 185.xxx.xxx.xxx:5080;received=185.xxx.xxx.xxx;rport=5080;branch=z9hG4bKByrDUDrrZa75B.
From: <sip:USER001@sip.myprovider.net>;tag=D8gZDmpD5N6Dc.
To: <sip:USER001@sip.myprovider.net>;tag=bf00e474ce6e8ea13a5a8aca6f9bb7a6.de73.
Call-ID: 5f2ee6a3-0edd-4faf-9487-a6bc2a784f2f.
CSeq: 9129516 REGISTER.
Contact: <sip:gw+d10034ea-1654-4cf0-8a20-9bd23139ae96@185.xxx.xxx.xxx:5080;transport=udp;gw=d10034ea-1654-4cf0-8a20-9bd23139ae96>;expires=800.
Server: A2ES-IP-Exchange.
Content-Length: 0.
.

The Gateway configuration page for this register packet exchange is shown here:

Screenshot from 2019-10-01 14-30-12.png

I hope this is helpful.
 

JamesBorne

Active Member
Jan 24, 2019
294
57
28
Australia
Have a good look in the "Advanced" section on your gateway. Might be a setting in there that helps.

Also, I don't think you need to fill a "from domain" unless you've been explicitly told to do so.
 

Circuitsoft

New Member
Aug 28, 2019
6
0
1
38
When I try calling my DID from my cell phone, I do see some SIP packets in a network dump, but the sequence seems to be:

gw1.sip.us -> me: INVITE sip:my_trunk_number@my_ip:5080
me -> gw1.sip.us: 407 Proxy Auth Req'd
gw1.sip.us -> me: ACK sip:my_trunk_number@my_ip:5080
gw2.sip.us -> me: INVITE sip:my_trunk_number@my_ip:5080
me -> gw2.sip.us: 482 Request merged
gw2.sip.us -> me: ACK sip:my_trunk_number@my_ip:5080

But then I don't see any further traffic until I do another REGISTER attempt against the gateway. I also never see a "100 Trying" response from my system going out.
 

Circuitsoft

New Member
Aug 28, 2019
6
0
1
38
From the logs, when I try to call from my cell phone, but "The wireless customer you've called is unavailable"

af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:29.704913 [NOTICE] switch_channel.c:1118 New Channel sofia/external/<my_cell_number>@34.195.166.253 [af187264-7215-49e2-8d5d-6c0ec58c02b5]
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:29.704913 [DEBUG] switch_core_state_machine.c:585 (sofia/external/<my_cell_number>@34.195.166.253) Running State Change CS_NEW (Cur 1 Tot 97)
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:29.704913 [DEBUG] sofia.c:10243 sofia/external/<my_cell_number>@34.195.166.253 receiving invite from 65.254.44.194:5060 version: 1.10.1 -release-12-f9990221e6 64bit
2019-10-03 12:11:29.704913 [DEBUG] sofia.c:10337 verifying acl "domains" for ip/port 65.254.44.194:0.
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:29.704913 [DEBUG] switch_core_state_machine.c:604 (sofia/external/<my_cell_number>@34.195.166.253) State NEW
2019-10-03 12:11:29.704913 [DEBUG] sofia.c:2426 detaching session af187264-7215-49e2-8d5d-6c0ec58c02b5
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [WARNING] switch_core_state_machine.c:688 af187264-7215-49e2-8d5d-6c0ec58c02b5 sofia/external/<my_cell_number>@34.195.166.253 Abandoned
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [NOTICE] switch_core_state_machine.c:691 Hangup sofia/external/<my_cell_number>@34.195.166.253 [CS_NEW] [WRONG_CALL_STATE]
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:585 (sofia/external/<my_cell_number>@34.195.166.253) Running State Change CS_HANGUP (Cur 1 Tot 97)
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:848 (sofia/external/<my_cell_number>@34.195.166.253) Callstate Change DOWN -> HANGUP
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:850 (sofia/external/<my_cell_number>@34.195.166.253) State HANGUP
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] mod_sofia.c:460 Channel sofia/external/<my_cell_number>@34.195.166.253 hanging up, cause: WRONG_CALL_STATE
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:60 sofia/external/<my_cell_number>@34.195.166.253 Standard HANGUP, cause: WRONG_CALL_STATE
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:850 (sofia/external/<my_cell_number>@34.195.166.253) State HANGUP going to sleep
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:620 (sofia/external/<my_cell_number>@34.195.166.253) State Change CS_HANGUP -> CS_REPORTING
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:585 (sofia/external/<my_cell_number>@34.195.166.253) Running State Change CS_REPORTING (Cur 1 Tot 97)
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:936 (sofia/external/<my_cell_number>@34.195.166.253) State REPORTING
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:174 sofia/external/<my_cell_number>@34.195.166.253 Standard REPORTING, cause: WRONG_CALL_STATE
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:936 (sofia/external/<my_cell_number>@34.195.166.253) State REPORTING going to sleep
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:611 (sofia/external/<my_cell_number>@34.195.166.253) State Change CS_REPORTING -> CS_DESTROY
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_session.c:1726 Session 97 (sofia/external/<my_cell_number>@34.195.166.253) Locked, Waiting on external entities
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [NOTICE] switch_core_session.c:1744 Session 97 (sofia/external/<my_cell_number>@34.195.166.253) Ended
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [NOTICE] switch_core_session.c:1748 Close Channel sofia/external/<my_cell_number>@34.195.166.253 [CS_DESTROY]
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:739 (sofia/external/<my_cell_number>@34.195.166.253) Running State Change CS_DESTROY (Cur 0 Tot 97)
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:749 (sofia/external/<my_cell_number>@34.195.166.253) State DESTROY
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] mod_sofia.c:365 sofia/external/<my_cell_number>@34.195.166.253 SOFIA DESTROY
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:181 sofia/external/<my_cell_number>@34.195.166.253 Standard DESTROY
af187264-7215-49e2-8d5d-6c0ec58c02b5 2019-10-03 12:11:39.764915 [DEBUG] switch_core_state_machine.c:749 (sofia/external/<my_cell_number>@34.195.166.253) State DESTROY going to sleep
 

Circuitsoft

New Member
Aug 28, 2019
6
0
1
38
Finally nuked the system and started over, and now everything is working, except that I have a 32-second limit on incoming calls. Outgoing calls have no such issue.

SIP ALG is disabled on router
TCP/UDP 5080-5089 are forwarded to the pbx
UDP 16384-32768 are forwarded to the pbx.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
The 32 second limit on incoming calls is most likely a NAT issue. Check what is in the contact headers and check what is happening to the ACK that follows the 200 OK.
 

Circuitsoft

New Member
Aug 28, 2019
6
0
1
38
I'm not seeing an ACK from the 200 OK. On the REGISTER, the Contact header lists sip:gw+gw_uuid@my_external_ip:5080. I do have ports 5080-5089 TCP and UDP forwarded on my router. But, the 200 OK SDP still llists my internal IP address even though I have the external_sip_ip and external_rtp_ip variables set to my outside IP address properly, and both SIP profiles do reference those variables.
 
Status
Not open for further replies.