[asterisk-commits] mjordan: branch mjordan/12-channel-func r403252 - in /team/mjordan/12-channel...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Dec 1 07:41:31 CST 2013


Author: mjordan
Date: Sun Dec  1 07:41:26 2013
New Revision: 403252

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=403252
Log:
Update with working function

Modified:
    team/mjordan/12-channel-func/channels/chan_pjsip.c
    team/mjordan/12-channel-func/channels/pjsip/dialplan_functions.c
    team/mjordan/12-channel-func/channels/pjsip/include/chan_pjsip.h
    team/mjordan/12-channel-func/channels/pjsip/include/dialplan_functions.h
    team/mjordan/12-channel-func/include/asterisk/res_pjsip_session.h
    team/mjordan/12-channel-func/res/res_pjsip_t38.c

Modified: team/mjordan/12-channel-func/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-channel-func/channels/chan_pjsip.c?view=diff&rev=403252&r1=403251&r2=403252
==============================================================================
--- team/mjordan/12-channel-func/channels/chan_pjsip.c (original)
+++ team/mjordan/12-channel-func/channels/chan_pjsip.c Sun Dec  1 07:41:26 2013
@@ -211,6 +211,20 @@
 	return ast_sip_session_refresh(session, NULL, NULL, NULL,
 			session->endpoint->media.direct_media.method, 1);
 }
+
+/*! \brief Destructor function for \ref transport_info_data */
+static void transport_info_destroy(void *obj)
+{
+	struct transport_info_data *data = obj;
+	ast_free(data);
+}
+
+/*! \brief Datastore used to store local/remote addresses for the
+ * INVITE request that created the PJSIP channel */
+static struct ast_datastore_info transport_info = {
+	.type = "chan_pjsip_transport_info",
+	.destroy = transport_info_destroy,
+};
 
 static struct ast_datastore_info direct_media_mitigation_info = { };
 
