Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improvement]: Document EXTEN can include options/parameters for PJSIP #646

Open
1 task done
jay293874 opened this issue Mar 11, 2024 · 11 comments
Open
1 task done

Comments

@jay293874
Copy link

Severity

Minor

Versions

20.*

Components/Modules

chan_pjsip

Operating Environment

Linux x64

Frequency of Occurrence

Constant

Issue Description

Incoming calls having userinfo parameters in the To-header are not parsed by Asterisk.
This causes Asterisk to set the read-only channel variable EXTEN to wrong value
Example:

To: sip:+1234;bla=ble;more@example.com;transport=tcp

Relevant log output

CHANNEL(EXTEN) gets set to 

+1234;bla=ble;more

instead of

+1234

Asterisk Issue Guidelines

  • Yes, I have read the Asterisk Issue Guidelines
@jcolp
Copy link
Member

jcolp commented Mar 11, 2024

Asterisk doesn't use the To header for the value of EXTEN. It uses the user portion of the request URI. Is there custom dialplan logic involved that accesses the To header to get such a value?

@jay293874
Copy link
Author

jay293874 commented Mar 11, 2024

Sorry, forgot to mention the request URI also contain the same value

Yes we have a custom dialplan in our config pointed from the context config parameter.
Outputting the value of EXTEN in this dialplan gives this wrong value.
If the dialed extension is not supposed to be taken from EXTEN, then what is ?

@jcolp jcolp changed the title [bug]: Support for user parameters [bug]: Parameters in user portion of request URI not parsed out Mar 11, 2024
@jcolp
Copy link
Member

jcolp commented Mar 11, 2024

I didn't say EXTEN is not supposed to be used for such a thing, I was asking for clarification as your original report did not match how Asterisk actually worked.

PJSIP itself is what handles all the parsing at a lower level than us, according to the specifications. Looking at the specifications don't show parameters in the user portion, instead it's just a username, which would explain why they are not parsed out. Looking at some mailing list posts confirm this line of thinking too.

I don't think this is a bug but could be an improvement, however changing such behaviour in releases by default could be problematic as individuals may have written custom logic in the dialplan to strip out values from it before extracting just the extension portion and sending the call on its way.

@jay293874
Copy link
Author

If the parameters are used for something instead of just stripped out, then yes it could break stuff.
I believe the Asterisk documentation is somewhat clear on that EXTEN is supposed to be the value of the extension only. So not the same as the "user part". I am guessing this can break some of the other Asterisk functions taking extension as parameter if exten is not the extension only.
The user parameters are nevertheless available from PJSIP_PARSE_URI.

Correcting this in the next major version might be an ok solution?

@jay293874
Copy link
Author

Actually there is already an pjsip.conf option for this: ignore_uri_user_options
Perhaps add a comment to exten in the documentation only then.

@jcolp
Copy link
Member

jcolp commented Mar 11, 2024

You'll need to be specific about what documentation you are referring to.

@jcolp
Copy link
Member

jcolp commented Mar 11, 2024

So you are saying the documentation about that option should be extended to also mention that it covers EXTEN?

@jcolp jcolp changed the title [bug]: Parameters in user portion of request URI not parsed out [improvement]: Document PJSIP ignore_uri_user_options option covers EXTEN as well Mar 11, 2024
@jcolp jcolp added improvement and removed bug labels Mar 11, 2024
@jay293874
Copy link
Author

When I read the channel documentation it gives the impression that EXTEN contains the extension only.
Since it does not, I would adjust the wording to mention that it contains the entire user part by default.

@jcolp
Copy link
Member

jcolp commented Mar 11, 2024

What documentation and wording regarding EXTEN?

@jcolp jcolp removed the triage label Mar 11, 2024
@jay293874
Copy link
Author

@jcolp jcolp changed the title [improvement]: Document PJSIP ignore_uri_user_options option covers EXTEN as well [improvement]: Document EXTEN can include options/parameters for PJSIP Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants