Discussion:
[asterisk-dev] PJSIP Dialog-Info+XML enhancement
Hans-Peter Jansen
2018-10-29 16:47:28 UTC
Permalink
Dear Asterisk developers,

in an attempt to add the missing pieces in
res/res_pjsip_dialog_info_body_generator.c to provide a similar
Dialog-Info+XML implementation, as what chan_sip.so provides already,
I invested the better part of today, but things seem to be much more
complicated in PJSIP land (at least for somebody, who started to look
at this code today).

This is the only missing functionality, that keeps me from transitioning
to PJSIP, and, if I read the various related complains correctly, a lot of
other Asterisk users as well.

What I found out so far:

PJSIP version:

<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="3" state="full" entity="sip:***@192.168.23.2:15060">
<dialog id="62" direction="recipient">
<state>early</state>
</dialog>
</dialog-info>

SIP version:
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="4" state="full" entity="sip:***@192.168.23.2">
<dialog id="62" call-id="pickup-3c4cdcc600b4-7xehh8ed2efm" local-tag="0s4d32nrka" remote-tag="as739d9813" direction="recipient">
<remote>
<identity display="">sip:***@192.168.23.2</identity>
<target uri="sip:***@192.168.23.2"/>
</remote>
<local>
<identity display="hp Office 2">sip:***@192.168.23.2</identity>
<target uri="sip:***@192.168.23.2"/>
</local>
<state>early</state>
</dialog>
</dialog-info>

Obviously, PJSIP is missing the call information (call-id, local-tag,
remote-tag attributes), and the <remote> and <local> items.

Could some kind soul hint me, where this state data could be fetched
from within PJSIP?

Is PJSIP really up to the task, or are there any other missing pieces
internally, that blocks this enhancement from being realized?

Thanks in advance,
Pete
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/
Joshua C. Colp
2018-10-29 16:56:17 UTC
Permalink
Post by Hans-Peter Jansen
Dear Asterisk developers,
in an attempt to add the missing pieces in
res/res_pjsip_dialog_info_body_generator.c to provide a similar
Dialog-Info+XML implementation, as what chan_sip.so provides already,
I invested the better part of today, but things seem to be much more
complicated in PJSIP land (at least for somebody, who started to look
at this code today).
This is the only missing functionality, that keeps me from transitioning
to PJSIP, and, if I read the various related complains correctly, a lot of
other Asterisk users as well.
<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="3"
<dialog id="62" direction="recipient">
<state>early</state>
</dialog>
</dialog-info>
The information does not currently exist in PJSIP, 'nor does it get passed in. The chan_sip module has special logic (find_ringing_channel) local to it to gather the information it thinks is correct which is then placed into the message. The same kind of thing would need to be done in PJSIP.
--
Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://list
Hans-Peter Jansen
2018-10-29 23:44:03 UTC
Permalink
Post by Joshua C. Colp
Post by Hans-Peter Jansen
Dear Asterisk developers,
in an attempt to add the missing pieces in
res/res_pjsip_dialog_info_body_generator.c to provide a similar
Dialog-Info+XML implementation, as what chan_sip.so provides already,
I invested the better part of today, but things seem to be much more
complicated in PJSIP land (at least for somebody, who started to look
at this code today).
This is the only missing functionality, that keeps me from transitioning
to PJSIP, and, if I read the various related complains correctly, a lot of
other Asterisk users as well.
<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="3"
<dialog id="62" direction="recipient">
<state>early</state>
</dialog>
</dialog-info>
The information does not currently exist in PJSIP, 'nor does it get passed
in. The chan_sip module has special logic (find_ringing_channel) local to
it to gather the information it thinks is correct which is then placed into
the message. The same kind of thing would need to be done in PJSIP.
First of all, thanks for your instant response, Joshua.

Here's, where I got with some hackery today (attached):

