[svn-commits] file: branch group/pimp_my_sip r391193 - in /team/group/pimp_my_sip: channels...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 10 07:02:53 CDT 2013


Author: file
Date: Mon Jun 10 07:02:42 2013
New Revision: 391193

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391193
Log:
Add mid-call connected line update support.

(closes issue ASTERISK-21258)

Review: https://reviewboard.asterisk.org/r/2570/

Modified:
    team/group/pimp_my_sip/channels/chan_gulp.c
    team/group/pimp_my_sip/include/asterisk/res_sip.h
    team/group/pimp_my_sip/res/res_sip.c
    team/group/pimp_my_sip/res/res_sip/sip_configuration.c
    team/group/pimp_my_sip/res/res_sip_caller_id.c

Modified: team/group/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=391193&r1=391192&r2=391193
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Mon Jun 10 07:02:42 2013
@@ -847,6 +847,40 @@
 	return 0;
 }
 
+/*! \brief Update connected line information */
+static int update_connected_line_information(void *data)
+{
+	RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
+
+	if ((ast_channel_state(session->channel) != AST_STATE_UP) && (session->inv_session->role == PJSIP_UAS_ROLE)) {
+		int response_code = 0;
+
+		if (ast_channel_state(session->channel) == AST_STATE_RING) {
+			response_code = !session->endpoint->inband_progress ? 180 : 183;
+		} else if (ast_channel_state(session->channel) == AST_STATE_RINGING) {
+			response_code = 183;
+		}
+
+		if (response_code) {
+			struct pjsip_tx_data *packet = NULL;
+
+			if (pjsip_inv_answer(session->inv_session, response_code, NULL, NULL, &packet) == PJ_SUCCESS) {
+				ast_sip_session_send_response(session, packet);
+			}
+		}
+	} else {
+		enum ast_sip_session_refresh_method method = session->endpoint->connected_line_method;
+
+		if (session->inv_session->invite_tsx && (session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE)) {
+			method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
+		}
+
+		ast_sip_session_refresh(session, NULL, NULL, method, 0);
+	}
+
+	return 0;
+}
+
 /*! \brief Function called by core to ask the channel to indicate some sort of condition */
 static int gulp_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen)
 {
@@ -914,6 +948,12 @@
 			}
 		} else {
 			res = -1;
+		}
+		break;
+	case AST_CONTROL_CONNECTED_LINE:
+		ao2_ref(session, +1);
+		if (ast_sip_push_task(session->serializer, update_connected_line_information, session)) {
+			ao2_cleanup(session);
 		}
 		break;
 	case AST_CONTROL_UPDATE_RTP_PEER:

Modified: team/group/pimp_my_sip/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/res_sip.h?view=diff&rev=391193&r1=391192&r2=391193
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/res_sip.h (original)
+++ team/group/pimp_my_sip/include/asterisk/res_sip.h Mon Jun 10 07:02:42 2013
@@ -334,6 +334,8 @@
 	unsigned int direct_media;
 	/*! When using direct media, which method should be used */
 	enum ast_sip_session_refresh_method direct_media_method;
+	/*! When performing connected line update, which method should be used */
+	enum ast_sip_session_refresh_method connected_line_method;
 	/*! Take steps to mitigate glare for direct media */
 	enum ast_sip_direct_media_glare_mitigation direct_media_glare_mitigation;
 	/*! Do not attempt direct media session refreshes if a media NAT is detected */

Modified: team/group/pimp_my_sip/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip.c?view=diff&rev=391193&r1=391192&r2=391193
==============================================================================
--- team/group/pimp_my_sip/res/res_sip.c (original)
+++ team/group/pimp_my_sip/res/res_sip.c Mon Jun 10 07:02:42 2013
@@ -161,6 +161,19 @@
 						</enumlist>
 					</description>
 				</configOption>
+				<configOption name="connected_line_method" default="invite">
+					<synopsis>Connected line method type</synopsis>
+					<description>
+						<para>Method used when updating connected line information.</para>
+						<enumlist>
+							<enum name="invite" />
+							<enum name="reinvite">
+								<para>Alias for the <literal>invite</literal> value.</para>
+							</enum>
+							<enum name="update" />
+						</enumlist>
+					</description>
+				</configOption>
 				<configOption name="direct_media" default="yes">
 					<synopsis>Determines whether media may flow directly between endpoints.</synopsis>
 				</configOption>

Modified: team/group/pimp_my_sip/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip/sip_configuration.c?view=diff&rev=391193&r1=391192&r2=391193
==============================================================================
--- team/group/pimp_my_sip/res/res_sip/sip_configuration.c (original)
+++ team/group/pimp_my_sip/res/res_sip/sip_configuration.c Mon Jun 10 07:02:42 2013
@@ -206,6 +206,22 @@
 		endpoint->direct_media_method = AST_SIP_SESSION_REFRESH_METHOD_INVITE;
 	} else if (!strcasecmp(var->value, "update")) {
 		endpoint->direct_media_method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
+	} else {
+		ast_log(LOG_NOTICE, "Unrecognized option value %s for %s on endpoint %s\n",
+				var->value, var->name, ast_sorcery_object_get_id(endpoint));
+		return -1;
+	}
+	return 0;
+}
+
+static int connected_line_method_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+	struct ast_sip_endpoint *endpoint = obj;
+
+	if (!strcasecmp(var->value, "invite") || !strcasecmp(var->value, "reinvite")) {
+		endpoint->connected_line_method = AST_SIP_SESSION_REFRESH_METHOD_INVITE;
+	} else if (!strcasecmp(var->value, "update")) {
+		endpoint->connected_line_method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
 	} else {
 		ast_log(LOG_NOTICE, "Unrecognized option value %s for %s on endpoint %s\n",
 				var->value, var->name, ast_sorcery_object_get_id(endpoint));
@@ -357,6 +373,7 @@
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "identify_by", "username,location", ident_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "direct_media", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, direct_media));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_method", "invite", direct_media_method_handler, NULL, 0, 0);
+	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "connected_line_method", "invite", connected_line_method_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_glare_mitigation", "none", direct_media_glare_mitigation_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disable_direct_media_on_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, disable_direct_media_on_nat));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid", "", caller_id_handler, NULL, 0, 0);

Modified: team/group/pimp_my_sip/res/res_sip_caller_id.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_caller_id.c?view=diff&rev=391193&r1=391192&r2=391193
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_caller_id.c (original)
+++ team/group/pimp_my_sip/res/res_sip_caller_id.c Mon Jun 10 07:02:42 2013
@@ -688,7 +688,7 @@
 }
 
 static struct ast_sip_session_supplement caller_id_supplement = {
-	.method = "INVITE",
+	.method = "INVITE,UPDATE",
 	.priority = AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL - 1000,
 	.incoming_request = caller_id_incoming_request,
 	.incoming_response = caller_id_incoming_response,




More information about the svn-commits mailing list