I have a strange issue. 99.9% of all incoming calls work just fine, but if I receive calls from Versatel, I get some junk in the dialed number (the number that is to be called).
– Executing [4971414574030" <sip:@from-trunk:1] Set("SIP/Toplink-00000641", "__FROM_DID=4971414574030" <sip:") in new stack
– Executing [4971414574030" <sip:@from-trunk:2] NoOp("SIP/Toplink-00000641", "Received an unknown call with DID set to 4971414574030" <sip:") in new stack
– Executing [4971414574030" <sip:@from-trunk:3] Goto("SIP/Toplink-00000641", "s,a2") in new stack
As @BlazeStudios says. But also, what is the context for the Toplink trunk? That may be trying to reformat the called number and/or fish it out of the To header. Possibly, because of a direct interconnection between the providers, the format may be valid but different from normally occurs and what the special context expects. If this context is custom written, please post the added code.
At the Asterisk console, issue sip set debug on
and have a Versatel user call in. Take a look at the incoming INVITE, especially the To header. Possibly, it’s already malformed and you’ll need to get Toplink to fix it. Or, it may be formatted differently from ‘normal’ calls but something that you can deal with, by modifying the code for [from-sip-toplink].
seems like I get it malformed with a second trailing <sip:+Number>. Because I defined + as a delimiter, this results in the nasty string. I could reduce the whole processing to:
That’s not what your first post implies. I am guessing that in the working case you are seeing something like: To: "4971414574030" <sip:[email protected]>
but the failing case has To: "+4971414574030" <sip:[email protected]>
so the + in the name field is confusing the CUT functions.
If that’s the case, try just replacing the Goto(from-trunk,${CUT(CUT(SIP_HEADER(To),@,1),+,2)},1)
with Goto(from-trunk,${CUT(CUT(CUT(SIP_HEADER(To),<,2),@,1),+,2)},1)
If my assumptions were wrong, please post the To header (as received) for both working and failing cases.
If the first two lines of the context (replacing + with 00 in the caller ID) are working properly, you should leave them alone. They have nothing to do with the called number.
I’m pretty sure that’s not what the OP wants. He is rewriting the caller ID to show for example:
030 2345 6789 (Berlin)
00 33 1 2345 6789 (Paris)
The context from-pstn-toheader does not modify the caller ID at all.
Also, he wants to remove the + from the beginning of the called number (but leave the country code intact). I don’t know whether he has any DIDs outside of Germany.
I know it doesn’t, I was asking if it dealt with routing the DIDs based on the To Header since that is the actual issue at hand. Modifying the CallerID is secondary as if the from-pstn-toheader tests properly you can just end up with: