exten => _XXXXXXX,1,Set(CALLERID(all)=“MT” <7182123456>)
same => n,Dial(SIP/1718${EXTEN}@flowroute,30,r)
same => n,Hangup
exten => _XXXXXXXXXX,1,Set(CALLERID(all)=“MT” <7182123456>)
same => n,Dial(SIP/1${EXTEN}@flowroute,30,r)
same => n,Hangup
Considering example above, depending on what was matched the second line changes. Is there a way to make single rule set, 3 lines instead of 6, that would work for both possibilities?
Also, can this portion “MT” <7182123456> be stored in a variable and reused with variable? Where and how can I do that?
Depending on the answer, it may be easy to do it in four lines, or three if you realise that your third and sixth lines serve no useful purpose. Making it less than that is likely to result in much more complex code.
You can use variables, but you could have checked that for yourself.
[quote=“johnkiniston”]
exten => _NXXNXXXXXX,1,NoOP()
same => n,Set(CALLERID(all)="MT" <7182123456>)
same => n,Dial(SIP/1${EXTEN}@flowroute,30,r)
same => n,Hangup()
exten => _NXXXXXX,1,Goto(${CONTEXT},718${EXTEN},1)
It isn’t quite as short as you want but you get the idea.[/quote]
Thanks a lot. This is excellent. In fact, as I used your example, I realized an answer to my original question, also.
If I match on regex target phone number, I could cancatenate substrings of “1718” and exten based on length.