<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/5769">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: New endpoint option "notify_early_inuse_ringing"<br><br>This option was added to control whether to notify dialog-info state<br>'early' or 'confirmed' on Ringing when already INUSE.<br>The value "yes" is useful for some SIP phones (Cisco SPA)<br>to be able to indicate and pick up ringing devices.<br><br>ASTERISK-26919 #close<br><br>Change-Id: Ie050bc30023543c7dfb4365c5be3ce58c738c711<br>---<br>M CHANGES<br>M configs/samples/pjsip.conf.sample<br>A contrib/ast-db-manage/config/versions/d7983954dd96_add_ps_endpoints_notify_early_inuse_.py<br>M include/asterisk/res_pjsip.h<br>M include/asterisk/res_pjsip_presence_xml.h<br>M res/res_pjsip.c<br>M res/res_pjsip/pjsip_configuration.c<br>M res/res_pjsip/presence_xml.c<br>M res/res_pjsip_dialog_info_body_generator.c<br>M res/res_pjsip_pidf_body_generator.c<br>M res/res_pjsip_pidf_eyebeam_body_supplement.c<br>M res/res_pjsip_xpidf_body_generator.c<br>12 files changed, 69 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CHANGES b/CHANGES<br>index 9bfa506..9cd579b 100644<br>--- a/CHANGES<br>+++ b/CHANGES<br>@@ -30,6 +30,10 @@<br> Some SIP phones like Mitel/Aastra or Snom keep the line busy until<br> receive "200 OK".<br> <br>+ * A new endpoint option "notify_early_inuse_ringing" was added to control<br>+ whether to notify dialog-info state 'early' or 'confirmed' on Ringing<br>+ when already INUSE.<br>+<br> res_agi<br> ------------------<br> * The EAGI() application will now look for a dialplan variable named<br>diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample<br>index a992ff8..3b93bb6 100644<br>--- a/configs/samples/pjsip.conf.sample<br>+++ b/configs/samples/pjsip.conf.sample<br>@@ -774,6 +774,11 @@<br> ; transfer (default: "yes"). The value "no" is useful<br> ; for some SIP phones (Mitel/Aastra, Snom) which expect<br> ; a sip/frag "200 OK" after REFER has been accepted.<br>+;notify_early_inuse_ringing = ; Whether to notifies dialog-info 'early'<br>+ ; on INUSE && RINGING state (default: "no").<br>+ ; The value "yes" is useful for some SIP phones<br>+ ; (Cisco SPA) to be able to indicate and pick up<br>+ ; ringing devices.<br> <br> ;==========================AUTH SECTION OPTIONS=========================<br> ;[auth]<br>diff --git a/contrib/ast-db-manage/config/versions/d7983954dd96_add_ps_endpoints_notify_early_inuse_.py b/contrib/ast-db-manage/config/versions/d7983954dd96_add_ps_endpoints_notify_early_inuse_.py<br>new file mode 100644<br>index 0000000..e1dcdd1<br>--- /dev/null<br>+++ b/contrib/ast-db-manage/config/versions/d7983954dd96_add_ps_endpoints_notify_early_inuse_.py<br>@@ -0,0 +1,30 @@<br>+"""add ps_endpoints.notify_early_inuse_ringing<br>+<br>+Revision ID: d7983954dd96<br>+Revises: 86bb1efa278d<br>+Create Date: 2017-06-05 15:44:41.152280<br>+<br>+"""<br>+<br>+# revision identifiers, used by Alembic.<br>+revision = 'd7983954dd96'<br>+down_revision = '86bb1efa278d'<br>+<br>+from alembic import op<br>+import sqlalchemy as sa<br>+from sqlalchemy.dialects.postgresql import ENUM<br>+<br>+YESNO_NAME = 'yesno_values'<br>+YESNO_VALUES = ['yes', 'no']<br>+<br>+def upgrade():<br>+ ############################# Enums ##############################<br>+<br>+ # yesno_values have already been created, so use postgres enum object<br>+ # type to get around "already created" issue - works okay with mysql<br>+ yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)<br>+<br>+ op.add_column('ps_endpoints', sa.Column('notify_early_inuse_ringing', yesno_values))<br>+<br>+def downgrade():<br>+ op.drop_column('ps_endpoints', 'notify_early_inuse_ringing')<br>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h<br>index 8c589ef..b9c50ad 100644<br>--- a/include/asterisk/res_pjsip.h<br>+++ b/include/asterisk/res_pjsip.h<br>@@ -769,6 +769,8 @@<br> unsigned int allow_overlap;<br> /*! Whether to notifies all the progress details on blind transfer */<br> unsigned int refer_blind_progress;<br>+ /*! Whether to notifies dialog-info 'early' on INUSE && RINGING state */<br>+ unsigned int notify_early_inuse_ringing;<br> };<br> <br> /*! URI parameter for symmetric transport */<br>diff --git a/include/asterisk/res_pjsip_presence_xml.h b/include/asterisk/res_pjsip_presence_xml.h<br>index deed090..55b79ad 100644<br>--- a/include/asterisk/res_pjsip_presence_xml.h<br>+++ b/include/asterisk/res_pjsip_presence_xml.h<br>@@ -69,7 +69,8 @@<br> * \param[out] local_state<br> */<br> void ast_sip_presence_exten_state_to_str(int state, char **statestring,<br>- char **pidfstate, char **pidfnote, enum ast_sip_pidf_state *local_state);<br>+ char **pidfstate, char **pidfnote, enum ast_sip_pidf_state *local_state,<br>+ unsigned int notify_early_inuse_ringing);<br> <br> /*!<br> * \brief Create XML attribute<br>diff --git a/res/res_pjsip.c b/res/res_pjsip.c<br>index d994f28..f6d63c6 100644<br>--- a/res/res_pjsip.c<br>+++ b/res/res_pjsip.c<br>@@ -971,6 +971,13 @@<br> will not send the progress details, but immediately will send "200 OK".<br> </para></description><br> </configOption><br>+ <configOption name="notify_early_inuse_ringing" default="no"><br>+ <synopsis>Whether to notifies dialog-info 'early' on InUse&Ringing state</synopsis><br>+ <description><para><br>+ Control whether dialog-info subscriptions get 'early' state<br>+ on Ringing when already INUSE.<br>+ </para></description><br>+ </configOption><br> </configObject><br> <configObject name="auth"><br> <synopsis>Authentication type</synopsis><br>diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c<br>index 679c883..7a05f87 100644<br>--- a/res/res_pjsip/pjsip_configuration.c<br>+++ b/res/res_pjsip/pjsip_configuration.c<br>@@ -1940,6 +1940,7 @@<br> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtcp_mux", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtcp_mux));<br> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_overlap", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allow_overlap));<br> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "refer_blind_progress", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, refer_blind_progress));<br>+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "notify_early_inuse_ringing", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, notify_early_inuse_ringing));<br> <br> if (ast_sip_initialize_sorcery_transport()) {<br> ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");<br>diff --git a/res/res_pjsip/presence_xml.c b/res/res_pjsip/presence_xml.c<br>index c991a0d..1aca307 100644<br>--- a/res/res_pjsip/presence_xml.c<br>+++ b/res/res_pjsip/presence_xml.c<br>@@ -82,7 +82,8 @@<br> }<br> <br> void ast_sip_presence_exten_state_to_str(int state, char **statestring, char **pidfstate,<br>- char **pidfnote, enum ast_sip_pidf_state *local_state)<br>+ char **pidfnote, enum ast_sip_pidf_state *local_state,<br>+ unsigned int notify_early_inuse_ringing)<br> {<br> switch (state) {<br> case AST_EXTENSION_RINGING:<br>@@ -92,7 +93,11 @@<br> *pidfnote = "Ringing";<br> break;<br> case (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING):<br>- *statestring = "confirmed";<br>+ if (notify_early_inuse_ringing) {<br>+ *statestring = "early";<br>+ } else {<br>+ *statestring = "confirmed";<br>+ }<br> *local_state = NOTIFY_INUSE;<br> *pidfstate = "busy";<br> *pidfnote = "Ringing";<br>diff --git a/res/res_pjsip_dialog_info_body_generator.c b/res/res_pjsip_dialog_info_body_generator.c<br>index 5006b9e..7c386e3 100644<br>--- a/res/res_pjsip_dialog_info_body_generator.c<br>+++ b/res/res_pjsip_dialog_info_body_generator.c<br>@@ -107,6 +107,8 @@<br> enum ast_sip_pidf_state local_state;<br> unsigned int version;<br> char version_str[32], sanitized[PJSIP_MAX_URL_SIZE];<br>+ struct ast_sip_endpoint *endpoint = NULL;<br>+ unsigned int notify_early_inuse_ringing = 0;<br> <br> if (!local || !state_data->datastores) {<br> return -1;<br>@@ -120,8 +122,12 @@<br> stripped = ast_strip_quoted(local, "<", ">");<br> ast_sip_sanitize_xml(stripped, sanitized, sizeof(sanitized));<br> <br>+ if (state_data->sub && (endpoint = ast_sip_subscription_get_endpoint(state_data->sub))) {<br>+ notify_early_inuse_ringing = endpoint->notify_early_inuse_ringing;<br>+ ao2_cleanup(endpoint);<br>+ }<br> ast_sip_presence_exten_state_to_str(state_data->exten_state, &statestring,<br>- &pidfstate, &pidfnote, &local_state);<br>+ &pidfstate, &pidfnote, &local_state, notify_early_inuse_ringing);<br> <br> ast_sip_presence_xml_create_attr(state_data->pool, dialog_info, "xmlns", "urn:ietf:params:xml:ns:dialog-info");<br> <br>@@ -133,7 +139,7 @@<br> <br> dialog = ast_sip_presence_xml_create_node(state_data->pool, dialog_info, "dialog");<br> ast_sip_presence_xml_create_attr(state_data->pool, dialog, "id", state_data->exten);<br>- if (state_data->exten_state == AST_EXTENSION_RINGING) {<br>+ if (!ast_strlen_zero(statestring) && !strcmp(statestring, "early")) {<br> ast_sip_presence_xml_create_attr(state_data->pool, dialog, "direction", "recipient");<br> }<br> <br>diff --git a/res/res_pjsip_pidf_body_generator.c b/res/res_pjsip_pidf_body_generator.c<br>index 25f0639..cc10082 100644<br>--- a/res/res_pjsip_pidf_body_generator.c<br>+++ b/res/res_pjsip_pidf_body_generator.c<br>@@ -58,7 +58,7 @@<br> struct ast_sip_exten_state_data *state_data = data;<br> <br> ast_sip_presence_exten_state_to_str(state_data->exten_state, &statestring,<br>- &pidfstate, &pidfnote, &local_state);<br>+ &pidfstate, &pidfnote, &local_state, 0);<br> <br> if (!pjpidf_pres_add_note(state_data->pool, pres, pj_cstr(¬e, pidfnote))) {<br> ast_log(LOG_WARNING, "Unable to add note to PIDF presence\n");<br>diff --git a/res/res_pjsip_pidf_eyebeam_body_supplement.c b/res/res_pjsip_pidf_eyebeam_body_supplement.c<br>index cc6dfd1..a0f50fd 100644<br>--- a/res/res_pjsip_pidf_eyebeam_body_supplement.c<br>+++ b/res/res_pjsip_pidf_eyebeam_body_supplement.c<br>@@ -80,7 +80,7 @@<br> enum ast_sip_pidf_state local_state;<br> <br> ast_sip_presence_exten_state_to_str(state_data->exten_state, &statestring,<br>- &pidfstate, &pidfnote, &local_state);<br>+ &pidfstate, &pidfnote, &local_state, 0);<br> <br> add_eyebeam(state_data->pool, pres, pidfstate);<br> return 0;<br>diff --git a/res/res_pjsip_xpidf_body_generator.c b/res/res_pjsip_xpidf_body_generator.c<br>index 9240465..41f6224 100644<br>--- a/res/res_pjsip_xpidf_body_generator.c<br>+++ b/res/res_pjsip_xpidf_body_generator.c<br>@@ -63,7 +63,7 @@<br> pj_xml_node *msnsubstatus;<br> <br> ast_sip_presence_exten_state_to_str(state_data->exten_state, &statestring,<br>- &pidfstate, &pidfnote, &local_state);<br>+ &pidfstate, &pidfnote, &local_state, 0);<br> <br> ast_sip_presence_xml_find_node_attr(state_data->pool, pres, "atom", "id",<br> &atom, &attr);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5769">change 5769</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/5769"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ie050bc30023543c7dfb4365c5be3ce58c738c711 </div>
<div style="display:none"> Gerrit-Change-Number: 5769 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>