So this post going to be somewhere long because I provide 3 .conf files code with that.
First go through code then check question, Also I didn’t write anything except just add some details in manager.conf
- PJSIP.conf
; Our primary transport definition for UDP communication behind NAT.
[transport-udp-nat]
type = transport
protocol = udp
bind = 0.0.0.0
; NAT settings
;local_net = 10.0.0.0/8
;external_media_address = 203.0.113.1
;external_signaling_address = 203.0.113.1
;================================ CONFIG FOR SIP ITSP ==
; Registration for Digium Cloud Services Account
[dcs-trunk]
type = registration
outbound_auth = dcs-trunk-auth
server_uri = sip:sip.digiumcloud.net
;client_uri = sip:myaccountID@sip.digiumcloud.net
retry_interval = 60
[dcs-trunk-auth]
type = auth
auth_type = userpass
;username = myaccountID
;password = ASTRONGPASSWORD
; Endpoint for Digium Cloud Services account
[dcs-endpoint]
type=endpoint
context = DCS-Incoming
allow = !all,g722,ulaw
outbound_auth = dcs-auth
aors = dcs-aor
direct_media = no
from_domain = sip.digiumcloud.net
[dcs-auth]
type = auth
auth_type = userpass
;username = myaccountID
;password = ASTRONGPASSWORD
realm = sip.digiumcloud.net
[dcs-aor]
type = aor
contact = sip:sip.digiumcloud.net
[dcs-identify]
type=identify
endpoint = dcs-endpoint
;match = 8.17.32.12
;================================ ENDPOINT TEMPLATES ==
; Our primary endpoint template for internal desk phones.
[endpoint-internal-d70](!)
type = endpoint
context = Long-Distance
allow = !all,g722,ulaw
direct_media = no
trust_id_outbound = yes
device_state_busy_at = 1
dtmf_mode = rfc4733
[auth-userpass](!)
type = auth
auth_type = userpass
[aor-single-reg](!)
type = aor
max_contacts = 1
;================================ ENDPOINT DEFINITIONS ==
; Below are the definitions for all staff devices, listed by department.
;
; Super Awesome Company uses the MAC address of their devices for the auth
; username and the extension number for the name of the endpoint, auth and
; aor objects. If your phones must use the same user ID and auth name then
; you will need to customize the endpoints accordingly.
;================================ MANAGEMENT ==
;Lindsey Freddie
;President for Life
[1107](endpoint-internal-d70)
auth = 1107
aors = 1107
callerid = Lindsey Freddie <1107>
[1107](auth-userpass)
password = 4webrEtHupHewu4
username = 0019159BF771
[1107](aor-single-reg)
mailboxes = 1107@example
;================================
;Temple Morgan
;Life Assistant to the President for Life
[1111](endpoint-internal-d70)
auth = 1111
aors = 1111
callerid = Temple Morgan <1111>
[1111](auth-userpass)
password = be4eberEkUsUMaF
username = 000FD3012445
[1111](aor-single-reg)
mailboxes = 1111@example
;================================
;Terry Jules
;Director of Sales
[1109](endpoint-internal-d70)
auth = 1109
aors = 1109
callerid = Terry Jules <1109>
[1109](auth-userpass)
password = sPeFaChe7ruxarE
username = 00094558B29E
[1109](aor-single-reg)
mailboxes = 1109@example
;================================
;Maria Berny
;Director of Customer Experience
[1101](endpoint-internal-d70)
auth = 1101
aors = 1101
callerid = Maria Berny <1101>
[1101](auth-userpass)
password = SW2fur7facrarac
username = 3605657CFB45
[1101](aor-single-reg)
mailboxes = 1101@example
;================================
;Penelope Bronte
;Director of Engineering
[1103](endpoint-internal-d70)
auth = 1103
aors = 1103
callerid = Penelope Bronte <1103>
[1103](auth-userpass)
password = zutAnacHe8ewuWr
username = D5F646797302
[1103](aor-single-reg)
mailboxes = 103@example
;================================
;Aaron Courtney
;Accounting and Records
[1106](endpoint-internal-d70)
auth = 1106
aors = 1106
callerid = Aaron Courtney <1106>
[1106](auth-userpass)
password = tecrUBUs3u7uTab
username = EAFB2F4319C4
[1106](aor-single-reg)
mailboxes = 1106@example
;================================ SALES STAFF ==
;================================
;Garnet Claude
;Sales Associate
[1105](endpoint-internal-d70)
auth = 1105
aors = 1105
callerid = Garnet Claude <1105>
[1105](auth-userpass)
password = Q7rAphatRusteSW
username = 5187E6D311BE
[1105](aor-single-reg)
mailboxes = 1105@example
;================================
;Franny Ocean
;Sales Associate
[1112](endpoint-internal-d70)
auth = 1112
aors = 1112
callerid = Franny Ocean <1112>
[1112](auth-userpass)
password = nefReSTAq8phaph
username = ACC6BC73A990
[1112](aor-single-reg)
mailboxes = 1112@example
;================================ CUSTOMER SERVICE STAFF =
;================================
;Dusty Williams
;Customer Advocate
[1115](endpoint-internal-d70)
auth = 1115
aors = 1115
callerid = Dusty Williams <1115>
[1115](auth-userpass)
password = cEBraN2trezaqEt
username = 2C61DA1AA74B
[1115](aor-single-reg)
mailboxes = 1115@example
;================================
;Tommie Briar
;Customer Advocate
[1102](endpoint-internal-d70)
auth = 1102
aors = 1102
callerid = Tommie Briar <1102>
[1102](auth-userpass)
password = 6EBu8egespUwuth
username = 558EF2645DC7
[1102](aor-single-reg)
mailboxes = 1102@example
;================================ ENGINEERING STAFF ==
;================================
;Hollis Justy
;Software Engineer
[1110](endpoint-internal-d70)
auth = 1110
aors = 1110
callerid = Hollis Justy <1110>
[1110](auth-userpass)
password = vust6spuFereThA
username = D3D55712AED0
[1110](aor-single-reg)
mailboxes = 1110@example
;================================
;Richard Casey
;Software Engineer
[1104](endpoint-internal-d70)
auth = 1104
aors = 1104
callerid = Richard Casey <1104>
[1104](auth-userpass)
password = fU8puzuzEpRuSTa
username = 13B29A457ED5
[1104](aor-single-reg)
mailboxes = 1104@example
;================================
;Sal Smith
;Software Engineer
[1114](endpoint-internal-d70)
auth = 1114
aors = 1114
callerid = Sal Smith <1114>
[1114](auth-userpass)
password = XapR4munEcadrub
username = C369192006EA
[1114](aor-single-reg)
mailboxes = 1114@example
;================================
;Laverne Roberts
;Software Engineer
[1113](endpoint-internal-d70)
auth = 1113
aors = 1113
callerid = Laverne Roberts <1113>
[1113](auth-userpass)
password = mu8aPr4daJAQaDE
username = B07FF579AAC8
[1113](aor-single-reg)
mailboxes = 1113@example
;================================
;Colby Hildred
;IT Systems
[1108](endpoint-internal-d70)
auth = 1108
aors = 1108
callerid = Colby Hildred <1108>
[1108](auth-userpass)
password = KAthufrudE6uyAs
username = DB589C0875AB
[1108](aor-single-reg)
mailboxes = 1108@example
- Extensions.conf
[globals]
; General internal dialing options used in context Dial-Users.
; Only the timeout is defined here. See the Dial app documentation for
; additional options.
INTERNAL_DIAL_OPT=,30
[Hints]
; Allow dynamic hint creation for every extension.
exten = _11XX,hint,PJSIP/${EXTEN}
[Features]
; Extension to check user voicemail. We don't requre the user to enter
; their pincode.
exten = 8000,1,Verbose(1, "User ${CALLERID(num)} dialed the voicemail feature.")
same = n,VoiceMailMain(${CALLERID(num)}@example,s)
same = n,Hangup()
; Exten to dial the main IVR internally.
exten = 1100,1,Verbose(1, "User ${CALLERID(num)} dialed the IVR.")
same = n,Goto(Main-IVR,2565551100,1)
;Extension to enter a conference intended only for employees
exten = 6000,1,Verbose(1, "User ${CALLERID(num)} dialed the employee conference.")
same = n,Confbridge(employees)
same = n,Hangup()
;Extension to enter a conference intended for employees and customers
exten = 6500,1,Verbose(1, "User ${CALLERID(num)} dialed the employee/customer mixed conference.")
same = n,Confbridge(mixed)
same = n,Hangup()
[External-Features]
; Extension for users to remotely check voicemail. Here we require the caller to
; enter their mailbox and pincode.
exten = 2565551234,1,Verbose(1, "User ${CALLERID(num)} dialed into remote voicemail.")
same = n,VoiceMailMain(example)
same = n,Hangup()
; Extension to queue for sales.
; The queue has a 300 second timeout.
exten = 2565551200,1,Verbose(1, "User ${CALLERID(num)} dialed the sales queue.")
same = n,Answer()
same = n,Queue(sales,,,,300)
same = n,Goto(operator,1)
; Extension to queue for a customer advocate.
; The queue has a 1200 second timeout.
exten = 2565551250,1,Verbose(1, "User ${CALLERID(num)} dialed the customer advocate queue.")
same = n,Answer()
same = n,Queue(customer_advocate,,,,1200)
same = n,Goto(operator,1)
[Dialing-Errors]
; Handle any extensions dialed internally that don't otherwise exist.
; Comment out or remove this extension if you would rather have the calls
; ignored.
exten = _X.,1,Verbose(1, "User ${CALLERID(num)} dialed an invalid number.")
same = n,Playback(pbx-invalid)
same = n,Hangup()
[Internal-Setup]
; Here we capture internal calls to do anything we need to do before sending
; them onto all the possible internal locations. Such as disabling CDR on
; internal to internal calls.
exten = _X.,1,NoOp()
same = n,Set(CDR_PROP(disable)=1)
same = n,Goto(Internal-Main,${EXTEN},1)
; The Internal-Main context provides a way for internal callers to get access to most
; features and functions configured for them. External callers may be sent
; directly to some of the contexts you see included here, so the included
; contexts are not necessarily internal only.
[Internal-Main]
; The order of includes here is important for matching the right extensions.
include = Hints
include = Features
include = Dial-Users
include = Dialing-Errors
; Dial-Users handles calls to internal extensions.
; Calls coming into this context may be *external* or *internal* in origin.
[Dial-Users]
exten = _11XX,1,Verbose(1, "User ${CALLERID(num)} dialed ${EXTEN}.")
same = n,Set(SAC_DIALED_EXTEN=${EXTEN})
same = n,Gotoif($[${DEVICE_STATE(PJSIP/${EXTEN})} = BUSY]?dialed-BUSY,1:)
same = n,Dial(PJSIP/${EXTEN}${INTERNAL_DIAL_OPT})
same = n,Goto(dialed-${DIALSTATUS},1)
exten = dialed-NOANSWER,1,NoOp()
same = n,Voicemail(${SAC_DIALED_EXTEN}@example,u)
same = n,Hangup()
exten = dialed-BUSY,1,NoOp()
same = n,Voicemail(${SAC_DIALED_EXTEN}@example,b)
same = n,Hangup()
exten = dialed-CHANUNAVAIL,1,NoOp()
same = n,Playback(pbx-invalid)
same = n,Hangup()
exten = _dialed-.,1,Goto(dialed-NOANSWER,1)
exten = h,1,Hangup()
; Callers in the directory may dial 0 which will jump to the
; 'o' extension.
exten = o,1,Goto(1111)
; Outbound-Dial
;
; Before we dial, see if the extension matches our restricted number patterns.
; Note that this is a basic set of numbers which could incur a fee if dialed.
; The NANP includes many other numbers that you may want to block. If you feel
; it is necessary to block further number patterns you'll have to add them below
; or you may consider implementing a blacklist via methods beyond the scope of
; this example.
[Outbound-Dial]
exten = _011.,1,Hangup()
exten = _900NXXXXXX,1,Hangup()
exten = _1900NXXXXXX,1,Hangup()
exten = _976XXXX,1,Hangup()
exten = _NXX976XXXX,1,Hangup()
exten = _1NXX976XXXX,1,Hangup()
; Dial outbound through our SIP ITSP.
exten = _X.,1,Verbose(1, "Didn't match any restricted numbers, proceeding with outbound dial.")
same = n,Set(CALLERID(num)=256555${CALLERID(num)})
same = n,Dial(PJSIP/${EXTEN}@dcs-endpoint)
same = n,Hangup()
; Calls from internal endpoints will enter into one of the two following
; contexts based on their dialing privilege.
[Local]
include = Internal-Setup
exten = _NXXXXXX,1,Goto(Outbound-Dial,1256${EXTEN},1)
exten = _256NXXXXXX,1,Goto(Outbound-Dial,1${EXTEN},1)
exten = _1256NXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)
[Long-Distance]
include = Local
exten = _NXXNXXXXXX,1,Goto(Outbound-Dial,1${EXTEN},1)
exten = _1NXXNXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)
; The DID-Extensions context captures inbound calls from our ITSP that have a
; DID number where the last four digits matches an internal extension.
[DID-Extensions]
exten = _25655511XX,1,Verbose(1, "External caller dialed inbound to DID ${EXTEN})")
same = n,Goto(Dial-Users,${EXTEN:6},1)
; Our main IVR program for receiving inbound callers.
; The IVR script reads “Thank you for calling Super Awesome Company, Waldo’s
; premier provider of perfect products. If you know your party’s extension,
; you may dial it at any time. To establish a sales partnership, press one. To
; speak with a customer advocate, press two. For accounting and other
; receivables, press three. For a company directory, press four. For an
; operator, press zero.”
; demo-congrats is currently used as a placeholder.
[Main-IVR]
exten = 2565551100,1,Verbose(1, "New caller, ${CALLERID(num)} dialed into the IVR.")
same = n,Answer()
same = n(start),Background(basic-pbx-ivr-main)
same = n,WaitExten(10)
same = n,Background(basic-pbx-ivr-main)
same = n,Hangup()
exten = 0,1,Verbose(1, "Caller ${CALLERID(num)} dialed the operator.")
same = n,Goto(Dial-Users,1111,1)
exten = 1,1,Verbose(1, "Caller ${CALLERID(num)} dialed the Sales queue.")
same = n,Goto(External-Features,2565551200,1)
exten = 2,1,Verbose(1, "Caller ${CALLERID(num)} dialed the Customer Experience queue.")
same = n,Goto(External-Features,2565551250,1)
exten = 3,1,Verbose(1, "Caller ${CALLERID(num)} dialed Accounting and Receivables.")
same = n,Goto(Dial-Users,1106,1)
exten = 4,1,Verbose(1, "Caller ${CALLERID(num)} dialed the directory.")
same = n,Directory(example,Dial-Users)
exten = i,1,Playback(option-is-invalid)
same = n,Goto(2565551100,start)
exten = t,1,Playback(are-you-still-there)
same = n,Goto(2565551100,start)
; Calls from our ITSP SIP account arrive in DCS-Incoming. We should be careful
; to route calls very explicitly so as to avoid any security issues, such as
; accidentally giving outbound dial access to inbound callers.
;
; Each context includes extension pattern matching to match the inbound DID
; dialed appropriately.
[DCS-Incoming]
include = Main-IVR
include = DID-Extensions
include = External-Features
- manager.conf (in this I just enable=yes and add one user at then end rest of as it is)
;
; AMI - The Asterisk Manager Interface
;
; Third party application call management support and PBX event supervision
;
; Use the "manager show commands" at the CLI to list available manager commands
; and their authorization levels.
;
; "manager show command <command>" will show a help text.
;
; ---------------------------- SECURITY NOTE -------------------------------
; Note that you should not enable the AMI on a public IP address. If needed,
; block this TCP port with iptables (or another FW software) and reach it
; with IPsec, SSH, or SSL vpn tunnel. You can also make the manager
; interface available over http/https if Asterisk's http server is enabled in
; http.conf and if both "enabled" and "webenabled" are set to yes in
; this file. Both default to no. httptimeout provides the maximum
; timeout in seconds before a web based session is discarded. The
; default is 60 seconds.
;
[general]
enabled = yes
;webenabled = yes
port = 5038
bindaddr = 0.0.0.0
; Parameters that control AMI over TLS. ("enabled" must be set too).
; You can open a connection to this socket with e.g.
;
; openssl s_client -connect my_host:5039
;
;tlsenable=no ; set to YES to enable it
;tlsbindaddr=0.0.0.0:5039 ; address and port to bind to, default to bindaddr and port 5039
;tlscertfile=/tmp/asterisk.pem ; path to the certificate.
;tlsprivatekey=/tmp/private.pem ; path to the private key, if no private given,
; if no tlsprivatekey is given, default is to search
; tlscertfile for private key.
;tlscipher=<cipher string> ; string specifying which SSL ciphers to use or not use
;
;allowmultiplelogin = yes ; IF set to no, rejects manager logins that are already in use.
; ; The default is yes.
;
;displayconnects = yes
;
; Add a Unix epoch timestamp to events (not action responses)
;
;timestampevents = yes
;brokeneventsaction = yes ; Restore previous behavior that caused the events
; action to not return a response in certain
; circumstances. Defaults to 'no'.
;
; Display certain channel variables every time a channel-oriented
; event is emitted:
;
;channelvars = var1,var2,var3
; debug = on ; enable some debugging info in AMI messages (default off).
; Also accessible through the "manager debug" CLI command.
; authtimeout specifies the maximum number of seconds a client has to
; authenticate. If the client does not authenticate beofre this timeout
; expires, the client will be disconnected. (default: 30 seconds)
;authtimeout = 30
; authlimit specifies the maximum number of unauthenticated sessions that will
; be allowed to connect at any given time.
;authlimit = 50
;httptimeout = 60
; a) httptimeout sets the Max-Age of the http cookie
; b) httptimeout is the amount of time the webserver waits
; on a action=waitevent request (actually its httptimeout-10)
; c) httptimeout is also the amount of time the webserver keeps
; a http session alive after completing a successful action
;[mark]
;secret = mysecret
;deny=0.0.0.0/0.0.0.0
;permit=209.16.236.73/255.255.255.0
;acl=named_acl_example ; use a named ACL from acl.conf
;
;
;setvar=PBXACCOUNT=edvina
; The setvar option defines channel variables that will be set when this account
; originates a call. You can define multiple setvar= commands for one manager
; user.
;
;eventfilter=Event: Newchannel
;eventfilter=Channel: (PJ)?SIP/(james|jim|john)-
;eventfilter=!Channel: DAHDI/
; The eventfilter option is used to whitelist or blacklist events per user.
; A filter consists of an (unanchored) regular expression that is run on the
; entire event data. If the first character of the filter is an exclamation
; mark (!), the filter is appended to the blacklist instead of the whitelist.
; After first checking the read access below, the regular expression filters
; are processed as follows:
; - If no filters are configured all events are reported as normal.
; - If there are white filters only: implied black all filter processed first,
; then white filters.
; - If there are black filters only: implied white all filter processed first,
; then black filters.
; - If there are both white and black filters: implied black all filter processed
; first, then white filters, and lastly black filters.
;
; If the device connected via this user accepts input slowly,
; the timeout for writes to it can be increased to keep it
; from being disconnected (value is in milliseconds)
;
; writetimeout = 100
;
;displayconnects = yes ; Display on CLI user login/logoff
;
; Authorization for various classes
;
; Read authorization permits you to receive asynchronous events, in general.
; Write authorization permits you to send commands and get back responses. The
; following classes exist:
;
; all - All event classes below (including any we may have missed).
; system - General information about the system and ability to run system
; management commands, such as Shutdown, Restart, and Reload. This
; class also includes dialplan manipulation actions such as
; DialplanExtensionAdd and DialplanExtensionRemove.
; call - Information about channels and ability to set information in a
; running channel.
; log - Logging information. Read-only. (Defined but not yet used.)
; verbose - Verbose information. Read-only. (Defined but not yet used.)
; agent - Information about queues and agents and ability to add queue
; members to a queue.
; user - Permission to send and receive UserEvent.
; config - Ability to read and write configuration files.
; command - Permission to run CLI commands. Write-only.
; dtmf - Receive DTMF events. Read-only.
; reporting - Ability to get information about the system.
; cdr - Output of cdr_manager, if loaded. Read-only.
; dialplan - Receive NewExten and VarSet events. Read-only.
; originate - Permission to originate new calls. Write-only.
; agi - Output AGI commands executed. Input AGI command to execute.
; cc - Call Completion events. Read-only.
; aoc - Permission to send Advice Of Charge messages and receive Advice
; - Of Charge events.
; test - Ability to read TestEvent notifications sent to the Asterisk Test
; Suite. Note that this is only enabled when the TEST_FRAMEWORK
; compiler flag is defined.
; security - Security Events. Read-only.
; message - Permissions to send out of call messages. Write-only
;
;read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
;write = system,call,agent,user,config,command,reporting,originate,message
[1101]
secret=123456
deny=0.0.0.0/0.0.0.0
permit=192.168.1.0/255.255.255.0
read=all
write=all
So as you can see my files contents now my question is:
When I try below code,
root@yash-VirtualBox:/home/yash# telnet 192.168.1.4 5038
Trying 192.168.1.4...
Connected to 192.168.1.4.
Escape character is '^]'.
Asterisk Call Manager/5.0.2
Action:login
Username:1101
Secret:123456
Response: Success
Message: Authentication accepted
Event: FullyBooted
Privilege: system,all
Uptime: 3622
LastReload: 3622
Status: Fully Booted
Event: SuccessfulAuth
Privilege: security,all
EventTV: 2021-01-13T11:34:48.974+0530
Severity: Informational
Service: AMI
EventVersion: 1
AccountID: 1101
SessionID: 0x7f1168000d60
LocalAddress: IPV4/TCP/0.0.0.0/5038
RemoteAddress: IPV4/TCP/192.168.1.4/33650
UsingPassword: 0
SessionTV: 2021-01-13T11:34:48.974+0530
Action:Originate
Channel:SIP/1102
Context:Long-Distance
Exten:1100
Priority:1
Response: Error
Message: Originate failed
I got result failed. Its obivious because I don’t know about dial plan.
As far as I know I make mistake in Action:Originate…
So can you please tell me what should be my exten, context and channel value.
Maybe my Channel value can be Channel:PJSIP/1102.
Because I want call 1102.
But I can’t understand what should my exten and context in this case.
I know its very long post but I have to show everything which I see.
Please let me know if anything wrong in file.
Thank you