<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="1" state="full" entity="sip:***@192.168.23.2:15060">
<dialog id="62" direction="recipient">
<remote>
<identity display>sip:***@192.168.23.2</identity>
<target uri="sip:***@192.168.23.2" />
</remote>
<local>
<identity display="hp Office 2">sip:***@192.168.23.2:15060</identity>
<target uri="sip:***@192.168.23.2:15060" />
</local>
<state>early</state>
</dialog>
</dialog-info>

Remote is still wrong, it's a local extension, and I also have no idea ATM,
where to fetch call-id, local-tag and remote-tag attributes. It also makes
asterisk not to exit gracefully anymore after hitting ^C.

May I kindly ask you to take a look at it?

The phones start to display the calls (wrong) info (horray), but the phone's
state persist after call termination, and even after asterisks exit...

Thanks in advance,
Pete
Joshua C. Colp
2018-10-30 00:14:32 UTC
Permalink
Post by Hans-Peter Jansen
Post by Joshua C. Colp
Post by Hans-Peter Jansen
Dear Asterisk developers,
in an attempt to add the missing pieces in
res/res_pjsip_dialog_info_body_generator.c to provide a similar
Dialog-Info+XML implementation, as what chan_sip.so provides already,
I invested the better part of today, but things seem to be much more
complicated in PJSIP land (at least for somebody, who started to look
at this code today).
This is the only missing functionality, that keeps me from transitioning
to PJSIP, and, if I read the various related complains correctly, a lot of
other Asterisk users as well.
<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="3"
<dialog id="62" direction="recipient">
<state>early</state>
</dialog>
</dialog-info>
The information does not currently exist in PJSIP, 'nor does it get passed
in. The chan_sip module has special logic (find_ringing_channel) local to
it to gather the information it thinks is correct which is then placed into
the message. The same kind of thing would need to be done in PJSIP.
First of all, thanks for your instant response, Joshua.
<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="1"
<dialog id="62" direction="recipient">
<remote>
</remote>
<local>
</local>
<state>early</state>
</dialog>
</dialog-info>
Remote is still wrong, it's a local extension, and I also have no idea ATM,
where to fetch call-id, local-tag and remote-tag attributes. It also makes
asterisk not to exit gracefully anymore after hitting ^C.
Channels don't have a call-id, local-tag, or remote-tag. Those are SIP constructs and an Asterisk channel may or may not be a SIP channel. I believe chan_sip synthesized/created ones.
Post by Hans-Peter Jansen
May I kindly ask you to take a look at it?
Due to the contributions and work I do with Asterisk I personally avoid looking at unlicensed code in our industry to ensure that code within Asterisk itself remains as license pure as possible I'm afraid. If you have specific questions I can answer.
--
Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium
Hans-Peter Jansen
2018-10-30 12:20:50 UTC
Permalink
Post by Joshua C. Colp
Post by Hans-Peter Jansen
Remote is still wrong, it's a local extension, and I also have no idea ATM,
where to fetch call-id, local-tag and remote-tag attributes. It also makes
asterisk not to exit gracefully anymore after hitting ^C.
Channels don't have a call-id, local-tag, or remote-tag. Those are SIP
constructs and an Asterisk channel may or may not be a SIP channel. I
believe chan_sip synthesized/created ones.
Getting something along those lines to work with PJSIP at least would be a big
step forward. We're in a quagmire with current Asterisk: chan_sip is declining
perceptible [1]. The (well, relatively) new and shiny PJSIP is the way to go,
but nobody want to give up essential features, they're used to and rely on
since more than a decade.
Post by Joshua C. Colp
Post by Hans-Peter Jansen
May I kindly ask you to take a look at it?
Due to the contributions and work I do with Asterisk I personally avoid
looking at unlicensed code in our industry to ensure that code within
Asterisk itself remains as license pure as possible I'm afraid. If you have
specific questions I can answer.
Understood.

I have signed the Contributor License Agreement and will resubmit my patch
after the CLA is confirmed.

Thank you for your support.

Kind regards,
Pete

