Retro
Retro

Reputation: 4005

How to get pjsip iOS API call status like busy, ringing or not available

I am able to integrate and connect the pjsip into iOS but I want to get different status during and initializations of call like busy, ringing and un reachable. For creating the call I am using this code

void makeCall(char* destUri)
{
    pj_status_t status;
    pj_str_t uri = pj_str(destUri);

    status = pjsua_call_make_call(acc_id, &uri, 0, NULL, NULL, NULL);
    if (status != PJ_SUCCESS) error_exit("Error making call", status);
} 

but I didt find any where how to get the different call status..

Upvotes: 2

Views: 1631

Answers (1)

Retro
Retro

Reputation: 4005

It's simple but confusing procedure

have a static method

static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata);

and into your pjusa_config set this like

// Init the config structure
        pjsua_config cfg;
        cfg.cb.on_call_state = &on_call_state;

then you will get callback here

/* Callback called by the library when call's state has changed */
static void on_call_state(pjsua_call_id call_id, pjsip_event *e)
{
    pjsua_call_info ci;

    PJ_UNUSED_ARG(e);

    pjsua_call_get_info(call_id, &ci);
    PJ_LOG(3,(THIS_FILE, "******* ***** Call %d state=%.*s", call_id,
              (int)ci.state_text.slen,
              ci.state_text.ptr));
}

Upvotes: 3

Related Questions