...
| Code Block |
|---|
-- Executing [1002@from-internal:1] Dial("PJSIP/1001-00000000", "PJSIP/1002,20") in new stack
-- Called PJSIP/1002
-- Removed contact 'sip:1001@192.168.1.4:45167;transport=UDP;rinstance=34df73ee3b3522b6' from AOR '1001' due to expiration
== Contact 1001/sip:1001@192.168.1.4:45167;transport=UDP;rinstance=34df73ee3b3522b6 has been deleted
-- PJSIP/1002-00000001 is ringing
-- PJSIP/1002-00000001 answered PJSIP/1001-00000000
-- Channel PJSIP/1002-00000001 joined 'simple_bridge' basic-bridge <d8b6ecbe-8d28-4684-84d6-ec19d2a31361>
-- Channel PJSIP/1001-00000000 joined 'simple_bridge' basic-bridge <d8b6ecbe-8d28-4684-84d6-ec19d2a31361>
-- Channel PJSIP/1001-00000000 left 'native_rtp' basic-bridge <d8b6ecbe-8d28-4684-84d6-ec19d2a31361>
== Spawn extension (from-internal, 1002, 1) exited non-zero on 'PJSIP/1001-00000000'
-- Channel PJSIP/1002-00000001 left 'native_rtp' basic-bridge <d8b6ecbe-8d28-4684-84d6-ec19d2a31361>
Filogic-GW*CLI> [185515.936263] mt7996e 0000:01:00.0: mt7996_hw_scan: trigger scan on mt76 band 0
[185516.136513] mt7996e 0000:01:00.0: mt7996_hw_scan: trigger scan on mt76 band 1
[185516.336706] mt7996e 0000:01:00.0: mt7996_hw_scan: trigger scan on mt76 band 2
-- Executing [1001@from-internal:1] Dial("PJSIP/1002-00000002", "PJSIP/1001,20") in new stack
-- Called PJSIP/1001
-- PJSIP/1001-00000003 is ringing
-- PJSIP/1001-00000003 answered PJSIP/1002-00000002
-- Channel PJSIP/1001-00000003 joined 'simple_bridge' basic-bridge <c0d89774-dbea-4c65-a1e2-ecbe5d8e567e>
-- Channel PJSIP/1002-00000002 joined 'simple_bridge' basic-bridge <c0d89774-dbea-4c65-a1e2-ecbe5d8e567e>
-- Channel PJSIP/1002-00000002 left 'native_rtp' basic-bridge <c0d89774-dbea-4c65-a1e2-ecbe5d8e567e>
-- Channel PJSIP/1001-00000003 left 'native_rtp' basic-bridge <c0d89774-dbea-4c65-a1e2-ecbe5d8e567e>
== Spawn extension (from-internal, 1001, 1) exited non-zero on 'PJSIP/1002-00000002' |
Registering Asterisk as client with external SIP server and making call using external sip server trunk
1) Register with the external sip server by creating an account in sip.linphone.org and add both username, password in the existing pjsip.conf which are used as authentication credentials.
| Code Block |
|---|
[linphone_freesip_auth]
type=auth
auth_type=userpass
password=password
username=2931 |
2) Make the outbound SIP registration by adding in the pjsip.conf file
| Code Block |
|---|
[linphone_freesip_registration]
type=registration
transport=udp-transport
server_uri=sip:sip.linphone.org
client_uri=sip:2931@sip.linphone.org
outbound_auth=linphone_freesip_auth
retry_interval=60
expiration=3600 |
3) Add the contact information of the remote SIP server for outbound trunk in pjsip.conf file
| Code Block |
|---|
[linphone_freesip_aor]
type=aor
contact=sip:sip.linphone.org:5060
max_contacts=1
qualify_frequency=30 |
4) Define the SIP endpoint for your connection to the Linphone freesip server in pjsip.conf file
| Code Block |
|---|
[linphone_freesip_trunk]
type=endpoint
transport=udp-transport
context=from-linphone
disallow=all
allow=ulaw
allow=alaw
allow=gsm
auth=linphone_freesip_auth
outbound_auth=linphone_freesip_auth
aors=linphone_freesip_aor
direct_media=no
force_rport=yes
rewrite_contact=yes
rtp_symmetric=yes |
5) Do nslookup for the sip.linphone.org from the board and add the IP in the identify section in the pjsip.conf file.
| Code Block |
|---|
root@Filogic-GW:/etc/asterisk# nslookup sip.linphone.org
Server: 192.168.1.1
Address 1: 192.168.1.1 _gateway
Name: sip.linphone.org
Address 1: 5.135.215.43 sip12.linphone.org
Address 2: 2001:41d0:203:7fe2::4
[linphone_identify]
type=identify
endpoint=linphone_freesip_trunk
match=5.135.215.43/32 |
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 |
|---|
[internal-users]
exten => _9X.,1,NoOp
exten => _9X.,n,Dial(PJSIP/${EXTEN:1}@linphone_freesip_trunk)
exten => _9X.,n,Hangup()
include => outbound-linphone
[from-internal]
exten => 1001,1,Dial(PJSIP/1001,20)
exten => 1002,1,Dial(PJSIP/1002,20)
include => outbound-linphone
[outbound-linphone]
exten => _9X.,1,NoOp
same => n,Dial(PJSIP/${EXTEN:1}@linphone_freesip_trunk,60)
same => n,Hangup() |
7) 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' (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). |
9) 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> |
10) 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 |