@@ -1741,11 +1755,27 @@
 /*! \brief Function called when a request is received on the session */
 static int chan_pjsip_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
 {
+	RAII_VAR(struct ast_datastore *, datastore, NULL, ao2_cleanup);
+	struct transport_info_data *transport_data;
 	pjsip_tx_data *packet = NULL;
 
 	if (session->channel) {
 		return 0;
 	}
+
+	datastore = ast_sip_session_alloc_datastore(&transport_info, "transport_info");
+	if (!datastore) {
+		return -1;
+	}
+
+	transport_data = ast_calloc(1, sizeof(*transport_data));
+	if (!transport_data) {
+		return -1;
+	}
+	pj_sockaddr_cp(&transport_data->local_addr, &rdata->tp_info.transport->local_addr);
+	pj_sockaddr_cp(&transport_data->remote_addr, &rdata->pkt_info.src_addr);
+	datastore->data = transport_data;
+	ast_sip_session_add_datastore(session, datastore);
 
 	if (!(session->channel = chan_pjsip_new(session, AST_STATE_RING, session->exten, NULL, NULL, NULL))) {
 		if (pjsip_inv_end_session(session->inv_session, 503, NULL, &packet) == PJ_SUCCESS) {
@@ -1829,6 +1859,17 @@
 	}
 	return 0;
 }
+
+static struct ast_custom_function chan_pjsip_dial_contacts_function = {
+	.name = "PJSIP_DIAL_CONTACTS",
+	.read = pjsip_acf_dial_contacts_read,
+};
+
+static struct ast_custom_function media_offer_function = {
+	.name = "PJSIP_MEDIA_OFFER",
+	.read = pjsip_acf_media_offer_read,
+	.write = pjsip_acf_media_offer_write
+};
 
 /*!
  * \brief Load the module
@@ -1855,6 +1896,16 @@
 		goto end;
 	}
 
+	if (ast_custom_function_register(&chan_pjsip_dial_contacts_function)) {
+		ast_log(LOG_ERROR, "Unable to register PJSIP_DIAL_CONTACTS dialplan function\n");
+		goto end;
+	}
+
+	if (ast_custom_function_register(&media_offer_function)) {
+		ast_log(LOG_WARNING, "Unable to register PJSIP_MEDIA_OFFER dialplan function\n");
+		goto end;
+	}
+
 	if (ast_sip_session_register_supplement(&chan_pjsip_supplement)) {
 		ast_log(LOG_ERROR, "Unable to register PJSIP supplement\n");
 		goto end;
@@ -1877,6 +1928,8 @@
 
 end:
 	ast_channel_unregister(&chan_pjsip_tech);
+	ast_custom_function_unregister(&media_offer_function);
+	ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
 	ast_rtp_glue_unregister(&chan_pjsip_rtp_glue);
 
 	return AST_MODULE_LOAD_FAILURE;
@@ -1894,6 +1947,9 @@
 	ast_sip_session_unregister_supplement(&chan_pjsip_supplement);
 	ast_sip_session_unregister_supplement(&pbx_start_supplement);
 	ast_sip_session_unregister_supplement(&chan_pjsip_ack_supplement);
+
+	ast_custom_function_unregister(&media_offer_function);
+	ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
 
 	ast_channel_unregister(&chan_pjsip_tech);
 	ast_rtp_glue_unregister(&chan_pjsip_rtp_glue);

Modified: team/mjordan/12-channel-func/channels/pjsip/dialplan_functions.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-channel-func/channels/pjsip/dialplan_functions.c?view=diff&rev=403252&r1=403251&r2=403252
==============================================================================
--- team/mjordan/12-channel-func/channels/pjsip/dialplan_functions.c (original)
+++ team/mjordan/12-channel-func/channels/pjsip/dialplan_functions.c Sun Dec  1 07:41:26 2013
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 2010, Digium, Inc.
+ * Copyright (C) 2013, Digium, Inc.
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
@@ -66,10 +66,10 @@
 	<enumlist>
 		<enum name="rtp">
 			<para>R/O Retrieve media related information.</para>
-			<para>Specifying <literal>rtp</literal> for <replaceable>item</replaceable>
-			requires two additional parameters, <replaceable>type</replaceable> and
-			<replaceable>media_type</replaceable>.</para>
 			<parameter name="type" required="true">
+				<para>When <replaceable>rtp</replaceable> is specified, the
+				<literal>type</literal> parameter must be provided. It specifies
+				which RTP parameter to read.</para>
 				<enumlist>
 					<enum name="src">
 						<para>Retrieve the local address for RTP.</para>
@@ -107,6 +107,10 @@
 				</enumlist>
 			</parameter>
 			<parameter name="media_type" required="false">
+				<para>When <replaceable>rtp</replaceable> is specified, the
+				<literal>media_type</literal> parameter may be provided. It specifies
+				which media stream the chosen RTP parameter should be retrieved
+				from.</para>
 				<enumlist>
 					<enum name="audio">
 						<para>Retrieve information from the audio media stream.</para>
@@ -122,6 +126,9 @@
 		<enum name="rtcp">
 			<para>R/O Retrieve RTCP statistics.</para>
 			<parameter name="statistic" required="true">
+				<para>When <replaceable>rtcp</replaceable> is specified, the
+				<literal>statistic</literal> parameter must be provided. It specifies
+				which RTCP statistic parameter to read.</para>
 				<enumlist>
 					<enum name="all">
 						<para>Retrieve a summary of all RTCP statistics.</para>
@@ -270,6 +277,10 @@
 				</enumlist>
 			</parameter>
 			<parameter name="media_type" required="false">
+				<para>When <replaceable>rtcp</replaceable> is specified, the
+				<literal>media_type</literal> parameter may be provided. It specifies
+				which media stream the chosen RTCP parameter should be retrieved
+				from.</para>
 				<enumlist>
 					<enum name="audio">
 						<para>Retrieve information from the audio media stream.</para>
@@ -283,19 +294,60 @@
 			</parameter>
 		</enum>
 		<enum name="endpoint">
-			<para>The name of the endpoint associated with this channel.
-			Use the <replaceable>PJSIP_ENDPOINT</replaceable> to obtain further
-			endpoint related information.</para>
+			<para>R/O The name of the endpoint associated with this channel.
+			Use the <replaceable>PJSIP_ENDPOINT</replaceable> function to obtain
+			further endpoint related information.</para>
 		</enum>
 		<enum name="pjsip">
-			<para>Obtain information about the current PJSIP channel and its
+			<para>R/O Obtain information about the current PJSIP channel and its
 			session.</para>
 			<parameter name="type" required="true">
+				<para>When <replaceable>pjsip</replaceable> is specified, the
+				<literal>type</literal> parameter must be provided. It specifies
+				which signalling parameter to read.</para>
+				<enumlist>
+					<enum name="secure">
+						<para>Whether or not the signalling uses a secure transport.</para>
+						<enumlist>
+							<enum name="0"><para>The signalling uses a non-secure transport.</para></enum>
+							<enum name="1"><para>The signalling uses a secure transport.</para></enum>
+						</enumlist>
+					</enum>
+					<enum name="target_uri">
+						<para>The request URI of the inbound <literal>INVITE</literal> request
+						that created this channel.</para>
+					</enum>
+					<enum name="local_uri">
+						<para>The URI in the <literal>To</literal> header received in the
+						inbound <literal>INVITE</literal> request.</para>
+					</enum>
+					<enum name="remote_uri">
+						<para>The URI in the <literal>From</literal> header received in the
+						inbound <literal>INVITE</literal> request.</para>
+					</enum>
+					<enum name="t38state">
+						<para>The current state of any T.38 fax on this channel.</para>
+						<enumlist>
+							<enum name="DISABLED"><para>T.38 faxing is disabled on this channel.</para></enum>
+							<enum name="LOCAL_REINVITE"><para>Asterisk has sent a <literal>re-INVITE</literal> to the remote end to initiate a T.38 fax.</para></enum>
+							<enum name="REMOTE_REINVITE"><para>The remote end has sent a <literal>re-INVITE</literal> to Asterisk to initiate a T.38 fax.</para></enum>
+							<enum name="ENABLED"><para>A T.38 fax session has been enabled.</para></enum>
+							<enum name="REJECTED"><para>A T.38 fax session was attempted but was rejected.</para></enum>
+						</enumlist>
+					</enum>
+					<enum name="local_addr">
+						<para>The full IP address and port number that the <literal>INVITE</literal>
+						request was received on.</para>
+					</enum>
+					<enum name="remote_addr">
+						<para>The full IP address and port number that transmitted the
+						<literal>INVITE</literal> request that created this channel.</para>
+					</enum>
+				</enumlist>
 			</parameter>
 		</enum>
 	</enumlist>
 </info>
-
 ***/
 
 #include "asterisk.h"
@@ -318,9 +370,24 @@
 #include "include/chan_pjsip.h"
 #include "include/dialplan_functions.h"
 
+/*!
+ * \brief String representations of the T.38 state enum
+ */
+static const char *t38state_to_string[T38_MAX_ENUM] = {
+	"DISABLED",
+	"LOCAL_REINVITE",
+	"REMOTE_REINVITE",
+	"ENABLED",
+	"REJECTED",
+};
+
+/*!
+ * \internal \brief Handle reading RTP information
+ */
 static int channel_read_rtp(struct ast_channel *chan, const char *type, const char *field, char *buf, size_t buflen)
 {
-	struct chan_pjsip_pvt *pvt = ast_channel_tech_pvt(chan);
+	struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
+	struct chan_pjsip_pvt *pvt = channel->pvt;
 	struct ast_sip_session_media *media = NULL;
 	struct ast_sockaddr addr;
 
@@ -368,9 +435,13 @@
 	return 0;
 }
 
+/*!
+ * \internal \brief Handle reading RTCP information
+ */
 static int channel_read_rtcp(struct ast_channel *chan, const char *type, const char *field, char *buf, size_t buflen)
 {
-	struct chan_pjsip_pvt *pvt = ast_channel_tech_pvt(chan);
+	struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
+	struct chan_pjsip_pvt *pvt = channel->pvt;
 	struct ast_sip_session_media *media = NULL;
 
 	if (!pvt) {
@@ -477,9 +548,13 @@
 	return 0;
 }
 
+/*!
+ * \internal \brief Handle reading signalling information
+ */
 static int channel_read_pjsip(struct ast_channel *chan, const char *type, const char *field, char *buf, size_t buflen)
 {
 	struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
+	char *buf_copy;
 	pjsip_dialog *dlg;
 
 	if (!channel) {
@@ -493,54 +568,59 @@
 		snprintf(buf, buflen, "%u", dlg->secure ? 1 : 0);
 	} else if (!strcmp(type, "target_uri")) {
 		dlg->target->vptr->p_print(PJSIP_URI_IN_REQ_URI, dlg->target, buf, buflen);
+		buf_copy = ast_strdupa(buf);
+		ast_escape_quoted(buf_copy, buf, buflen);
 	} else if (!strcmp(type, "local_uri")) {
 		dlg->local.info->uri->vptr->p_print(PJSIP_URI_IN_FROMTO_HDR,
 			dlg->local.info->uri, buf, buflen);
+		buf_copy = ast_strdupa(buf);
+		ast_escape_quoted(buf_copy, buf, buflen);
 	} else if (!strcmp(type, "remote_uri")) {
 		dlg->remote.info->uri->vptr->p_print(PJSIP_URI_IN_FROMTO_HDR,
 			dlg->remote.info->uri, buf, buflen);
+		buf_copy = ast_strdupa(buf);
+		ast_escape_quoted(buf_copy, buf, buflen);
+	} else if (!strcmp(type, "t38state")) {
+		snprintf(buf, buflen, "%s", t38state_to_string[channel->session->t38state]);
+	} else if (!strcmp(type, "local_addr")) {
+		RAII_VAR(struct ast_datastore *, datastore, NULL, ao2_cleanup);
+		struct transport_info_data *transport_data;
+
+		datastore = ast_sip_session_get_datastore(channel->session, "transport_info");
+		if (!datastore) {
+			ast_log(AST_LOG_WARNING, "No transport information for channel %s\n", ast_channel_name(chan));
+			return -1;
+		}
+		transport_data = datastore->data;
+
+		if (pj_sockaddr_has_addr(&transport_data->local_addr)) {
+			pj_sockaddr_print(&transport_data->local_addr, buf, buflen, 3);
+		}
+	} else if (!strcmp(type, "remote_addr")) {
+		RAII_VAR(struct ast_datastore *, datastore, NULL, ao2_cleanup);
+		struct transport_info_data *transport_data;
+
+		datastore = ast_sip_session_get_datastore(channel->session, "transport_info");
+		if (!datastore) {
+			ast_log(AST_LOG_WARNING, "No transport information for channel %s\n", ast_channel_name(chan));
+			return -1;
+		}
+		transport_data = datastore->data;
+
+		if (pj_sockaddr_has_addr(&transport_data->remote_addr)) {
+			pj_sockaddr_print(&transport_data->remote_addr, buf, buflen, 3);
+		}
 	} else {
 		return -1;
 	}
-
-	// pjsip_uri ->target
-	// pjsip_dlg_party ->local
-	//		pjsip_fromto_hdr ->info
-	//			pjsip_uri 		->uri
-	//				uri->p_print(
-	//				PJSIP_URI_IN_FROMTO_HDR, uri, buf, size);
-	// pjsip_dlg_party ->remote
-	// pj_bool_t ->secure
 
 	return 0;
 }
-	// secure_signalling
-	//  get from pjsip_dlg secure
-	// t38passthrough
-	// 
-
-	// things to get from pjsip_dialog instance:
-	//  pjsip_user_agent *ua
-	//  pjsip_uri *target (URI of who we are talking to)
-	//  pjsip_dlg_party local
-	//      pjsip_fromto_hdr *info
-	//          pjsip_uri *uri
-	//      pjsip_contact_hdr *contact
-	//          pjsip_uri *uri
-	//  pjsip_dlg_party remote
-
-	// transport information will be harder. When we rx data, we'll need to
-	// store it on the channel in a datastore. Can't really get this info from
-	// the dialog...?
-	//  type
-	//  pjsip_host_port local_name
-	//  pjsip_host_port remote_name
-
-/*! \brief Callback function for CHANNEL function read */
-int pjsip_acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen)
+
+int pjsip_acf_channel_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
 
-	char *parse = ast_strdupa(preparse);
+	char *parse = ast_strdupa(data);
 	int res = 0;
 
 	AST_DECLARE_APP_ARGS(args,
@@ -551,7 +631,7 @@
 		
 	/* Check for zero arguments */
 	if (ast_strlen_zero(parse)) {
-		ast_log(LOG_ERROR, "Cannot call %s without arguments\n", funcname);
+		ast_log(LOG_ERROR, "Cannot call %s without arguments\n", cmd);
 		return -1;
 	}
 
@@ -559,16 +639,16 @@
 
 	/* Sanity check */
 	if (strcmp(ast_channel_tech(chan)->type, "PJSIP")) {
-		ast_log(LOG_ERROR, "Cannot call %s on a non-PJSIP channel\n", funcname);
+		ast_log(LOG_ERROR, "Cannot call %s on a non-PJSIP channel\n", cmd);
 		return 0;
 	}
 
-	memset(buf, 0, buflen);
+	memset(buf, 0, len);
 
 	if (!strcmp(args.param, "rtp")) {
-		res = channel_read_rtp(chan, args.type, args.field, buf, buflen);
+		res = channel_read_rtp(chan, args.type, args.field, buf, len);
 	} else if (!strcmp(args.param, "rtcp")) {
-		res = channel_read_rtcp(chan, args.type, args.field, buf, buflen);
+		res = channel_read_rtcp(chan, args.type, args.field, buf, len);
 	} else if (!strcmp(args.param, "endpoint")) {
 		struct ast_sip_channel_pvt *pvt = ast_channel_tech_pvt(chan);
 
@@ -580,9 +660,9 @@
 			ast_log(AST_LOG_WARNING, "Channel %s has no endpoint!\n", ast_channel_name(chan));
 			return -1;
 		}
-		snprintf(buf, buflen, "%s", ast_sorcery_object_get_id(pvt->session->endpoint));
+		snprintf(buf, len, "%s", ast_sorcery_object_get_id(pvt->session->endpoint));
 	} else if (!strcmp(args.param, "pjsip")) {
-		res = channel_read_pjsip(chan, args.type, args.field, buf, buflen);
+		res = channel_read_pjsip(chan, args.type, args.field, buf, len);
 	} else {
 		res = -1;
 	}
@@ -590,8 +670,7 @@
 	return res;
 }
 
