Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

6) Add dialplan configuration in extensions.conf to route outgoing calls through this PJSIP trunk. Assuming users to dial '9' followed by the number to call externally.

Code Block
[internalfrom-usersexternal]
exten => _9X.2931,1,NoOp
exten => _9X.,n,Dial(PJSIP/${EXTEN:1}@linphone_freesip_trunk)
exten => _9X.,n,Hangup()
include => outbound-linphone1001&PJSIP/1002)

[from-internal]
exten => 1001,1,Dial(PJSIP/1001,20)
exten => 1002,1,Dial(PJSIP/1002,20)
include => outbound-linphone

[outbound-linphone]
exten => _9XX.,1,NoOp
same => n,Dial(PJSIP/${EXTEN:1}@linphone_freesip_trunk,60)
same => n,Hangup())

7) After updating the configurations, reload both the configurations from asterisk CLI7) Add dialplan configuration for Incoming calls from public Internet.

Code Block
[from-linphone]
exten => s,1,NoOp
same => n,Dial(PJSIP/1001,20)
same => n,Hangup()
exten => 2931,1,NoOp
same => n,Dial(PJSIP/1001,20)
same => n,Hangup()

8) After updating the configurations, reload both the configurations from asterisk CLI.

Code Block
Filogic-GW*CLI> module reload res_pjsip.so
Module 'res_pjsip.so' reloaded successfully.
    -- Reloading module 'res_pjsip.so' Filogic-GW*CLI> module reload res_pjsip.so
Module 'res_pjsip.so' reloaded successfully.
    -- Reloading module 'res_pjsip.so' (Basic SIP resource)
Filogic-GW*CLI> dialplan reload
Dialplan reloaded.
[Jul 17 12:20:40] WARNING[1027809]: pbx.c:7126 add_priority: Extension '1001' priority 7 in 'default', label 'unavail' already in use at priority 6
[Jul 17 12:20:40] WARNING[1027809]: pbx.c:7126 add_priority: Extension '1002' priority 5 in 'default', label 'busy' already in use at priority 4
[Jul 17 12:20:40] WARNING[1027809]: pbx.c:7126 add_priority: Extension '1002' priority 7 in 'default', label 'unavail' already in use at priority 6
    -- Time to scan old dialplan and merge leftovers back into the new: 0.000062 sec
    -- Time to restore hints and swap in new dialplan: 0.000018 sec
    -- Time to delete the old dialplan: 0.000046 sec
    -- Total time merge_contexts_delete: 0.000126 sec
    -- pbx_config successfully loaded 6 contexts (enable debug for details).

98) Verify that the endpoints are registered successfully or not.

Code Block
Filogic-GW*CLI> pjsip show registrations

 <Registration/ServerURI..............................>  <Auth....................>  <Status.......>
==========================================================================================

 linphone_freesip_registration/sip:sip.linphone.org      linphone_freesip_auth       Registered        (exp. 68882s ago)

Objects found: 1

Filogic-GW*CLI> pjsip show endpoints

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  1001                                                 Not in use    0 of inf
     InAuth:  1001/1001
        Aor:  1001                                              10
  Transport:  udp-transport             udp      0      0  0.0.0.0:5060

 Endpoint:  1002                                                 Unavailable   0 of inf
     InAuth:  1002/1002
        Aor:  1002                                              10
  Transport:  udp-transport             udp      0      0  0.0.0.0:5060

 Endpoint:  linphone_freesip_trunk                               Not in use    0 of inf
    OutAuth:  linphone_freesip_auth/2931
     InAuth:  linphone_freesip_auth/2931
        Aor:  linphone_freesip_aor                               1
      Contact:  linphone_freesip_aor/sip:sip.linphone.org: 8248a8908d Avail       187.774
  Transport:  udp-transport             udp      0      0  0.0.0.0:5060
   Identify:  linphone_identify/linphone_freesip_trunk
        Match: 5.135.215.43/32


Objects found: 3

Filogic-GW*CLI>

109) Add firewall rules to allow sip and rtp ports. Flush any rules which are blocking the clients traffic.

Code Block
root@Filogic-GW:~# iptables -F
root@Filogic-GW:~# iptablesI INPUT -Ap INPUT -p udp --dport 5060 -j ACCEPT
root@Filogic-GW:~# iptables -AI INPUT -p udp --dport 10000:20000 -j ACCEPT
root@Filogic-GW:~# iptables -nL
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:5060
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpts:10000:20000

1110) Now initiate an outbound call from internal extension to the external sip server(2931).

Code Block
-- Executing [92931@from-internal:1] NoOp("PJSIP/1001-00000001", "") in new stack
    -- Executing [92931@from-internal:2] Dial("PJSIP/1001-00000001", "PJSIP/2931@linphone_freesip_trunk,60") in new stack
    -- Called PJSIP/2931@linphone_freesip_trunk
    -- PJSIP/linphone_freesip_trunk-00000002 is ringing
    -- Added contact 'sip:1001@192.168.1.9:36312;transport=UDP;rinstance=faa99161e70850c2' to AOR '1001' with expiration of 60 seconds