[1]https://community.asterisk.org/t/avoid-pj-ice-rx-error-when-using-sip-only/76838
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinf
Hans-Peter Jansen
2018-11-14 16:01:20 UTC
Permalink
[Sorry for resending, but I have to in order to conform to the CLA]

@Joshua: now that I signed the CLA, may I kindly ask you to look at the code
now? Ideas, where/how to get/synthesize call-id, local-tag and remote-tag
attributes and the caller info in PJSIP land are appreciated.

@everyone: this is an attempt to implement Dialog-Info+XML for PJSIP to get on
par with chan_sip. It will allow subscribed SNOM phones to display the caller
to some monitored extensions and to pick that call up by pressing the
corresponding function key without distributing the call in call groups. In
Asterisk 1.2 times, this was implemented by the bristuff patches. chan_sip of
current Asterisk versions support this feature out of the box.
Post by Joshua C. Colp
Post by Hans-Peter Jansen
Dear Asterisk developers,
in an attempt to add the missing pieces in
res/res_pjsip_dialog_info_body_generator.c to provide a similar
Dialog-Info+XML implementation, as what chan_sip.so provides already,
I invested the better part of today, but things seem to be much more
complicated in PJSIP land (at least for somebody, who started to look
at this code today).
This is the only missing functionality, that keeps me from transitioning
to PJSIP, and, if I read the various related complains correctly, a lot of
other Asterisk users as well.
<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="3"
<dialog id="62" direction="recipient">
<state>early</state>
</dialog>
</dialog-info>
The information does not currently exist in PJSIP, 'nor does it get passed
in. The chan_sip module has special logic (find_ringing_channel) local to
it to gather the information it thinks is correct which is then placed into
the message. The same kind of thing would need to be done in PJSIP.
First of all, thanks for your instant response, Joshua.

Here's, where I got with some hackery today (attached):

<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="1"
state="full" entity="sip:***@192.168.23.2:15060">
<dialog id="62" direction="recipient">
<remote>
<identity display>sip:***@192.168.23.2</identity>
<target uri="sip:***@192.168.23.2" />
</remote>
<local>
<identity display="hp Office 2">sip:***@192.168.23.2:15060</identity>
<target uri="sip:***@192.168.23.2:15060" />
</local>
<state>early</state>
</dialog>
</dialog-info>

Remote is still wrong, it's a local extension, and I also have no idea ATM,
where to fetch call-id, local-tag and remote-tag attributes. It also makes
asterisk not to exit gracefully anymore after hitting ^C.

May I kindly ask you to take a look at it?

The phones start to display the calls (wrong) info (hooray), but the phone's
state (blinking light) persist after call termination, and even after asterisk
exit...

Thanks in advance,
Pete
Joshua C. Colp
2018-11-14 16:26:06 UTC
Permalink
Post by Hans-Peter Jansen
[Sorry for resending, but I have to in order to conform to the CLA]
@Joshua: now that I signed the CLA, may I kindly ask you to look at the code
now? Ideas, where/how to get/synthesize call-id, local-tag and remote-tag
attributes and the caller info in PJSIP land are appreciated.
@everyone: this is an attempt to implement Dialog-Info+XML for PJSIP to get on
par with chan_sip. It will allow subscribed SNOM phones to display the caller
to some monitored extensions and to pick that call up by pressing the
corresponding function key without distributing the call in call groups. In
Asterisk 1.2 times, this was implemented by the bristuff patches. chan_sip of
current Asterisk versions support this feature out of the box.
Post by Joshua C. Colp
Post by Hans-Peter Jansen
Dear Asterisk developers,
in an attempt to add the missing pieces in
res/res_pjsip_dialog_info_body_generator.c to provide a similar
Dialog-Info+XML implementation, as what chan_sip.so provides already,
I invested the better part of today, but things seem to be much more
complicated in PJSIP land (at least for somebody, who started to look
at this code today).
This is the only missing functionality, that keeps me from transitioning
to PJSIP, and, if I read the various related complains correctly, a lot of
other Asterisk users as well.
<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="3"
<dialog id="62" direction="recipient">
<state>early</state>
</dialog>
</dialog-info>
The information does not currently exist in PJSIP, 'nor does it get passed
in. The chan_sip module has special logic (find_ringing_channel) local to
it to gather the information it thinks is correct which is then placed into
the message. The same kind of thing would need to be done in PJSIP.
First of all, thanks for your instant response, Joshua.
<?xml version="1.0" encoding="UTF-8"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="1"
<dialog id="62" direction="recipient">
<remote>
</remote>
<local>
</local>
<state>early</state>
</dialog>
</dialog-info>
Remote is still wrong, it's a local extension, and I also have no idea ATM,
where to fetch call-id, local-tag and remote-tag attributes. It also makes
asterisk not to exit gracefully anymore after hitting ^C.
May I kindly ask you to take a look at it?
The chan_sip module appears to use the information of the underlying subscription for the call-id and tags. This can be retrieved using the ast_sip_subscription_get_dialog function to get the dialog, and then accessed on it[1]. Specifically call_id, local, and remote. Can you clarify what you mean by "Remote is still wrong". As well on a cursory glance I don't see anything that would explain the ^C problem, but it's possible there is a memory issue within it that I don't see immediately.

