A small example of Asterisk extension interworking

Install

       Due to environmental limitations, I am currently running in a virtual machine. First, install VMware and install the centOS system. After the preparations are completed, you can install Asterisk. For details, please refer to:
       Note : If you choose ISO installation, you need to press F2 to enter the boots setting when booting up, and choose CD to boot, so that it can be loaded normally.
       After the installation is complete, the following page will appear:

 
       If you are interested, you can perform the Hello World test. For details, please refer to:

configure

  • Modify the configuration file pjsip.conf, remember to back up pjsip.conf before configuration, in the configuration, we add two new extensions 6666 and 8888:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[6666]
type=endpoint
context=LocalSets
disallow=all
allow=ulaw
auth=6666
so=6666

[6666]
type=auth
auth_type=userpass
password=6666
username=6666

[6666]
type=aor
max_contacts=1

[8888]
type=endpoint
context=LocalSets
disallow=all
allow=ulaw
auth=8888
so=8888

[8888]
type=auth
auth_type=userpass
password=8888
username=8888

[8888]
type=aor
max_contacts=1

    Note : You need to reload sip after modification, use sip reload in the asterisk CLI console, or execute asterisk -rx "sip reload" directly.

 

  • Modify the configuration file extensions.conf [remember to back it up before changing], add 3 new dialing policies, dial 10010 and transfer to extension 6666, dial 10086 and transfer to extension 8888, dial 911 to answer automatically, wait for 1s and play the voice hello-world, then hang up:
[LocalSets]

exten => 10010,1,Dial(PJSIP/6666)
exten => 10086,1,Dial(PJSIP/8888)
exten => 911,1,Answer()
      same => Wait(1)
      same => n,Playback(hello-world)
      same => n,Hangup
 

   Note : You need to reload the dial plan after modification. Use dialplan reload in the asterisk CLI console, or execute asterisk -rx "dialplan reload" directly. 

 

test

       The sip extensions I choose are x-lite and linphone. The following is the configuration of the two extensions



 

 

Two extensions are on a call:

 

       

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326080075&siteId=291194637