/*
 *  Function: pres_create_retry_after_timers()
 *
 *  Parameters: void
 *
 *  Description:  creates retry-after timers equivalant to the number of line buttons.
 *
 *  Returns: CPR_SUCCESS/CPR_FAILURE
 */
cpr_status_e
pres_create_retry_after_timers (void)
{
    int i;
    int j;

    /*
     * Create retry-after timers.
     */
    for (i = 0; i < MAX_REG_LINES; i++) {
        s_retry_after_timers[i] =
            cprCreateTimer("Presence/BLF Retry After Timer",
                           PRES_RETRYAFTER_TIMER, TIMER_EXPIRATION,
                           s_misc_msg_queue);
        if (!s_retry_after_timers[i]) {
            /*
             *  destroy/free the already created timers.
             */
            for (j = 0; j < i; j++) {
                (void) cprDestroyTimer(s_retry_after_timers[j]);
                s_retry_after_timers[j] = NULL;
            }
            return CPR_FAILURE;
        }
    }
    return CPR_SUCCESS;
}
Beispiel #2
0
/*
 *  Function: dp_init()
 *
 *  Parameters: gsmMsgQueue - the msg queue for the GSM task. Used
 *                  to tell CPR where to send the timer expiration
 *                  msgs for the dialplan timer.
 *
 *  Description: Initialize dialplan and KPML
 *
 *
 *  Returns: none
 */
void
dp_init (void *gsmMsgQueue)
{

    g_dp_int.dial_timer =
        cprCreateTimer("dial_timeout", GSM_DIAL_TIMEOUT_TIMER, TIMER_EXPIRATION,
                       (cprMsgQueue_t) gsmMsgQueue);

}
Beispiel #3
0
/**
 * This function will create a PCB. It will also create the PCB linked list.
 *
 * @return  NULL if there are no resources to create a PCB.
 *          Otherwise,  pointer to a new PCB is returned.
 *
 *  @pre     (key != NULL) and (data != NULL)
 */
