We have a SIP trunk to Telco (NTT Japan) and when testing inbound calls we had this INVITE message:
INVITE sip:firstname.lastname@example.org:5060 SIP/2.0
CSeq: 1 INVITE
v: SIP/2.0/UDP 220.127.116.11:5060;branch=z9hG4bK16dda06f83580a716b3eb6487cd8d34c83f0de986282426f85c178a741a47d90
o=- 3672467593 0 IN IP4 18.104.22.168
c=IN IP4 22.214.171.124
m=audio 37310 RTP/AVP 0
As you can see the Request URI doesnot contain Called number (or it is translated to some other values), the Called number is in "To" and calling number is in "From". But the voice gateway tried to route the call based on the "called number" extracted from Request URI, which is email@example.com:5060 and this is not routable.
*May 17 09:53:38.672: //-1/10527976AD4D/CCAPI/cc_api_display_ie_subfields:
----- ccCallInfo IE subfields -----
cisco-redirectreason=-1 fwd_final_type =0
Can someone teach me how to route calls based on the field "To" or "P-Called-Party-ID" but not the called number extracted from URI?
You need to contact the provider to find out why they are saying "garbage" in the invite instead of called digits which is what they need to send per SIP RFCs.
There were couple of discussions in the past with same question but none of them got answered whether CUBE has respective capability or not.
I have observed with many SIP trunk provider and seen different implementation. Most of the providers send called party number in Request-URI which works good with Cisco environment but there are others send called party number in To field and in that case, Request-URI may contain random characters (specific to internal SIP stack) or main pilot number. Some service providers have capability to entertain the request and change the implementation to send called party number in Request-URI but not with all.
Many other third party IP PBX manufactures (Matrix, Grandstream etc) already have been implemented with to fetch the called party number either from Request-URI or To field.
Cisco has command "call-route p-called-party-id" under voice service voip - sip configuration. I tried this but it did not help.