-/*! \brief Dialplan function for constructing a dial string for calling all contacts */
-static int chan_pjsip_dial_contacts(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+int pjsip_acf_dial_contacts_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
 	RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_str *, dial, NULL, ast_free_ptr);
@@ -664,11 +743,6 @@
 	return 0;
 }
 
-static struct ast_custom_function chan_pjsip_dial_contacts_function = {
-	.name = "PJSIP_DIAL_CONTACTS",
-	.read = chan_pjsip_dial_contacts,
-};
-
 static int media_offer_read_av(struct ast_sip_session *session, char *buf,
 			       size_t len, enum ast_format_type media_type)
 {
@@ -731,7 +805,7 @@
 	return 0;
 }
 
-static int media_offer_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+int pjsip_acf_media_offer_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
 	struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
 
@@ -744,7 +818,7 @@
 	return 0;
 }
 
-static int media_offer_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
+int pjsip_acf_media_offer_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
 {
 	struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
 
@@ -761,40 +835,3 @@
 
 	return ast_sip_push_task_synchronous(channel->session->serializer, media_offer_write_av, &mdata);
 }
-
-static struct ast_custom_function media_offer_function = {
-	.name = "PJSIP_MEDIA_OFFER",
-	.read = media_offer_read,
-	.write = media_offer_write
-};
-
-int pjsip_unregister_functions(void)
-{
-	int res = 0;
-
-	res |= ast_custom_function_unregister(&media_offer_function);
-	res |= ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
-
-	return res;
-}
-
-int pjsip_register_functions(void)
-{
-	if (ast_custom_function_register(&chan_pjsip_dial_contacts_function)) {
-		ast_log(LOG_ERROR, "Unable to register PJSIP_DIAL_CONTACTS dialplan function\n");
-		goto error_end;
-	}
-
-	if (ast_custom_function_register(&media_offer_function)) {
-		ast_log(LOG_WARNING, "Unable to register PJSIP_MEDIA_OFFER dialplan function\n");
-		goto error_end;
-	}
-
-	return 0;
-
-error_end:
-	ast_custom_function_unregister(&media_offer_function);
-	ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
-	return -1;
-}
-

