Contact_user parameter in pjsipsi

Hi,
I have a problem setting the contact_user parameter in pjsip. I have a trunk “voiptrunk” registered to my provider, with 100 numbers (ranging from 11223300 to 11223399).
Calling one of these (i.e. 11223310), the provider sends me 11223310 in the To header, which is correct, but for asterisk the ${EXTEN} is what is statically set in contact_user parameter. Removing the contact_user parameter the ${EXTEN} defaults to “s”, which is not what I want. Is there a way to dynamically set the contact_user? If I call the 11223310 I just want the ${EXTEN} to be set on that value, in order to be able to perform direct inward dialing on extension 10, and so on.

Thanks

Don’t register. Use IP based identification. This requires the provider support it and do so in a helpful way.

Alternatively parse out the To header and GoTo its user part.

Unfortunately the provider does not use IP based authentication and requires registration. Is there a way to avoid parsing the To header in dialplan?

Ask for a separate address of record for each directory number. This might involve having a separate account for each one. Providers that naturally work that way aren’t really interested in customers with PABXes, as they expect the registrations to come direct from phones.

Parsing out the To header user field isn’t difficult. Although I can’t point to a specific example I’m sure I’ve seen examples on the forums.

Asterisk sets the initial extension from the request URI user part, and SIP requires the URI to be the value of the Contact header in the REGISTER. Even if it turns that that is a SHOULD, any exception is purely controlled by the other end.

Creating a separate AOR for each number is not an option, because it requires a lot of unnecessary job even with 100 numbers, let alone with 1000.
I solved it by parsing the to header.

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.