Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

OverSIP v1.4.0 SIP registration issue #51

Closed
aamiryu opened this issue Sep 15, 2013 · 15 comments
Closed

OverSIP v1.4.0 SIP registration issue #51

aamiryu opened this issue Sep 15, 2013 · 15 comments

Comments

@aamiryu
Copy link

aamiryu commented Sep 15, 2013

With the new OverSIP v1.4.0 installed and the only change in the oversip.conf to be included w.r.t. v1.3.0 was advertised_address_ipv4 in SIP and WS profile, it is not able to register to the OpenSIPS registrar. We have an AWS server with the given below details. We have OpenSIPS and OverSIP on the same AWS machine and trying to register an extension through SIPml5 latest code uploaded. With the same components installed but with OverSIP v1.3.0 we can register the extension though and also could make outbound calls but there were issues with inbound calls due to NAT which OverSIP 1.4.0 can resolve but with OverSIP v1.4.0 installed we could not even register to the OpenSIPS and given below are the configuration and output of an ngrep command:

OpenSIPS public advertised ipv4: a.b.c.d
OpenSIPS private IP: w.x.y.z
OpenSIPS port: efgh

OverSIP advertised_address_ipv4: a.b.c.d
OverSIP private IP: w.x.y.z
OverSIP port: pqrs
w.x.y.z:pqrs
a.b.c.d:pqrs

SIPml5 NAT'ed Public IPv4: l.m.n.p
SIPml5 NAT'ed Public port: hijk
l.m.n.p:hijk

ngrep output:

T l.m.n.p:hijk -> w.x.y.z:pqrs [AP]
GET / HTTP/1.1..Upgrade: websocket..Connection: Upgrade..Host: a.b.c.d:pqrs..Origin: http://a.b.c.d..Sec-WebSocket-Protocol: sip..Pragma: no-cache..Cach
e-Control: no-cache..Sec-WebSocket-Key: Iye+y+TilFccY4aSeXQ0Qw==..Sec-WebSocket-Version: 13..Sec-WebSocket-Extensions: x-webkit-deflate-frame..User-Agent: Mozilla/
5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36..Cookie: __utma=134628469.304461993.1377669373.1379266315.1379
274392.8; __utmb=134628469.2.10.1379274392; __utmc=134628469; __utmz=134628469.1377669373.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)....

T w.x.y.z:pqrs -> l.m.n.p:hijk [AP]
HTTP/1.1 101 Switching Protocols..Upgrade: websocket..Connection: Upgrade..Sec-WebSocket-Accept: hfm7/cqAtPsoy3h9T2zpGjK8Hmo=..Sec-WebSocket-Protocol: sip..Server:
OverSIP/1.4.0....

