Can someone help me with PJSIP dialplan for outbound and inbound?
I was trying for last few weeks but nothing working.
I am getting these errors. Please someone help me.
Inbound
res_pjsip_session.c:4044new_invite: connect: Call (UDP:xx.xxx.xx,xx:5060) to extension ‘+9716xxxx700’ rejected because extension not found in context ‘trunkinbound’.
Outbound
[Apr 5 06:29:25] WARNING[16936][C-00000003]: res_monitor.c:596__ast_monitor_change_fname: Cannot change monitor filename of channel PJSIP/700-00000003 to null
[Apr 5 06:29:25] WARNING[16936][C-00000003]: func_hangupcause.c:138hangupcause_read: Unable to find information for channel
Thanks David for your response.
This is dialplan for outbound call. X.
like we can dial number directly (without + sign or country code) like 0501230579
(+971501230579)
An example of a pattern that matches numbers beginning with + would be:
_+.
Context names in the dialplan are placed in square brackets, before the corresponding extensions.
The required context name for the call shown as failing because of the extension not found message is “trunkinbound”, However that does not appear in your psip.conf,so assume that you haven’t actual provided a configuration that matches the error messages. The required context name for your pjsip.conf is “aashir”.
This is the context for incoming i added in extensions.conf in “/etc/asterisk/extensions.conf”
[aashir]
exten => _+.,1,NoOp(Incoming call to public number ${EXTEN})
exten => _+.,n,GoTo(aashir,777,1)
exten => _+.,n,Hangup()
exten => _777,n,NoOp(Transfered from public context to local extension 777)
exten => _777,n,Dial(PJSIP/${EXTEN},180)
exten => _777,n,Hangup()
And With This I am getting This Error.
NOTICE[2189]: res_pjsip_session.c:4044new_invite: connect: Call (UDP:10.238.69.33:5060) to extension ‘+971xxxx2700’ rejected because extension not found in context ‘aashir’.
On Sunday 07 April 2024 at 18:19:03, asterisknooob via Asterisk Community
wrote:
This is the context for incoming i added in extensions.conf in
“/etc/asterisk/extensions.conf”
[aashir]
exten => _+.,1,NoOp(Incoming call to public number ${EXTEN})
exten => _+.,n,GoTo(aashir,777,1)
So, you want to send call flow to context “aashir” extension 771 priority 1…
exten => _+.,n,Hangup()
exten => _777,n,NoOp(Transfered from public context to local extension
777)
…but you haven’t defined a priority 1
You start with priority n, which if I understand Asterisk’s habits correctly
means that it will start with priority 4 (since there were 3 preceding
priorities, even if not in this extension).
Also, are those “**” something you’ve added to this posting for emphasis (bad
idea in this sort of situation) or do they literally exist in your dialplan?
If so, remove them.
exten => _777,n,Dial(PJSIP/${EXTEN},180)
exten => _777,n,Hangup()
And With This I am getting This Error.
NOTICE[2189]: res_pjsip_session.c:4044new_invite: connect:
Call (UDP:10.238.69.33:5060) to extension ‘+971xxxx2700’ rejected because
extension not found in context ‘aashir’.
Try using “_+X.” as your pattern to match a number preceded by a plus sign.
A few ‘drive by’ suggestions to improve your dialplan in no particular order:
Whitespace is your friend.
So are comments.
Use the verbose() application. It’s there for a reason.
Use ‘same.’ It is worth it’s weight in gold for so many reasons.
When you post snippets, wrap them in ‘preformatted text tags.’ If you’re a clickey kind of guy, it’s the ‘less than+slash+greater than’ icon. If you’re a cli-weenie, 3 backticks on a line before and after should do the trick.
When things stop making sense, try ‘dialplan show aashir’ or ‘dialplan show 777@aashir.’ What you think your dialplan looks like doesn’t matter. What Asterisk think does.
For example:
(The line above is ```)
; define extensions for the front office
[aashir]
; catch all
exten = _+.,1, verbose(1,[${EXTEN}@${CONTEXT}] - Incoming call to public number ${EXTEN})
same = n, goto(aashir,777,1)
same = n, hangup()
; front lobby phone
exten 777,1 verbose(1,[${EXTEN}@${CONTEXT}] - Transfered from public context to local extension 777)
same = n, dial(PJSIP/${EXTEN},180)
same = n hangup()
(The line below is ```)
Note that the above is untested, may contain errors, and reflects my personal ‘coding style.’
WARNING[48693][C-00000003]: pbx.c:4507__ast_pbx_run: Channel ‘PJSIP/connect-00000002’ sent to invalid extension but no invalid handler: context,exten,priority=aashir,700,1
Thank you so much david it’s working i just just priority 1 to 1st line and then in 3rd line like this.
[aashir]
exten => _+.,1,NoOp(Incoming call to public number ${EXTEN})
exten => _+.,n,GoTo(aashir,700,1)
exten => _+.,n,Hangup()
exten => _700,1,NoOp(Transfered from public context to local extension 3333)
exten => _700,n,Dial(PJSIP/${EXTEN},180)
exten => _700,n,Hangup()
Thank you so much all of you. Now that is for one static extension. What if i want dynamically like DID no +97123456700 to exten 700 and +97123456701 to exten 701 and so on. Do I need to change something in dialplan?
I am sorry I am not getting by this.
Can you please show me some template how can I do this?
For example i have DID range 200 and a pilot number.
I want to configure incoming from
+971xxxx2600 to +971xxxx2799
To extension 600 to 799.