[libpri-commits] rmudgett: branch rmudgett/deflection r1166 - /team/rmudgett/deflection/

SVN commits to the libpri project libpri-commits at lists.digium.com
Thu Oct 8 15:04:27 CDT 2009


Author: rmudgett
Date: Thu Oct  8 15:04:23 2009
New Revision: 1166

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1166
Log:
Add support for the "served user call retention on invocation of diversion" network option.

Asterisk currently can only support the "clear call on invocation"
settting and not the "retain call until alerting begins at the
deflected-to user" setting.

Modified:
    team/rmudgett/deflection/libpri.h
    team/rmudgett/deflection/pri_facility.c

Modified: team/rmudgett/deflection/libpri.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/deflection/libpri.h?view=diff&rev=1166&r1=1165&r2=1166
==============================================================================
--- team/rmudgett/deflection/libpri.h (original)
+++ team/rmudgett/deflection/libpri.h Thu Oct  8 15:04:23 2009
@@ -1092,13 +1092,27 @@
 int pri_reroute_call(struct pri *ctrl, q931_call *call, const struct pri_party_id *caller, const struct pri_party_redirecting *deflection, int subscription_option);
 
 enum PRI_REROUTING_RSP_CODE {
-	PRI_REROUTING_RSP_OK,
+	/*!
+	 * Rerouting invocation accepted and the network provider option
+	 * "served user call retention on invocation of diversion"
+	 * is "clear call on invocation".
+	 */
+	PRI_REROUTING_RSP_OK_CLEAR,
+	/*!
+	 * Rerouting invocation accepted and the network provider option
+	 * "served user call retention on invocation of diversion"
+	 * is "retain call until alerting begins at the deflected-to user".
+	 */
+	PRI_REROUTING_RSP_OK_RETAIN,
 	PRI_REROUTING_RSP_NOT_SUBSCRIBED,
 	PRI_REROUTING_RSP_NOT_AVAILABLE,
-	PRI_REROUTING_RSP_NOT_ALLOWED,/* Supplementary service interaction not allowed. */
+	/*! Supplementary service interaction not allowed. */
+	PRI_REROUTING_RSP_NOT_ALLOWED,
 	PRI_REROUTING_RSP_INVALID_NUMBER,
-	PRI_REROUTING_RSP_SPECIAL_SERVICE_NUMBER,/* Deflection to prohibited number (e.g., operator, police, emergency). */
-	PRI_REROUTING_RSP_DIVERSION_TO_SELF,/* Deflection to served user number. */
+	/*! Deflection to prohibited number (e.g., operator, police, emergency). */
+	PRI_REROUTING_RSP_SPECIAL_SERVICE_NUMBER,
+	/*! Deflection to served user number. */
+	PRI_REROUTING_RSP_DIVERSION_TO_SELF,
 	PRI_REROUTING_RSP_MAX_DIVERSIONS_EXCEEDED,
 	PRI_REROUTING_RSP_RESOURCE_UNAVAILABLE,
 };

Modified: team/rmudgett/deflection/pri_facility.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/deflection/pri_facility.c?view=diff&rev=1166&r1=1165&r2=1166
==============================================================================
--- team/rmudgett/deflection/pri_facility.c (original)
+++ team/rmudgett/deflection/pri_facility.c Thu Oct  8 15:04:23 2009
@@ -2930,16 +2930,17 @@
 
 /*!
  * \internal
- * \brief Encode and queue a plain facility result ok.
+ * \brief Encode and queue a plain ROSE result ok.
  *
  * \param ctrl D channel controller for diagnostic messages or global options.
  * \param call Call leg from which to encode result ok message response.
+ * \param msgtype Q.931 message type to put facility ie in.
  * \param invoke_id Invoke id to put in result ok message response.
  *
  * \retval 0 on success.
  * \retval -1 on error.
  */
-static int rose_facility_result_ok_encode(struct pri *ctrl, q931_call *call, int invoke_id)
+static int rose_result_ok_encode(struct pri *ctrl, q931_call *call, int msgtype, int invoke_id)
 {
 	unsigned char buffer[256];
 	unsigned char *end;
@@ -2961,11 +2962,11 @@
 		return -1;
 	}
 
-	return pri_call_apdu_queue(call, Q931_FACILITY, buffer, end - buffer, NULL, NULL);
-}
-
-/*!
- * \brief Encode and send a plain facility result ok.
+	return pri_call_apdu_queue(call, msgtype, buffer, end - buffer, NULL, NULL);
+}
+
+/*!
+ * \brief Encode and send a FACILITY message with a plain ROSE result ok.
  *
  * \param ctrl D channel controller for diagnostic messages or global options.
  * \param call Call leg from which to encode result ok message response.
@@ -2976,7 +2977,7 @@
  */
 static int send_facility_result_ok(struct pri *ctrl, q931_call *call, int invoke_id)
 {
-	if (rose_facility_result_ok_encode(ctrl, call, invoke_id)
+	if (rose_result_ok_encode(ctrl, call, Q931_FACILITY, invoke_id)
 		|| q931_facility(ctrl, call)) {
 		pri_message(ctrl,
 			"Could not schedule facility message for result OK message.\n");
@@ -2997,7 +2998,9 @@
 	/* Convert the public rerouting response code to an error code or result ok. */
 	rose_err = ROSE_ERROR_Gen_ResourceUnavailable;
 	switch (code) {
-	case PRI_REROUTING_RSP_OK:
+	case PRI_REROUTING_RSP_OK_CLEAR:
+		return rose_result_ok_encode(ctrl, call, Q931_DISCONNECT, invoke_id);
+	case PRI_REROUTING_RSP_OK_RETAIN:
 		return send_facility_result_ok(ctrl, call, invoke_id);
 	case PRI_REROUTING_RSP_NOT_SUBSCRIBED:
 		rose_err = ROSE_ERROR_Gen_NotSubscribed;




More information about the libpri-commits mailing list