Delete full call if only one branch is left.

git.mgm/mediaproxy-ng/2.0
Andreas Granig 14 years ago
parent 542a171bb4
commit 24e2a02f9f

@ -1445,21 +1445,27 @@ char *call_delete_udp(const char **out, struct callmaster *m) {
goto err; goto err;
if(out[RE_UDP_D_VIABRANCH]) { if(out[RE_UDP_D_VIABRANCH]) {
/* only delete selective branch */ /* search given branch */
while(c) { while(c) {
next = c->next; next = c->next;
if(g_strcmp0(out[RE_UDP_D_VIABRANCH], c->viabranch) == 0) { if(g_strcmp0(out[RE_UDP_D_VIABRANCH], c->viabranch) == 0) {
mylog(LOG_INFO, "[%s - %s] Deleting selective call branch", if(!c->prev && !c->next) {
c->callid, VIA2STR(c->viabranch)); mylog(LOG_INFO, "[%s - %s] Deleting full call because there is only one branch",
if(c->prev) c->callid, VIA2STR(c->viabranch));
c->prev->next = c->next; call_destroy_all_branches(c);
call_destroy(c); } else {
mylog(LOG_INFO, "[%s - %s] Deleting selective call branch",
c->callid, VIA2STR(c->viabranch));
if(c->prev)
c->prev->next = c->next;
call_destroy(c);
}
break; break;
} }
c = next; c = next;
} }
} else { } else {
mylog(LOG_INFO, "[%s] Deleting all call branches", c->callid); mylog(LOG_INFO, "[%s] Deleting full call", c->callid);
call_destroy_all_branches(c); call_destroy_all_branches(c);
} }

Loading…
Cancel
Save