cc_rcs_t sub_int_subnot_register (cc_srcs_t src_id, cc_srcs_t dst_id, cc_subscriptions_t evt_pkg, void *callback_fun, cc_srcs_t dest_task, int msg_id, void *term_callback, int term_msg_id, long min_duration, long max_duration) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.subs_reg.eventPackage = evt_pkg; pmsg->msg.subs_reg.max_duration = max_duration; pmsg->msg.subs_reg.min_duration = min_duration; pmsg->msg.subs_reg.subsIndCallback = (ccsipSubsIndCallbackFn_t) callback_fun; pmsg->msg.subs_reg.subsIndCallbackMsgID = msg_id; pmsg->msg.subs_reg.subsIndCallbackTask = dest_task; pmsg->msg.subs_reg.subsTermCallback = (ccsipSubsTerminateCallbackFn_t) term_callback; pmsg->msg.subs_reg.subsTermCallbackMsgID = term_msg_id; return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIBE_REGISTER, sizeof(*pmsg), dst_id); }
static void dp_int_message (line_t line, callid_t call_id, char digit, char *digit_str, boolean collect_more, void *tmr_data, int msg_id, char *g_call_id, monitor_mode_t monitor_mode) { char fname[] = "dp_int_message"; dp_int_t *pmsg; pmsg = (dp_int_t *) cc_get_msg_buf(sizeof(dp_int_t)); if (!pmsg) { err_msg(get_debug_string(CC_NO_MSG_BUFFER), fname); return; } pmsg->line = line; pmsg->call_id = call_id; pmsg->digit = digit; if (digit_str) { sstrncpy(pmsg->digit_str, digit_str, MAX_DIALSTRING); } pmsg->collect_more = collect_more; pmsg->tmr_ptr = tmr_data; if (digit_str) { sstrncpy(pmsg->global_call_id, g_call_id, CC_GCID_LEN); } pmsg->monitor_mode = monitor_mode; if (gsm_send_msg(msg_id, (cprBuffer_t) pmsg, sizeof(dp_int_t)) != CPR_SUCCESS) { err_msg(get_debug_string(CC_SEND_FAILURE), fname); } }
/* * Function: sub_int_subscribe() * * Parameters: msg_p - pointer to sipspi_msg_t (input parameter) * * Description: posts SIPSPI_EV_CC_SUBSCRIBE to SIP task message queue. * * Returns: CC_RC_ERROR - failed to post msg. * CC_RC_SUCCESS - successful posted msg. */ cc_rcs_t sub_int_subscribe (sipspi_msg_t *msg_p) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } memcpy(pmsg, msg_p, sizeof(sipspi_msg_t)); return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIBE, sizeof(*pmsg), CC_SRC_SIP); }
cc_rcs_t app_send_message (void *msg_data, int msg_len, cc_srcs_t dest_id, int msg_id) { void *pmsg; pmsg = (void *) cc_get_msg_buf(msg_len); if (!pmsg) { return CC_RC_ERROR; } memcpy(pmsg, msg_data, msg_len); return sub_send_msg((cprBuffer_t)pmsg, msg_id, (uint16_t)msg_len, dest_id); }
cc_rcs_t sip_send_message (ccsip_sub_not_data_t * msg_data, cc_srcs_t dest_id, int msg_id) { ccsip_sub_not_data_t *pmsg; pmsg = (ccsip_sub_not_data_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } memcpy(pmsg, msg_data, sizeof(*pmsg)); return sub_send_msg((cprBuffer_t)pmsg, msg_id, sizeof(*pmsg), dest_id); }
/** * This function will post a response event to applications. * this is invoked by SIP stack. * * @param[in] pub_rsp_p - response struct. * @param[in] callback_task - task that is interested in response. * @param[in] message_id - message id of the response. * * @return CC_RC_SUCCESS if the event is successfully posted. * Otherwise, CC_RC_ERROR is returned. */ cc_rcs_t publish_int_response (pub_rsp_t *pub_rsp_p, cc_srcs_t callback_task, int message_id ) { pub_rsp_t *pmsg; pmsg = (pub_rsp_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } memcpy(pmsg, pub_rsp_p, sizeof(*pmsg)); return sub_send_msg((cprBuffer_t)pmsg, message_id, sizeof(*pmsg), callback_task); }
/* * Function: sub_int_notify_ack() * * Parameters: sub_id - subcription id for sip stack to track the subscription. * response_code - response code to be sent in response to NOTIFY. * cseq : CSeq for which response is being sent. * * Description: posts SIPSPI_EV_CC_NOTIFY_RESPONSE to SIP task message queue. * * Returns: CC_RC_ERROR - failed to post msg. * CC_RC_SUCCESS - successful posted msg. */ cc_rcs_t sub_int_notify_ack (sub_id_t sub_id, uint16_t response_code, uint32_t cseq) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.notify_resp.sub_id = sub_id; pmsg->msg.notify_resp.response_code = response_code; pmsg->msg.notify_resp.cseq = cseq; return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_NOTIFY_RESPONSE, sizeof(*pmsg), CC_SRC_SIP); }
cc_rcs_t sub_int_subscribe_ack (cc_srcs_t src_id, cc_srcs_t dst_id, sub_id_t sub_id, uint16_t response_code, int duration) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.subscribe_resp.response_code = response_code; pmsg->msg.subscribe_resp.sub_id = sub_id; pmsg->msg.subscribe_resp.duration = duration; return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIBE_RESPONSE, sizeof(*pmsg), dst_id); }
/* * Function: sub_int_subscribe_term() * * Parameters: sub_id - subcription id for sip stack to track the subscription. * immediate - boolean flag to indicate if the termination be immediate. * request_id - request id significant for out going subscriptions * event_package - event package type * * Description: posts SIPSPI_EV_CC_SUBSCRIPTION_TERMINATED to SIP task message queue. * * Returns: CC_RC_ERROR - failed to post msg. * CC_RC_SUCCESS - successful posted msg. */ cc_rcs_t sub_int_subscribe_term (sub_id_t sub_id, boolean immediate, int request_id, cc_subscriptions_t event_package) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.subs_term.immediate = immediate; pmsg->msg.subs_term.sub_id = sub_id; pmsg->msg.subs_term.request_id = request_id; pmsg->msg.subs_term.eventPackage = event_package; return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIPTION_TERMINATED, sizeof(*pmsg), CC_SRC_SIP); }
/** * This function will post an event - SUB_MSG_PRESENCE_UNSOLICITED_NOTIFY - to Misc task. * This is invoked by sip task. * * @param[in] msg_data - pointer to ccsip_sub_not_data_t * * @return none * * @pre (msg_data != NULL) */ void pres_unsolicited_notify_ind (ccsip_sub_not_data_t *msg_data) { static const char fname[] = "pres_unsolicited_notify_ind"; ccsip_sub_not_data_t *pmsg; cpr_status_e rc; pmsg = (ccsip_sub_not_data_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { BLF_ERROR(MISC_F_PREFIX"malloc failed", fname); return; } memcpy(pmsg, msg_data, sizeof(*pmsg)); rc = MiscAppTaskSendMsg(SUB_MSG_PRESENCE_UNSOLICITED_NOTIFY, pmsg, sizeof(*pmsg)); if (rc == CPR_FAILURE) { cpr_free(pmsg); } }
cc_rcs_t sub_int_notify (cc_srcs_t src_id, cc_srcs_t dst_id, sub_id_t sub_id, ccsipNotifyResultCallbackFn_t notifyResultCallback, int subsNotResCallbackMsgID, ccsip_event_data_t * eventData, subscriptionState subState) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.notify.eventData = eventData; pmsg->msg.notify.notifyResultCallback = notifyResultCallback; pmsg->msg.notify.sub_id = sub_id; pmsg->msg.notify.subsNotResCallbackMsgID = subsNotResCallbackMsgID; pmsg->msg.notify.subState = subState; return sub_send_msg((cprBuffer_t) pmsg, SIPSPI_EV_CC_NOTIFY, sizeof(*pmsg), dst_id); }