registration against opensips

369 views
Skip to first unread message

D S

unread,
Oct 2, 2012, 3:41:54 AM10/2/12
to 2600hz...@googlegroups.com
Hi,

I have this testing environment:
1x opensips (configured like this: http://wiki.freeswitch.org/wiki/OpenSIPS_configuration_for_2_or_more_FreeSWITCH_installs)
3x freeswitch
2x rabbit, bigcouch, whistle

Problem often happened with registration against opensips. I've got response 401 unauthorized, but sometimes it works and I can do calls. It's very accidental.
Registration against particular FS-es works fine and never failed.

In logs I see that ecallmgr send XML message to a particular FS:
sending XML to 'frees...@sip.xxx': <document type="freeswitch/xml"><section name="directory"><domain name="sip.xxx"><user id="user_9zajxg"><variables><variable name="ecallmgr_Owner-ID" value="539056f38f7b66443db0bbc4933715e2"/><variable name="ecallmgr_Authorizing-ID" value="e3f5fb180270414bcaefed99d4160e3b"/><variable name="ecallmgr_Inception" value="on-net"/><variable name="ecallmgr_Authorizing-Type" value="device"/><variable name="ecallmgr_Account-ID" value="1787fc68b0d93b2656a776d827c6ef44"/><variable name="ecallmgr_Realm" value="sip.xxx"/><variable name="ecallmgr_Username" value="user_9zajxg"/></variables><params><param name="password" value="xxx"/></params></user></domain></section></document>

But response (401 Unauthorized) sends to the client another FS. It's like client try register to sip.xxx first time, but second request  is send to another FS by opensips. This second FS didn't get XML document (above) from ecallmgr thus doesn't know about user_xxx. After few attempts round-robin alg. send request to right FS and it works for a while.

Any ideas?
Thanks.

Dusan

Darren Schreiber

unread,
Oct 2, 2012, 10:31:14 AM10/2/12
to 2600hz...@googlegroups.com
Please attach the OpenSIPs logs that related to this. You can find these logs easily – inside the registrations that are failing or "moving" there is a Call-ID . Grep for the Call-ID and paste the results here.

Do the same thing for BOTH FreeSWITCH servers (grep for the Call-ID) and paste those results also.

Remove any confidential passwords please before pasting.

Jon Blanton

unread,
Oct 2, 2012, 10:39:05 AM10/2/12
to <2600hz-users@googlegroups.com>
Hi Dusan,

I suggest using our OpenSIPs config instead of the one found on the FreeSWITCH wiki. You can find that config and the dispatcher script here: https://github.com/2600hz/whistle-fs/tree/master/opensips . That OpenSIPs config works like a template - there is a linux command in a comment at the top of the file to "render" the template (stick IPs where they needs to go, etc).

A 401 is a normal, expected, response to a registration attempt. Registration workflow looks like this:
-Client sends REGISTER without any credentials
-Server sends 401 with a nonce (the nonce is used encrypt the credentials)
-Client sends REGISTER with the encrypted credentials
---If successful (correct credentials, etc), server sends 200 OK
---If unsuccessful, server sends 403 Forbidden

Using our OpenSIPs config will ensure that REGISTERs stay on the same server, at least for the life of any single registration workflow. To be clear, REGISTERs will still be sent to any FreeSWITCH server: Phone A's registration might come to FreeSWTICH 1, and Phone B's registration might come to FreeSWITCH 2. The registration is then basically "locked" to that server until the final 200 OK or 403 Forbidden.

Hope that helps :)

-Jon

On Oct 2, 2012, at 12:41 AM, D S <dusan.s...@gmail.com>
 wrote:

Karl Anderson

unread,
Oct 2, 2012, 7:49:12 AM10/2/12
to 2600hz...@googlegroups.com
Dusan,

If you are using the OpenSIPs configuration that you found on the FreeSWITCH wiki then that would be why your having problems.  We have written an OpenSIPs configuration that is specifically designed to work with our system, see https://github.com/2600hz/whistle-fs/blob/master/opensips/opensips.tmp

You will need to replace {{SIP_PORT}} and {{SIP_IP}} with the appropriate values then rename the file "opensips.cfg".  Our script will also expect a file in the same directory called "dispatcher.list" that contains a list of your FreeSWITCH server IPs in the following format:

cat ./dispatcher.list
1 sip:{{fs1_server_ip}}:5060 2
1 sip:{{fs2_server_ip}}:5060 2

1 sip:{{fs3_server_ip}}:5060 2
1 sip:{{fs4_server_ip}}:5060 2


Please note that the leading '1 ' and trailing ' 2' are important.



Karl Anderson

  Senior Bit Herder

  visit: www.2600hz.com
  tel: 415-886-7903

Dusan

unread,
Oct 3, 2012, 4:49:56 PM10/3/12
to 2600hz...@googlegroups.com, ka...@2600hz.com
Hi,

thank you very much.

It seems it works already few hours without problems with new config.

Dusan
sending XML to 'free...@sip.xxx': <document type="freeswitch/xml"><section name="directory"><domain name="sip.xxx"><user id="user_9zajxg"><variables><variable name="ecallmgr_Owner-ID" value="539056f38f7b66443db0bbc4933715e2"/><variable name="ecallmgr_Authorizing-ID" value="e3f5fb180270414bcaefed99d4160e3b"/><variable name="ecallmgr_Inception" value="on-net"/><variable name="ecallmgr_Authorizing-Type" value="device"/><variable name="ecallmgr_Account-ID" value="1787fc68b0d93b2656a776d827c6ef44"/><variable name="ecallmgr_Realm" value="sip.xxx"/><variable name="ecallmgr_Username" value="user_9zajxg"/></variables><params><param name="password" value="xxx"/></params></user></domain></section></document>
Reply all
Reply to author
Forward
0 new messages