[libpri-commits] rmudgett: branch rmudgett/mcid r1548 - /team/rmudgett/mcid/
SVN commits to the libpri project
libpri-commits at lists.digium.com
Thu Mar 18 10:53:53 CDT 2010
Author: rmudgett
Date: Thu Mar 18 10:53:49 2010
New Revision: 1548
URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1548
Log:
Change MCID API to provide more information.
Modified:
team/rmudgett/mcid/libpri.h
team/rmudgett/mcid/pri_facility.c
Modified: team/rmudgett/mcid/libpri.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/mcid/libpri.h?view=diff&rev=1548&r1=1547&r2=1548
==============================================================================
--- team/rmudgett/mcid/libpri.h (original)
+++ team/rmudgett/mcid/libpri.h Thu Mar 18 10:53:49 2010
@@ -544,7 +544,7 @@
#define PRI_SUBCMD_AOC_D 19 /*!< Advice Of Charge During information */
#define PRI_SUBCMD_AOC_E 20 /*!< Advice Of Charge End information */
#define PRI_SUBCMD_MCID_REQ 21 /*!< Malicious Call ID Request */
-#define PRI_SUBCMD_MCID_REQ_COMPLETE 22 /*!< Malicious Call ID Request completed */
+#define PRI_SUBCMD_MCID_RSP 22 /*!< Malicious Call ID Request response */
#if defined(STATUS_REQUEST_PLACE_HOLDER)
struct pri_subcmd_status_request {
@@ -862,7 +862,29 @@
* may be incomplete if the upper layer redacted some caller
* information because it was restricted.
*/
- struct pri_party_id caller;
+ struct pri_party_id originator;
+ /*! \brief Information libpri knows about the callee. */
+ struct pri_party_id answerer;
+};
+
+struct pri_subcmd_mcid_rsp {
+ /*!
+ * \brief MCID request response status.
+ * \details
+ * success(0),
+ * timeout(1),
+ * error(2),
+ * reject(3)
+ */
+ int status;
+ /*!
+ * \brief Failure code that can be converted to a string to further
+ * explain the non-timeout failure.
+ * \note Valid when status is error or reject.
+ * \note Use pri_facility_error2str() to convert the error_code.
+ * \note Use pri_facility_reject2str() to convert the reject_code.
+ */
+ int fail_code;
};
struct pri_subcommand {
@@ -894,6 +916,7 @@
struct pri_subcmd_aoc_d aoc_d;
struct pri_subcmd_aoc_e aoc_e;
struct pri_subcmd_mcid_req mcid_req;
+ struct pri_subcmd_mcid_rsp mcid_rsp;
} u;
};
@@ -1730,7 +1753,7 @@
* \param ctrl D channel controller.
* \param call Q.931 call leg
*
- * \retval 0 on success. You should wait for a PRI_SUBCMD_MCID_REQ_COMPLETE
+ * \retval 0 on success. You should wait for a PRI_SUBCMD_MCID_RSP
* to continue clearing the call if it was in progress.
* \retval -1 on error.
*/
Modified: team/rmudgett/mcid/pri_facility.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/mcid/pri_facility.c?view=diff&rev=1548&r1=1547&r2=1548
==============================================================================
--- team/rmudgett/mcid/pri_facility.c (original)
+++ team/rmudgett/mcid/pri_facility.c Thu Mar 18 10:53:49 2010
@@ -3557,23 +3557,38 @@
static int mcid_req_response(enum APDU_CALLBACK_REASON reason, struct pri *ctrl, struct q931_call *call, struct apdu_event *apdu, const struct apdu_msg_data *msg)
{
struct pri_subcommand *subcmd;
+ int status;
+ int fail_code;
switch (reason) {
case APDU_CALLBACK_REASON_TIMEOUT:
+ status = 1;/* timeout */
+ fail_code = 0;
+ break;
case APDU_CALLBACK_REASON_MSG_RESULT:
+ status = 0;/* success */
+ fail_code = 0;
+ break;
case APDU_CALLBACK_REASON_MSG_ERROR:
+ status = 2;/* error */
+ fail_code = msg->response.error->code;
+ break;
case APDU_CALLBACK_REASON_MSG_REJECT:
- subcmd = q931_alloc_subcommand(ctrl);
- if (!subcmd) {
- /* Oh, well. */
- break;
- }
-
+ status = 3;/* reject */
+ fail_code = 0;
+ fail_code = msg->response.reject->code;
+ break;
+ default:
+ return 1;
+ }
+ subcmd = q931_alloc_subcommand(ctrl);
+ if (subcmd) {
/* Indicate that our MCID request has completed. */
- subcmd->cmd = PRI_SUBCMD_MCID_REQ_COMPLETE;
- break;
- default:
- break;
+ subcmd->cmd = PRI_SUBCMD_MCID_RSP;
+ subcmd->u.mcid_rsp.status = status;
+ subcmd->u.mcid_rsp.fail_code = fail_code;
+ } else {
+ /* Oh, well. */
}
return 1;
}
@@ -4535,7 +4550,8 @@
}
subcmd->cmd = PRI_SUBCMD_MCID_REQ;
- q931_party_id_copy_to_pri(&subcmd->u.mcid_req.caller, &call->local_id);
+ q931_party_id_copy_to_pri(&subcmd->u.mcid_req.originator, &call->local_id);
+ q931_party_id_copy_to_pri(&subcmd->u.mcid_req.answerer, &call->remote_id);
send_facility_result_ok(ctrl, call, invoke->invoke_id);
break;
More information about the libpri-commits
mailing list