static ccsip_publish_cb_t *get_new_pcb (void)
{
    ccsip_publish_cb_t *pcb_p;

    /*
     * If PCB list is not created yet, create the list.
     */
    if (s_PCB_list == NULL) {
        s_PCB_list = sll_create(is_matching_pcb);
        if (s_PCB_list == NULL) {
            return NULL;
        }
    }

    pcb_p = (ccsip_publish_cb_t *)cpr_malloc(sizeof(ccsip_publish_cb_t));
    if (pcb_p == NULL) {
        return NULL;
    }
    memset(pcb_p, 0, sizeof(ccsip_publish_cb_t));
    pcb_p->pub_handle = generate_new_pub_handle();
    pcb_p->hb.cb_type = PUBLISH_CB;
    pcb_p->hb.dn_line = 1; // for now set it to primary line. This will change when we do line based PUBLISH.
    /*
     * set up dest & src ip addr and port number.
     */
    ccsip_common_util_set_dest_ipaddr_port(&pcb_p->hb);
    ccsip_common_util_set_src_ipaddr(&pcb_p->hb);
    pcb_p->hb.local_port = sipTransportGetListenPort(pcb_p->hb.dn_line, NULL);
    pcb_p->retry_timer.timer = cprCreateTimer("PUBLISH retry timer",
                                              SIP_PUBLISH_RETRY_TIMER,
                                              TIMER_EXPIRATION,
                                              sip_msgq);
    if (pcb_p->retry_timer.timer == NULL) {
        cpr_free(pcb_p);
        return NULL;
    }
    pcb_p->pending_reqs = sll_create(NULL);
    if (pcb_p->pending_reqs == NULL) {
        (void)cprDestroyTimer(pcb_p->retry_timer.timer);
        cpr_free(pcb_p);
        return NULL;
    }
    (void) sll_append(s_PCB_list, pcb_p);

    return pcb_p;
}
Beispiel #4
0
static boolean
fsm_init_cac_failure_timer(cac_data_t *cac_data, uint32_t timeout)
{
    const char fname[] = "fsm_init_cac_failure_timer";

    CAC_DEBUG(DEB_F_PREFIX"cac_data call_id=%x",
              DEB_F_PREFIX_ARGS("CAC", fname),
              cac_data->call_id);

    cac_data->cac_fail_timer =
        cprCreateTimer("CAC failure timer", GSM_CAC_FAILURE_TIMER, TIMER_EXPIRATION,
                       gsm_msgq);

    if (cac_data->cac_fail_timer == NULL) {
        CAC_ERROR(DEB_F_PREFIX"CAC Timer allocation failed.",
                                    DEB_F_PREFIX_ARGS("CAC", fname));
        return(FALSE);
    }

    (void) cprStartTimer(cac_data->cac_fail_timer, timeout * 1000,
                         (void *)(long)cac_data->call_id);

    return(TRUE);
}
int
sip_platform_timers_init (void)
{
    static const char fname[] = "sip_platform_timers_init";
    static const char sipMsgTimerName[] = "sipMsg";
    static const char sipExpireTimerName[] = "sipExp";
    static const char sipRegTimeOutTimerName[] = "sipRegTimeout";
    static const char sipRegExpireTimerName[] = "sipRegExp";
    static const char sipLocalExpireTimerName[] = "sipLocalExp";
    static const char sipSupervisionTimerName[] = "sipSupervision";
    static const char sipSubNotTimerName[] = "sipSubNot";
    static const char sipSubNotPeriodicTimerName[] = "sipSubNotPeriodic";
    static const char sipRegAllFailedTimerName[] = "sipRegAllFailed";
    static const char sipNotifyTimerName[] = "sipNotify";
    static const char sipStandbyKeepaliveTimerName[] = "sipStandbyKeepalive";
    static const char sipUnregistrationTimerName[] = "sipUnregistration";
	static const char sipPassThroughTimerName[] = "sipPassThrough";

    int i;

    for (i = 0; i < MAX_CCBS; i++) {
        sipPlatformUISMTimers[i].timer =
            cprCreateTimer(sipMsgTimerName,
                           SIP_MSG_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);

        sipPlatformUISMTimers[i].reg_timer =
            cprCreateTimer(sipRegTimeOutTimerName,
                           SIP_REG_TIMEOUT_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);

        sipPlatformUISMExpiresTimers[i].timer =
            cprCreateTimer(sipExpireTimerName,
                           SIP_EXPIRES_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);

        sipPlatformUISMRegExpiresTimers[i].timer =
            cprCreateTimer(sipRegExpireTimerName,
                           SIP_REG_EXPIRES_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);

        sipPlatformUISMLocalExpiresTimers[i].timer =
            cprCreateTimer(sipLocalExpireTimerName,
                           SIP_LOCAL_EXPIRES_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);

        if (!sipPlatformUISMTimers[i].timer ||
            !sipPlatformUISMTimers[i].reg_timer ||
            !sipPlatformUISMExpiresTimers[i].timer ||
            !sipPlatformUISMRegExpiresTimers[i].timer ||
            !sipPlatformUISMLocalExpiresTimers[i].timer) {
            CCSIP_DEBUG_ERROR(SIP_F_PREFIX
                              "Failed to create one or more"
                              " UISM timers: %d\n", fname, i);
            return SIP_ERROR;
        }
    }
    for (i = 0; i < MAX_TEL_LINES; i++) {
        sipPlatformSupervisionTimers[i].timer =
            cprCreateTimer(sipSupervisionTimerName,
                           SIP_SUPERVISION_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);
    }
    for (i = 0; i < MAX_SCBS; i++) {
        sipPlatformUISMSubNotTimers[i].timer =
            cprCreateTimer(sipSubNotTimerName,
                           SIP_SUBNOT_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);

        if (!sipPlatformUISMSubNotTimers[i].timer) {
            CCSIP_DEBUG_ERROR(SIP_F_PREFIX
                              "Failed to create Sub/Not"
                              " UISM timers: %d\n", fname, i);
            return SIP_ERROR;
        }
    }
    sipPlatformSubNotPeriodicTimer.timer =
        cprCreateTimer(sipSubNotPeriodicTimerName,
                       SIP_SUBNOT_PERIODIC_TIMER,
                       TIMER_EXPIRATION,
                       sip_msgq);

    if (!sipPlatformSubNotPeriodicTimer.timer) {
        CCSIP_DEBUG_ERROR(SIP_F_PREFIX
                          "Failed to create supervision timer: %d\n",
                          fname, i);
        return SIP_ERROR;
    }

    sipPlatformRegAllFailedTimer =
        cprCreateTimer(sipRegAllFailedTimerName,
                       SIP_REGALLFAIL_TIMER,
                       TIMER_EXPIRATION,
                       sip_msgq);
    if (!sipPlatformRegAllFailedTimer) {
        CCSIP_DEBUG_ERROR(SIP_F_PREFIX
                          "Failed to create RegAllFailed timer\n", fname);
        return SIP_ERROR;
    }
    /*
     * Create the standby cc keepalive timer used by the
     * registration Manager.
     */
    sipPlatformStandbyKeepaliveTimer =
            cprCreateTimer(sipStandbyKeepaliveTimerName,
                           SIP_KEEPALIVE_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);

    if (!sipPlatformStandbyKeepaliveTimer) {
        CCSIP_DEBUG_ERROR(SIP_F_PREFIX
                          "Failed to create Standby"
                          " keepalive timer\n", fname);
        return SIP_ERROR;
    }
    sipPlatformUnRegistrationTimer =
            cprCreateTimer(sipUnregistrationTimerName,
                           SIP_UNREGISTRATION_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);
    if (!sipPlatformUnRegistrationTimer) {
        CCSIP_DEBUG_ERROR(SIP_F_PREFIX
                          "Failed to create Stanby keepalive timer\n",
                          fname);
        return SIP_ERROR;
    }
    sipPlatformNotifyTimer =
            cprCreateTimer(sipNotifyTimerName,
                           SIP_NOTIFY_TIMER,
                           TIMER_EXPIRATION,
                           sip_msgq);
    if (!sipPlatformNotifyTimer) {
        CCSIP_DEBUG_ERROR(SIP_F_PREFIX
                          "Failed to create Notify timer\n", fname);
        return SIP_ERROR;
    }

	sipPassThroughTimer =
		cprCreateTimer(sipPassThroughTimerName,
					   SIP_PASSTHROUGH_TIMER,
					   TIMER_EXPIRATION,
					   sip_msgq);
	if (!sipPassThroughTimer) {
		CCSIP_DEBUG_ERROR("%s: failed to create sip PassThrough timer\n", fname);
		return SIP_ERROR;
	}

    return SIP_OK;
}