Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question : Can i use drachitio-srf support WSS ? And can i use it to register with SIP server via WSS #94

Open
sagarmalam opened this issue Sep 15, 2020 · 7 comments

Comments

@sagarmalam
Copy link

Question : Can i use drachitio-srf support WSS ? And can i use it to register with SIP server via WSS as a UAC ?

P.S : I am not sure if this is right place to ask question but i could find any other place to get help.In case there is mail list or forum please point me to it.

@davehorton
Copy link
Collaborator

davehorton commented Sep 15, 2020

This is a fine place to ask questions.

You should be able to, though I don't think I have tried this myself. The first step is to configure the drachtio server for WSS (let me know if you need help on that). Then you would use srf#createUAC, specifying a sips uri with transport=wss

@sagarmalam
Copy link
Author

Hi,

I looked at the documentation and i realised that using https://drachtio.org/docs#sip-proxy is better option that createUAC. I want to build SIP to WEBRTC gateway i.e drachtio will recieve SIP requests via TCP and UDP and it has to proxy it via WS and WSS.

I have tried below code but registers are not being forwarded :
app.js :

const Srf = require('drachtio-srf');
const srf = new Srf();

srf.connect({
  host: '127.0.0.1',
  port: 9021,
  secret: 'cymru'
});

srf.on('connect', (err, hostport) => {
  console.log(`connected to a drachtio server listening on: ${hostport}`);
});

srf.register((req, res) => {
  srf.proxyRequest(req, 'sip:example.com;transport=ws')
    .then((results) => console.log(JSON.stringify(result)) );
});

I have verified that drachtio is listening on WS socket :

root@sagar-HP-ProBook-640-G1:/usr/src/reject-nice# node app.js 
connected to a drachtio server listening on: ws/10.212.134.167:5060,udp/10.212.134.167:5060

I am getting below error in logs :

2020-09-16 19:58:31.925150 Discarding retransmitted request since we are a stateful proxy REGISTER YTA2OWYyZDg3MzMyOGZmYmVlYjJhZTNhNjAwZmVhMDg.
2020-09-16 19:58:31.954515 timer E fired for a client transaction in TERMINATED
2020-09-16 19:58:31.966042 tport.c:1002 tport_base_connect() tport_base_connect(0x55bd944a1560): what(pf=2 ws/[198.136.226.1]:5060): Broken pipe
2020-09-16 19:58:31.976356 tport.c:1002 tport_base_connect() tport_base_connect(0x55bd944a1560): what(pf=2 ws/[198.136.226.1]:5060): Broken pipe
2020-09-16 19:58:31.976448 nta.c:8673 outgoing_print_tport_error() nta: REGISTER (1): Broken pipe (32) with ws/[198.136.226.1]:5060
2020-09-16 19:58:33.924710 recv 704 bytes from udp/[10.212.134.167]:45153 at 19:58:33.924537:
REGISTER sip:example.com;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 43.228.229.106:45153;branch=z9hG4bK-d8754z-e7da885271931534-1---d8754z-
Max-Forwards: 70
Contact: <sip:[email protected]:45153;rinstance=fa07c93d6712ed92;transport=UDP>
To: <sip:[email protected];transport=UDP>
From: <sip:[email protected];transport=UDP>;tag=cdee9d70
Call-ID: YTA2OWYyZDg3MzMyOGZmYmVlYjJhZTNhNjAwZmVhMDg.
CSeq: 1 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Allow-Events: presence, kpml
Content-Length: 0
 
2020-09-16 19:58:33.924852 Discarding retransmitted request since we are a stateful proxy REGISTER YTA2OWYyZDg3MzMyOGZmYmVlYjJhZTNhNjAwZmVhMDg.
2020-09-16 19:58:33.955576 timer E fired for a client transaction in TERMINATED
2020-09-16 19:58:33.966995 tport.c:1002 tport_base_connect() tport_base_connect(0x55bd944a1560): what(pf=2 ws/[198.136.226.1]:5060): Broken pipe
2020-09-16 19:58:33.977330 tport.c:1002 tport_base_connect() tport_base_connect(0x55bd944a1560): what(pf=2 ws/[198.136.226.1]:5060): Broken pipe
2020-09-16 19:58:33.977401 nta.c:8673 outgoing_print_tport_error() nta: REGISTER (1): Broken pipe (32) with ws/[198.136.226.1]:5060
2020-09-16 19:58:37.924465 recv 704 bytes from udp/[10.212.134.167]:45153 at 19:58:37.924358:
REGISTER sip:example.com;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 43.228.229.106:45153;branch=z9hG4bK-d8754z-e7da885271931534-1---d8754z-
Max-Forwards: 70
Contact: <sip:[email protected]:45153;rinstance=fa07c93d6712ed92;transport=UDP>
To: <sip:[email protected];transport=UDP>
From: <sip:[email protected];transport=UDP>;tag=cdee9d70
Call-ID: YTA2OWYyZDg3MzMyOGZmYmVlYjJhZTNhNjAwZmVhMDg.
CSeq: 1 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.3.25608 r25552
Allow-Events: presence, kpml
Content-Length: 0
 
2020-09-16 19:58:37.924557 Discarding retransmitted request since we are a stateful proxy REGISTER YTA2OWYyZDg3MzMyOGZmYmVlYjJhZTNhNjAwZmVhMDg.
2020-09-16 19:58:37.956691 timer E fired for a client transaction in TERMINATED
2020-09-16 19:58:37.968563 tport.c:1002 tport_base_connect() tport_base_connect(0x55bd944a1560): what(pf=2 ws/[198.136.226.1]:5060): Broken pipe
2020-09-16 19:58:37.978837 tport.c:1002 tport_base_connect() tport_base_connect(0x55bd944a1560): what(pf=2 ws/[198.136.226.1]:5060): Broken pipe
2020-09-16 19:58:37.978939 nta.c:8673 outgoing_print_tport_error() nta: REGISTER (1): Broken pipe (32) with ws/[198.136.226.1]:5060

I am facing this issue on with WS.It working fine with TCP and UDP.

Thanks

@davehorton
Copy link
Collaborator

can you provide a log with loglevel debug and sofia loglevel 9.

@sagarmalam
Copy link
Author

sagarmalam commented Sep 16, 2020

Please find logs file :
logs.txt

@davehorton
Copy link
Collaborator

so you are trying to send over an unsecured websocket (strange) to the address sc4test.sip.teledge.com, which resolves to 198.136.226.1. Since this is a tcp-based connection you would need something listening on that address port 5060 for tcp connections, and apparently nothing is.

@sagarmalam
Copy link
Author

I am able to connect and register using WEBRTC SIP client using WS and WSS both . I have tried with sipml5 (https://www.doubango.org/sipml5/call.htm?svn=252) and SIP.JS.
I can also telnet on same port :
sagar@sagar-HP-ProBook-640-G1:~$ sudo telnet sc4test.sip.teledge.com 5060
[sudo] password for sagar:
Trying 198.136.226.1...
Connected to sc4test.sip.teledge.com.
Escape character is '^]'

I dont think there is any issue with server. I have also verified that there is no firewall rules blocking any traffic on port 5060.

P.S : I am using WS so that i can see packet using Network Sniffer during development.It makes troubleshooting easy.

@davehorton
Copy link
Collaborator

can you get a pcap file showing all traffic between your server and 198.136.226.1 so we can have a look at the tcp connection establishment? It seems to be failing for some reason

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

No branches or pull requests

2 participants