Modified: team/mjordan/12-channel-func/channels/pjsip/include/chan_pjsip.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-channel-func/channels/pjsip/include/chan_pjsip.h?view=diff&rev=403252&r1=403251&r2=403252
==============================================================================
--- team/mjordan/12-channel-func/channels/pjsip/include/chan_pjsip.h (original)
+++ team/mjordan/12-channel-func/channels/pjsip/include/chan_pjsip.h Sun Dec  1 07:41:26 2013
@@ -1,9 +1,38 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2013, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
 
+/*!
+ * \file
+ * \brief PJSIP Channel Driver shared data structures
+ */
 
 #ifndef _CHAN_PJSIP_HEADER
 #define _CHAN_PJSIP_HEADER
 
 struct ast_sip_session_media;
+
+/*!
+ * \brief Transport information stored in transport_info datastore
+ */
+struct transport_info_data {
+	/*! \brief The address that sent the request */
+	pj_sockaddr remote_addr;
+	/*! \brief Our address that received the request */
+	pj_sockaddr local_addr;
+};
 
 /*!
  * \brief Positions of various media
@@ -17,7 +46,12 @@
 	SIP_MEDIA_SIZE,
 };
 
+/*!
+ * \brief The PJSIP channel driver pvt, stored in the \ref ast_sip_channel_pvt
+ * data structure
+ */
 struct chan_pjsip_pvt {
+	/*! \brief The available media sessions */
 	struct ast_sip_session_media *media[SIP_MEDIA_SIZE];
 };
 