[Jul 16 11:20:45] WARNING[1830]: db.c:316 db_execute_sql: Error executing SQL (COMMIT): database is locked
       > 0x7f940598d0 -- Strict RTP learning after remote address set to: 5.135.215.43:18034
    -- PJSIP/linphone_freesip_trunk-00000002 answered PJSIP/1001-00000001
       > 0x7f94049790 -- Strict RTP learning after remote address set to: 192.168.1.9:36687
    -- Channel PJSIP/linphone_freesip_trunk-00000002 joined 'simple_bridge' basic-bridge <97c41ec6-e3f4-45e8-ad94-f2f8763abff7>
    -- Channel PJSIP/1001-00000001 joined 'simple_bridge' basic-bridge <97c41ec6-e3f4-45e8-ad94-f2f8763abff7>
    -- Channel PJSIP/linphone_freesip_trunk-00000002 left 'simple_bridge' basic-bridge <97c41ec6-e3f4-45e8-ad94-f2f8763abff7>
    -- Channel PJSIP/1001-00000001 left 'simple_bridge' basic-bridge <97c41ec6-e3f4-45e8-ad94-f2f8763abff7>
  == Spawn extension (from-internal, 92931, 2) exited non-zero on 'PJSIP/1001-00000001'
    -- Added contact 'sip:1001@192.168.1.9:36312;transport=UDP;rinstance=faa99161e70850c2' to AOR '1001' with expiration of 60 seconds  PJSIP/1001-00000001 left 'simple_bridge' basic-bridge <97c41ec6-e3f4-45e8-ad94-f2f8763abff7>
  == Spawn extension (from-internal, 92931, 2) exited non-zero on 'PJSIP/1001-00000001'
    -- Added contact 'sip:1001@192.168.1.9:36312;transport=UDP;rinstance=faa99161e70850c2' to AOR '1001' with expiration of 60 seconds 

SIP registration commands after adding the code changes:

1) By default inbound call configuration will be updated in the device.

2) Please take two clients install an application which supports voice calls and register those clients with the configuration in the "/etc/asterisk" folder.

    As per current configuration,

    Client1:

    Host: <erouter IP>

    Username: 601

    Password: 601

    Client2:

    Host: <erouter IP>

    Usename: 602

    Password: 602

3) Please set below commands from the console to update the outbound configuration. 

      dmcli eRT setv Device.Services.VoiceService.1.VoiceProfile.1.Line.1.Enable string Enabled

      dmcli eRT setv Device.Services.VoiceService.1.VoiceProfile.1.SIP.OutboundProxy string sip.linphone.org

      dmcli eRT setv Device.Services.VoiceService.1.VoiceProfile.1.SIP.OutboundProxyPort uint 5060

      dmcli eRT setv Device.Services.VoiceService.1.VoiceProfile.1.Line.1.SIP.AuthUserName string <username>

      dmcli eRT setv Device.Services.VoiceService.1.VoiceProfile.1.Line.1.SIP.AuthPassword string <password>

      dmcli eRT getv Device.Services.VoiceService.1.VoiceProfile.1.Line.1.Status

4) Please take some other client and create an account in sip.linphone.org

5) Provide the username and password in the data models as per the data used for account creation using linphone.

6) Added below logs for the reference.

Code Block
root@Filogic-GW:~# asterisk -x "pjsip show endpoints"

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  2931_trunk                                           Not in use    0 of inf
    OutAuth:  2931_auth/2931
        Aor:  2931_aor                                           0
      Contact:  2931_aor/sip:sip.linphone.org              e53c3ca51a NonQual         nan
  Transport:  udp-transport             udp      0      0  0.0.0.0:5060
   Identify:  2931_identify/2931_trunk
        Match: 5.135.215.43/32
        Match: 2001:41d0:203:7fe2::4/128
        Match: 176.31.149.179/32
        Match: 2001:41d0:303:b0d2::4/128

 Endpoint:  601                                                  Not in use    0 of inf
     InAuth:  601/601
        Aor:  601                                               10
      Contact:  601/sip:601@192.168.1.2:38116;transport=UD ba3b650e9b NonQual         nan
  Transport:  udp-transport             udp      0      0  0.0.0.0:5060

 Endpoint:  602                                                  Not in use    0 of inf
     InAuth:  602/602
        Aor:  602                                               10
      Contact:  602/sip:602@192.168.1.5:57429;transport=UD 2936e37328 NonQual         nan
  Transport:  udp-transport             udp      0      0  0.0.0.0:5060


Objects found: 3

root@Filogic-GW:~#
root@Filogic-GW:~#
root@Filogic-GW:~# asterisk -x "pjsip show registrations"

 <Registration/ServerURI..............................>  <Auth....................>  <Status.......>
==========================================================================================

 2931_registration/sip:sip.linphone.org                  2931_auth                   Registered        (exp. 79s)

Objects found: 1

root@Filogic-GW:~#