how do i add to extensions.conf (at least i think that’s where i need to do work on) a condition that makes me accept all numbers that start i a certain way from another server?
thank you in advance
You won’t receive numbers from a SIP User Agent Server, did you man another PABX, or are you talking about a different protocol?
In terms of the “from another SIP user agent” part, you place the corresponding endpoint in a context that applies your rules for these numbers.
In terms of prefix matching, there are examples in the sample configuration, and there is more detailed documentation at Pattern Matching - Asterisk Documentation
for example
exten => _2XX,1,Answer()
exten => _2XX,2,Dial(SIP/secondserver,60)
this doesn’t work, how would i fix this?
What does “doesn’t work” mean. What actually happens? Did you put it in a context?
Why are you answering the call, rather than letting the called party do so?
i am not sure what you mean as i’ve installed asterisk only today, for every umber i have the functions answer, dial and hangup in extensions.conf
i am using sip and not pjsip because i’ll have to work on a very old server
[internal]
exten => 304,1,Answer()
exten => 304,2,Dial(SIP/304,60)
exten => 210,1,Answer()
exten => 210,2,Dial(SIP/210,60)
exten => 210,5,Hangup()
exten => _4xxx,1,Answer()
exten => _4xxx,2,Dial(SIP/Secondserver/$(exten:1),60)
exten => _4xxx,3,Hangup()
When you call Answer, it makes the caller think that the callee has picked up the phone, and, more importantly, if the caller is being charged for the call, it means that they get billed for the call, even if no-one really answers the call, so, unless there are specific reasons (e.g. the callee may take longer to answer than the network allows, or because it is the only way to get early media through), you should not call Answer. When Dial receives an answer indication, from the callee, they will forward it to the caller.
If Secondserver is Asterisk and includes Answer at the head of its dialplan, the 60 second timeout, on the DIal to it, will never trigger, because that is a timeout on the answer, not on the whole call.
Also Asterisk variable names are case sensitive, and are delimited by curly brackets, not round ones.
Also, Asterisk will terminate processing the call when it reaches a missing priority number, so priority 5 of extension 210 will never be reached. When it terminates the call, it does the equivalent of Hangup, so that priority is redundant. It generally best to use n, for all priorities except the first, so that Asterisk automatically allocates sequential ones.
I would be reasonably surprised if there were anything in chan_pjsip that prevented it from working on older hardware.
() Parentheses
{} Braces
[] Brackets
the brackets were a typo but it stil doesn’t work
Whenever you say “it doesn’t work” you need to show what actually happens, or say what happens.
the error i get is that the line is congested whenever i call numbers outside my server
extensions.conf
[internal]
exten => 304,1,Dial(SIP/304,60)
exten => 304,2,Hangup()
exten => 210,1,Dial(SIP/210,60)
exten => 210,2,Hangup()
exten => 209,1,Dial(SIP/Second/209,60)
exten => 209,2,Hangup()
exten => _4xxx,1,Dial(SIP/Second/${EXTEN:1},60)
exten => _4xxx,2,Hangup()
sip.conf
[general]
context=internal
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
disallow=all
allow=ulaw
alwaysauthreject=yes
canreinvite=no
nat=yes
session-timers=refuse
localnet=192.168.4.0/255.255.255.0
externip=18.188.213.213
[Second]
type=peer
host=192.168.69.69
context= incoming
disallow = all
allow=ulaw
[304]
type=friend
host=dynamic
context=internal
[210]
type=friend
host=dynamic
context=internal
in debug i see SIP/2.0 489 Bad Event, gopefully that can help too
I think one can safely say that is not relevant to the problem.
You are providing far too little information for it to worth people thinking about your problem.
the problem is solved, the issue was on the side of the second server. the other person didn’t have the number i was calling in the default context
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.