if (tech_pvt->local_url) {
switch_channel_set_variable(nchannel, "sip_local_url", tech_pvt->local_url);
if (profile->pres_type) {
- switch_channel_set_variable(nchannel, "presence_id", tech_pvt->local_url);
+ const char *presence_id = switch_channel_get_variable(nchannel, "presence_id");
+ if (zstr(presence_id)) {
+ switch_channel_set_variable(nchannel, "presence_id", tech_pvt->local_url);
+ }
}
}
switch_channel_set_variable(nchannel, "sip_destination_url", tech_pvt->dest);
}
if (profile->pres_type) {
- const char *user = switch_str_nil(sip->sip_from->a_url->url_user);
- const char *host = switch_str_nil(sip->sip_from->a_url->url_host);
-
- char *tmp = switch_mprintf("%s@%s", user, host);
- switch_assert(tmp);
- switch_channel_set_variable(channel, "presence_id", tmp);
- free(tmp);
+ const char *presence_id = switch_channel_get_variable(channel, "presence_id");
+ if (zstr(presence_id)) {
+ const char *user = switch_str_nil(sip->sip_from->a_url->url_user);
+ const char *host = switch_str_nil(sip->sip_from->a_url->url_host);
+ char *tmp = switch_mprintf("%s@%s", user, host);
+ switch_assert(tmp);
+ switch_channel_set_variable(channel, "presence_id", tmp);
+ free(tmp);
+ }
}