I am working on with pjsip for iOS, I have configured the pjsip and able to register and reregister for specific time interval, but there is a scenario where I want to change the pjsip account details at the time of re register with new details but I havent found anything on google which can guide how to change it.
If someone have a idea about this please guide me through how to change the pjsua_acc_config
details at time of re registration, I get the method call at the time of re registration.
static void on_reg_state2(pjsua_acc_id acc_id, pjsua_reg_info *info) {
PJ_LOG(3,(__FILE__, "%s: Account %d Reason %.*s Status %d code %d CurrentOp %d",
__FUNCTION__, acc_id, info->cbparam->reason.slen, info->cbparam->reason.ptr,
info->cbparam->status,info->cbparam->code, info->cbparam->regc));
}
get account configuration for account id, and set the fields to whatever required in on_reg_state2 function.
if (pjsua_acc_is_valid(acc_id))
{
pjsua_acc_set_default(acc_id);
pjsua_acc_config acc_cfg;
pj_status_t status;
pjsua_acc_config_default(&acc_cfg);
acc_cfg.id = pj_str(id);
acc_cfg.reg_uri = pj_str(registrar);
acc_cfg.cred_count = 1;
acc_cfg.cred_info[0].scheme = pj_str("Digest");
acc_cfg.cred_info[0].realm = pj_str(realm);
acc_cfg.cred_info[0].username = pj_str(uname);
acc_cfg.cred_info[0].data_type = 0;
acc_cfg.cred_info[0].data = pj_str(passwd);
acc_cfg.publish_enabled = PJ_TRUE;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With