[1] https://www.pjsip.org/pjsip/docs/html/structpjsip__dialog.htm
--
Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/as
Hans-Peter Jansen
2018-11-14 21:43:06 UTC
Permalink
Post by Joshua C. Colp
Post by Hans-Peter Jansen
Remote is still wrong, it's a local extension, and I also have no idea ATM,
where to fetch call-id, local-tag and remote-tag attributes. It also makes
asterisk not to exit gracefully anymore after hitting ^C.
May I kindly ask you to take a look at it?
The chan_sip module appears to use the information of the underlying
subscription for the call-id and tags. This can be retrieved using the
ast_sip_subscription_get_dialog function to get the dialog, and then
accessed on it[1]. Specifically call_id, local, and remote.
Great, thanks, will look into this in the next few days...
Post by Joshua C. Colp
Can you clarify
what you mean by "Remote is still wrong".
The remote entry:
<remote>
<identity display>sip:***@192.168.23.2</identity>
<target uri="sip:***@192.168.23.2" />
</remote>
should look like:
<remote>
<identity display="">sip:***@192.168.23.2</identity>
<target uri="sip:***@192.168.23.2"/>
</remote>

IOW, it should display the caller, not the sip address of the callee (which
isn't immediately obvious indeed, sorry for being too sparse here..). 000413
is the Snom manufacturer ethercode...

What the code needs is fetching the caller from the callee. The sip code does
something similar to what I'm doing here:

char *remote = ast_strdupa(state_data->remote);

but this seems to point to the callee (ringing device) for some reason.
Post by Joshua C. Colp
As well on a cursory glance I
don't see anything that would explain the ^C problem, but it's possible
there is a memory issue within it that I don't see immediately.
Let's get the dialog working, this can come thereafter.

Thanks, Joshua, for your continuous support. Much appreciated.

Cheers,
Pete
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium
Joshua C. Colp
2018-11-15 10:31:41 UTC
Permalink
On Wed, Nov 14, 2018, at 5:43 PM, Hans-Peter Jansen wrote:

<snip>
Post by Hans-Peter Jansen
Great, thanks, will look into this in the next few days...
Post by Joshua C. Colp
Can you clarify
what you mean by "Remote is still wrong".
<remote>
</remote>
<remote>
</remote>
IOW, it should display the caller, not the sip address of the callee (which
isn't immediately obvious indeed, sorry for being too sparse here..). 000413
is the Snom manufacturer ethercode...
What the code needs is fetching the caller from the callee. The sip code does
char *remote = ast_strdupa(state_data->remote);
but this seems to point to the callee (ringing device) for some reason.
Does find_ringing_channel not find the channel or something? Is that information incorrect on the channel? Is it getting overwritten by the existing code?
--
Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/aste
Loading...