Modified: team/mjordan/12-channel-func/channels/pjsip/include/dialplan_functions.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-channel-func/channels/pjsip/include/dialplan_functions.h?view=diff&rev=403252&r1=403251&r2=403252
==============================================================================
--- team/mjordan/12-channel-func/channels/pjsip/include/dialplan_functions.h (original)
+++ team/mjordan/12-channel-func/channels/pjsip/include/dialplan_functions.h Sun Dec  1 07:41:26 2013
@@ -22,22 +22,55 @@
 #ifndef _PJSIP_DIALPLAN_FUNCTIONS
 #define _PJSIP_DIALPLAN_FUNCTIONS
 
-int pjsip_acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen);
+/*!
+ * \brief CHANNEL function read callback
+ * \param chan The channel the function is called on
+ * \param cmd The name of the function
+ * \param data Arguments passed to the function
+ * \param buf Out buffer that should be populated with the data
+ * \param len Size of the buffer
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ */
+int pjsip_acf_channel_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len);
 
 /*!
- * \brief Register PJSIP dialplan functions
+ * \brief PJSIP_MEDIA_OFFER function write callback
+ * \param chan The channel the function is called on
+ * \param cmd The name of the function
+ * \param data Arguments passed to the function
+ * \param value Value to be set by the function
  *
  * \retval 0 on success
- * \retval -1 on error
+ * \retval -1 on failure
  */
-int pjsip_register_functions(void);
+int pjsip_acf_media_offer_write(struct ast_channel *chan, const char *cmd, char *data, const char *value);
 
 /*!
- * \brief Unregister PJSIP dialplan functions
+ * \brief PJSIP_MEDIA_OFFER function read callback
+ * \param chan The channel the function is called on
+ * \param cmd The name of the function
+ * \param data Arguments passed to the function
+ * \param buf Out buffer that should be populated with the data
+ * \param len Size of the buffer
  *
  * \retval 0 on success
- * \retval -1 on error
+ * \retval -1 on failure
  */
-int pjsip_unregister_functions(void);
+int pjsip_acf_media_offer_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len);
+
+/*!
+ * \brief PJSIP_DIAL_CONTACTS function read callback
+ * \param chan The channel the function is called on
+ * \param cmd The name of the function
+ * \param data Arguments passed to the function
+ * \param buf Out buffer that should be populated with the data
+ * \param len Size of the buffer
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ */
+int pjsip_acf_dial_contacts_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len);
 
 #endif /* _PJSIP_DIALPLAN_FUNCTIONS */

Modified: team/mjordan/12-channel-func/include/asterisk/res_pjsip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-channel-func/include/asterisk/res_pjsip_session.h?view=diff&rev=403252&r1=403251&r2=403252
==============================================================================
--- team/mjordan/12-channel-func/include/asterisk/res_pjsip_session.h (original)
+++ team/mjordan/12-channel-func/include/asterisk/res_pjsip_session.h Sun Dec  1 07:41:26 2013
@@ -52,6 +52,7 @@
 	T38_PEER_REINVITE,  /*!< Offered from peer - REINVITE */
 	T38_ENABLED,        /*!< Negotiated (enabled) */
 	T38_REJECTED,       /*!< Refused */
+	T38_MAX_ENUM,       /*!< Not an actual state; used as max value in the enum */
 };
 
 struct ast_sip_session_sdp_handler;

Modified: team/mjordan/12-channel-func/res/res_pjsip_t38.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-channel-func/res/res_pjsip_t38.c?view=diff&rev=403252&r1=403251&r2=403252
==============================================================================
--- team/mjordan/12-channel-func/res/res_pjsip_t38.c (original)
+++ team/mjordan/12-channel-func/res/res_pjsip_t38.c Sun Dec  1 07:41:26 2013
@@ -175,6 +175,10 @@
 		break;
 	case T38_LOCAL_REINVITE:
 		/* wait until we get a peer response before responding to local reinvite */
+		break;
+	case T38_MAX_ENUM:
+		/* Well, that shouldn't happen */
+		ast_assert(0);
 		break;
 	}
 




More information about the asterisk-commits mailing list