T l.m.n.p:hijk -> w.x.y.z:pqrs [AP]
...E.7...r...c...D..........................a...............S...V...[.......V.......Y...M.......e...........[...Y..._...G.......E...C...E...........D.......w.....
..................S...E.......f.......X...........G.......................t...V...........D.......w...].......S...A...S...T.......V.......C...D...C.......G...D....
...^...T...........Z...^...Z...B.......P...R...Y.......V...
...............R.......T.......T.......:...R...........p...r...t...R...{...C.......V...X...E.......=...
E...R.......T...Y...z.......G...................=...V...V...Y...X...Y...c...T...=...G...R...G...:...

T w.x.y.z:pqrs -> l.m.n.p:hijk [AP]
.~..SIP/2.0 500 Internal Error..Via: SIP/2.0/WS df7jal23ls0d.invalid;branch=z9hG4bKFRNce5IP03ylmlaRwn60hhbpxpmV1HoS;rport..From: "9003"sip:9003@w.x.y.z;ta
g=SRGd38Rr1hT8OfuQFSQ4..To: "9003"sip:9003@w.x.y.z;tag=b062f4bf.3cdba5ae..Call-ID: 97ac7c06-c07e-b21c-2cca-6f0bcebb9ba8..CSeq: 17680 REGISTER..Content-Len
gth: 67..Content-Type: text/plain..Server: OverSIP/1.4.0....OverSIP::RuntimeError: proxy must be a OverSIP::SIP::Proxy instance

Could someone please help us out in resolving the issue. What I feel after looking at the output of the ngrep is that there is something wrong with the new OverSIP v1.4.0 code because the request to the OpenSIPS for registering an extension never reached, it died at OverSIP end itself.

@aamiryu
Copy link
Author

aamiryu commented Sep 15, 2013

Given below are the syslog logs for the error I received while registering a SIPml5 client through OverSIP v1.4.0:

Sep 15 20:53:44 oversip[18088]: DEBUG: connection opened from l.m.n.p:hijk
Sep 15 20:53:44 oversip[18088]: DEBUG: running OverSIP::WebSocketEvents.on_connection()...
Sep 15 20:53:44 oversip[18088]: NOTICE: on_connection() method is not defined
Sep 15 20:53:44 oversip[18088]: DEBUG: replying 101 "Switching Protocols"
Sep 15 20:53:44 oversip[18088]: DEBUG: received text frame: FIN=true, RSV1-3=false/false/false, payload_length=581
Sep 15 20:53:44 oversip[18088]: DEBUG: received WS message: type=text, length=581
Sep 15 20:53:44 oversip[18088]: INFO: [user] REGISTER from sip:9003@w.x.y.z (UA: IM-client/OMA1.0 sipML5-v1.2013.08.10B) to sip:w.x.y.z via WS l.m.n.p : hijk
Sep 15 20:53:44 oversip[18088]: DEBUG: applying outgoing Outbound support
Sep 15 20:53:44 oversip[18088]: ERROR: error calling OverSIP::SipEvents.on_request() => 500:
Sep 15 20:53:44 oversip[18088]: ERROR: proxy must be a OverSIP::SIP::Proxy instance (OverSIP::RuntimeError)#12/var/lib/gems/1.9.1/gems/oversip-1.4.0/lib/oversip/modules/outbound_mangling.rb:11:in add_outbound_to_contact'#012/etc/oversip/server.rb:200:inon_request'#12/var/lib/gems/1.9.1/gems/oversip-1.4.0/lib/oversip/sip/message_processor.rb:106:in `block in process_request'
Sep 15 20:53:44 oversip[18088]: DEBUG: replying 500 "Internal Error"
Sep 15 20:53:44 oversip[18088]: DEBUG: sending text frame: payload_length=449

@saghul
Copy link

saghul commented Sep 16, 2013

This commit seems to have caused the problem: e58974f

The outbound mangling module was refactored and now takes a proxy instance instead of a request object. The sample server.rb wasn't adapted to this change, though.

@aamiryu
Copy link
Author

aamiryu commented Sep 16, 2013

Ok. Actually I was going through the code for outbound mangling kept under:

/var/lib/gems/1.9.1/gems/oversip-1.4.0/lib/oversip/modules/outbound_mangling.rb

9 def self.add_outbound_to_contact proxy
10 unless proxy.is_a? ::OverSIP::SIP::Proxy
11 raise ::OverSIP::RuntimeError, "proxy must be a OverSIP::SIP::Proxy instance"
12 end

We land up here from the server.rb file kept under:

/etc/oversip/oversip.conf

198 if MyExampleApp.do_outbound_mangling
199 # Contact mangling for the case in which the registrar does not support Path.
200 ::OverSIP::Modules::OutboundMangling.add_outbound_to_contact request
201 end

And after that I was stalled here and didn't go much deeper into troubleshooting.

Let us know if we can resolve this issue by some minor code change.

--Aamir

@saghul
Copy link

saghul commented Sep 16, 2013

On 9/16/13 9:30 AM, aamiryu wrote:

Ok. Actually I was going through the code for outbound mangling kept under:

/var/lib/gems/1.9.1/gems/oversip-1.4.0/lib/oversip/modules/outbound_mangling.rb

9 def self.add_outbound_to_contact proxy
10 unless proxy.is_a? ::OverSIP::SIP::Proxy
11 raise ::OverSIP::RuntimeError, "proxy must be a OverSIP::SIP::Proxy
instance"
12 end

We land up here from the server.rb file kept under:

/etc/oversip/oversip.conf

198 if MyExampleApp.do_outbound_mangling
199 # Contact mangling for the case in which the registrar does not
support Path.
200 ::OverSIP::Modules::OutboundMangling.add_outbound_to_contact request
201 end

And after that I was stalled here and didn't go much deeper into
troubleshooting.

Let us know if we can resolve this issue by some minor code change.

--Aamir


Reply to this email directly or view it on GitHub
#51 (comment).

I don't know all OverSIP internals, but in the sample server.rb, a proxy
instance is created right after calling add_outbound_to_contact. I would
try to create it earlier, and pass the proxy object to
add_outbound_to_contact, instead of passing request.

Saúl Ibarra Corretgé
http://about.me/saghul | http://saghul.net

@ibc
Copy link
Member

ibc commented Sep 16, 2013

If the sample server.rb does not include the new OutboundMangling module syntax then that's a bug. Let me check it.

@ibc ibc closed this as completed in 736ce15 Sep 16, 2013
@ibc
Copy link
Member

ibc commented Sep 16, 2013

Exactly how @saghul suggested: create the proxy instance before and then pass it to the add_outbound_to_contact method.

The server.rb sample code has been fixed.

@ibc
Copy link
Member

ibc commented Sep 16, 2013

Anyhow @aamiryu, you do NOT need the OverSIP::Modules::OutboundMangling if your registrar supports Path, and AFAIK OpenSISP does support it, so you can safely remove it from your OverSIP conf.

@ibc
Copy link
Member

ibc commented Sep 16, 2013

@aamiryu one more thing please: for a future report, could you please provide the syslog output?

@aamiryu
Copy link
Author

aamiryu commented Sep 16, 2013

@ibc how to remove the outboundmangling from the oversip conf ? does the advertised_ipv4 need to be removed from the config or some other parameter ?

I did provide the syslog output in the chain after submitting the issue in the comment part, because I thought you guys only need the syslog related to oversip not related to anything else and yeah it was a bit modified because I didn't wanted to publish my IP's over this.

--Aamir

@saghul
Copy link

saghul commented Sep 16, 2013

On 9/16/13 3:50 PM, aamiryu wrote:

@ibc https://github.com/ibc how to remove the outboundmangling from
the oversip conf ? does the advertised_ipv4 need to be removed from the
config or some other parameter ?

Check the modified server.rb in the repo.

Saúl Ibarra Corretgé
http://about.me/saghul | http://saghul.net

@ibc
Copy link
Member

ibc commented Sep 16, 2013

I promise you that the server.rb file provided by OverSIP installation is just a sample code. Users can/should adapt it to their needs ;)

@aamiryu
Copy link
Author

aamiryu commented Sep 16, 2013

Oops missed that, in the meantime i just saw the parameter in the server.rb:

27 @do_outbound_mangling = true

I have changed it to false now, lets see what output do i see ;-)...

--Aamir

@aamiryu
Copy link
Author

aamiryu commented Sep 16, 2013

@ibc done, i can successfully register with that parameter disabled, now i will check out the modified the server.rb ;-)...

Thanks @ibc & @saghul

@ibc
Copy link
Member

ibc commented Sep 16, 2013

Still you can get rid of the entire sample server.rb and write your own. It is Ruby ;)

@ibc
Copy link
Member

ibc commented Sep 16, 2013

BTW OverSIP 1.4.1 has been released fixing this minor bug: http://oversip.net/news/2013-09-16/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants