hi Sergey,


i tried this before and let me nowhere :=)


sofia_contact internal/1001@mydomain
sofia/internal/sip:1001@192.0.2.77;transport=ws;fs_nat=yes;fs_path=sip%3A192.168.50.60%3Blr%3Breceived%3Dsip%3A192.168.200.77%3A63316%3Btransport%3Dws


originate example:

bgapi expand originate ${sofia_contact(internal/1001@imydomain)} &echo()
+OK Job-UUID: 86f2dd6b-a3d8-4208-8f1b-e4def81cd2a7

2018-02-14 10:49:19.200026 [DEBUG] switch_ivr_originate.c:2142 Parsing global variables
2018-02-14 10:49:19.200026 [NOTICE] switch_channel.c:1104 New Channel sofia/internal/1001@192.0.2.77 [c6605a6c-78c8-4553-a1f7-d4e59793727d]
2018-02-14 10:49:19.200026 [DEBUG] mod_sofia.c:4819 (sofia/internal/1001@192.0.2.77) State Change CS_NEW -> CS_INIT
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:584 (sofia/internal/1001@192.0.2.77) Running State Change CS_INIT (Cur 1 Tot 334)
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:627 (sofia/internal/1001@192.0.2.77) State INIT
2018-02-14 10:49:19.200026 [DEBUG] mod_sofia.c:90 sofia/internal/1001@192.0.2.77 SOFIA INIT
2018-02-14 10:49:19.200026 [DEBUG] sofia_glue.c:1264 sip:192.168.50.60;lr;received=sip:192.168.200.77:63316;transport=ws Setting proxy route to sofia/internal/1001@192.0.2.77
2018-02-14 10:49:19.200026 [DEBUG] sofia_glue.c:1295 sofia/internal/1001@192.0.2.77 sending invite version: 1.6.19 git b1b21d0 2017-11-20 16:34:16Z 64bit
Local SDP:
v=0
o=FreeSWITCH 1518569171 1518569172 IN IP4 192.168.50.65
s=FreeSWITCH
c=IN IP4 192.168.50.65
t=0 0
a=msid-semantic: WMS bXi5EYQcfFSgTMzERN0T6iPThuyNRKxT
m=audio 32588 RTP/SAVPF 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fingerprint:sha-256 09:E7:A0:05:C2:9D:7E:8F:C2:AF:FE:9C:BB:67:0F:F0:4A:E2:E0:33:D0:F5:D5:F7:23:6C:3D:BA:1E:27:C5:65
a=setup:actpass
a=rtcp-mux
a=rtcp:32588 IN IP4 192.168.50.65
a=ssrc:1855748415 cname:xGP2uv4A0NHKp6e6
a=ssrc:1855748415 msid:bXi5EYQcfFSgTMzERN0T6iPThuyNRKxT a0
a=ssrc:1855748415 mslabel:bXi5EYQcfFSgTMzERN0T6iPThuyNRKxT
a=ssrc:1855748415 label:bXi5EYQcfFSgTMzERN0T6iPThuyNRKxTa0
a=ice-ufrag:K5QGdvqlPOYxomgM
a=ice-pwd:SVEdhzD8cbIr8NoIJ4fNpvY5
a=candidate:5270270800 1 udp 659136 192.168.50.65 32588 typ host generation 0
a=candidate:5270270800 2 udp 659136 192.168.50.65 32588 typ host generation 0
a=ptime:20
a=sendrecv

2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:40 sofia/internal/1001@192.0.2.77 Standard INIT
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:48 (sofia/internal/1001@192.0.2.77) State Change CS_INIT -> CS_ROUTING
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:627 (sofia/internal/1001@192.0.2.77) State INIT going to sleep
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:584 (sofia/internal/1001@192.0.2.77) Running State Change CS_ROUTING (Cur 1 Tot 334)
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:643 (sofia/internal/1001@192.0.2.77) State ROUTING
2018-02-14 10:49:19.200026 [DEBUG] mod_sofia.c:143 sofia/internal/1001@192.0.2.77 SOFIA ROUTING
2018-02-14 10:49:19.200026 [DEBUG] switch_ivr_originate.c:67 (sofia/internal/1001@192.0.2.77) State Change CS_ROUTING -> CS_CONSUME_MEDIA
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:643 (sofia/internal/1001@192.0.2.77) State ROUTING going to sleep
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:584 (sofia/internal/1001@192.0.2.77) Running State Change CS_CONSUME_MEDIA (Cur 1 Tot 334)
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:662 (sofia/internal/1001@192.0.2.77) State CONSUME_MEDIA
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:662 (sofia/internal/1001@192.0.2.77) State CONSUME_MEDIA going to sleep
2018-02-14 10:49:19.200026 [DEBUG] sofia.c:7084 Channel sofia/internal/1001@192.0.2.77 entering state [calling][0]
2018-02-14 10:49:19.200026 [DEBUG] sofia.c:7084 Channel sofia/internal/1001@192.0.2.77 entering state [terminated][503]
2018-02-14 10:49:19.200026 [NOTICE] sofia.c:8273 Hangup sofia/internal/1001@192.0.2.77 [CS_CONSUME_MEDIA] [NORMAL_TEMPORARY_FAILURE]
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:584 (sofia/internal/1001@192.0.2.77) Running State Change CS_HANGUP (Cur 1 Tot 334)
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:850 (sofia/internal/1001@192.0.2.77) Callstate Change DOWN -> HANGUP
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:852 (sofia/internal/1001@192.0.2.77) State HANGUP
2018-02-14 10:49:19.200026 [DEBUG] mod_sofia.c:438 Channel sofia/internal/1001@192.0.2.77 hanging up, cause: NORMAL_TEMPORARY_FAILURE
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:60 sofia/internal/1001@192.0.2.77 Standard HANGUP, cause: NORMAL_TEMPORARY_FAILURE
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:852 (sofia/internal/1001@192.0.2.77) State HANGUP going to sleep
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:619 (sofia/internal/1001@192.0.2.77) State Change CS_HANGUP -> CS_REPORTING
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:584 (sofia/internal/1001@192.0.2.77) Running State Change CS_REPORTING (Cur 1 Tot 334)
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:938 (sofia/internal/1001@192.0.2.77) State REPORTING
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:174 sofia/internal/1001@192.0.2.77 Standard REPORTING, cause: NORMAL_TEMPORARY_FAILURE
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:938 (sofia/internal/1001@192.0.2.77) State REPORTING going to sleep
2018-02-14 10:49:19.200026 [DEBUG] switch_core_state_machine.c:610 (sofia/internal/1001@192.0.2.77) State Change CS_REPORTING -> CS_DESTROY
2018-02-14 10:49:19.200026 [DEBUG] switch_core_session.c:1665 Session 334 (sofia/internal/1001@192.0.2.77) Locked, Waiting on external entities
2018-02-14 10:49:19.220029 [DEBUG] switch_ivr_originate.c:3848 Originate Resulted in Error Cause: 41 [NORMAL_TEMPORARY_FAILURE]
2018-02-14 10:49:19.220029 [NOTICE] switch_core_session.c:1683 Session 334 (sofia/internal/1001@192.0.2.77) Ended
2018-02-14 10:49:19.220029 [NOTICE] switch_core_session.c:1687 Close Channel sofia/internal/1001@192.0.2.77 [CS_DESTROY]
2018-02-14 10:49:19.220029 [DEBUG] switch_core_state_machine.c:741 (sofia/internal/1001@192.0.2.77) Running State Change CS_DESTROY (Cur 0 Tot 334)
2018-02-14 10:49:19.220029 [DEBUG] switch_core_state_machine.c:751 (sofia/internal/1001@192.0.2.77) State DESTROY
2018-02-14 10:49:19.220029 [DEBUG] mod_sofia.c:343 sofia/internal/1001@192.0.2.77 SOFIA DESTROY
2018-02-14 10:49:19.220029 [DEBUG] switch_core_state_machine.c:181 sofia/internal/1001@192.0.2.77 Standard DESTROY
2018-02-14 10:49:19.220029 [DEBUG] switch_core_state_machine.c:751 (sofia/internal/1001@192.0.2.77) State DESTROY going to sleep




the workaround i found is to set received_format in kamilio to be ip~port~protoid

modparam("path", "received_format", 1)


by doing this i get a contact that FS "knows" how to route:

sofia_contact internal/1001@mydomain
sofia/internal/sip:1001@192.0.2.77;transport=ws;fs_nat=yes;fs_path=sip%3A192.168.50.60%3Blr%3Breceived%3D192.168.200.77~63931~6

i was unable to find any documentation on how FS behaves when we get received parametar present.


T.



On 12 February 2018 at 18:14, Sergey Safarov <s.safarov@gmail.com> wrote:

Need to get registered user contact string FS api.
Using this contact string you can dial webrtc user


пн, 12 февр. 2018 г., 16:54 Tihomir Culjaga <tculjaga@gmail.com>:
hi,


i have  UA > Kamailio > Freeswitch

UA is using sip for websockets and registers via kamailio to freeswitch.
When i try to originate a call from FS to the registered endpoint, the call fails. 

freeswitch@FS01> bgapi originate {origination_caller_id_number=1002}sofia/internal/1001%mydomain &echo()

I think FS is trying to use transport from received parematar instead of path uri.

any advice how to handle this ?





recv 964 bytes from udp/[192.168.50.60]:5060 at 22:18:57.909700:
   ------------------------------------------------------------------------
   REGISTER sip:192.168.50.60 SIP/2.0
   Via: SIP/2.0/UDP 192.168.50.60;branch=z9hG4bKe929.b6aa43dd1eefa9e4756af7d31d65066e.0
   Via: SIP/2.0/WSS 192.0.2.110;rport=61744;received=192.168.200.77;branch=z9hG4bK3179897
   Max-Forwards: 69
   From: <sip:1001@192.168.50.60>;tag=vq30modpgd
   Call-ID: dlnrna9o4ngn25fb9d1vi2
   CSeq: 192 REGISTER
   Authorization: Digest algorithm=MD5, username="1001", realm="192.168.50.60", nonce="22c52b4b-f795-4caa-bb9b-15bbd87564f7", uri="sip:192.168.50.60", response="a073277bc9c1fcd681de661cb418d838", qop=auth, cnonce="euqeokf2d1gr", nc=00000001
   Contact: <sip:1001@192.0.2.110;transport=ws>;reg-id=1;+sip.instance="<urn:uuid:587f4694-7e55-46dc-a858-579a82556a20>";expires=600
   Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
   Supported: path, gruu, 100rel, outbound
   User-Agent: SIP.js/0.7.0 BB
   Content-Length: 0
   Path: <sip:192.168.50.60;lr;received=sip:192.168.200.77:61744%3Btransport%3Dws>
   
   ------------------------------------------------------------------------
send 738 bytes to udp/[192.168.50.60]:5060 at 22:18:57.950968:
   ------------------------------------------------------------------------
   SIP/2.0 200 OK
   Via: SIP/2.0/UDP 192.168.50.60;branch=z9hG4bKe929.b6aa43dd1eefa9e4756af7d31d65066e.0
   Via: SIP/2.0/WSS 192.0.2.110;rport=61744;received=192.168.200.77;branch=z9hG4bK3179897
   From: <sip:1001@192.168.50.60>;tag=vq30modpgd
   To: <sip:1001@192.168.50.60>;tag=eK8SmZmcU7UBr
   Call-ID: dlnrna9o4ngn25fb9d1vi2
   CSeq: 192 REGISTER
   Contact: <sip:1001@192.0.2.110;transport=ws>;expires=600
   Date: Fri, 09 Feb 2018 21:18:57 GMT
   User-Agent: FreeSWITCH-mod_sofia/1.6.19+git~20171120T163416Z~b1b21d0695~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
   Supported: timer, path, replaces
   Path: <sip:192.168.50.60>;lr;received=sip:192.168.200.77:61744%3Btransport%3Dws
   Content-Length: 0
   
   ------------------------------------------------------------------------



in freeswitch i the registration:

Call-ID:        dlnrna9o4ngn25fb9d1vi2
User:           1001@mydomain
Contact:        "" <sip:1001@192.0.2.110;transport=ws;fs_nat=yes;fs_path=sip%3A192.168.50.60%3Blr%3Breceived%3Dsip%3A192.168.200.77%3A61744%3Btransport%3Dws>
Agent:          SIP.js/0.7.0 BB
Status:         Registered(WS-NAT)(unknown) EXP(2018-02-09 22:29:57) EXPSECS(510)
Ping-Status:    Reachable
Ping-Time:      0.00
Host:           FS01
IP:             192.168.50.60
Port:           5060
Auth-User:      1001
Auth-Realm:     192.168.50.60
MWI-Account:    1001@mydomain




the register contain a path header with received=<original uri>.

when i try to originate a call to this registered user the call goes nowhere :=)


freeswitch@FS01> bgapi originate {origination_caller_id_number=1002}sofia/internal/1001%mydomain &echo()
+OK Job-UUID: 200e2197-a6de-42d9-b4bb-63917223bc53

2018-02-09 22:25:40.500100 [DEBUG] switch_ivr_originate.c:2142 Parsing global variables
2018-02-09 22:25:40.500100 [NOTICE] switch_channel.c:1104 New Channel sofia/internal/1001 [327826f9-8a8c-46c7-b3ed-8bf22852df88]
2018-02-09 22:25:40.500100 [DEBUG] mod_sofia.c:4819 (sofia/internal/1001) State Change CS_NEW -> CS_INIT
2018-02-09 22:25:40.500100 [DEBUG] switch_core_state_machine.c:584 (sofia/internal/1001) Running State Change CS_INIT (Cur 1 Tot 217)
2018-02-09 22:25:40.500100 [DEBUG] switch_core_state_machine.c:627 (sofia/internal/1001) State INIT
2018-02-09 22:25:40.500100 [DEBUG] mod_sofia.c:90 sofia/internal/1001 SOFIA INIT
2018-02-09 22:25:40.500100 [DEBUG] sofia_glue.c:1264 sip:192.168.50.60;lr;received=sip:192.168.200.77:61744;transport=ws Setting proxy route to sofia/internal/1001
2018-02-09 22:25:40.500100 [DEBUG] sofia_glue.c:1295 sofia/internal/1001 sending invite version: 1.6.19 git b1b21d0 2017-11-20 16:34:16Z 64bit











_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org