Skip to content

Commit

Permalink
b2b_sdp_demux: treat case when downstream terminates
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed May 13, 2022
1 parent 8bfb18f commit b187650
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions modules/b2b_sdp_demux/b2b_sdp_demux.c
Expand Up @@ -848,14 +848,30 @@ static int b2b_sdp_client_notify(struct sip_msg *msg, str *key, int type, void *

static int b2b_sdp_server_notify(struct sip_msg *msg, str *key, int type, void *param)
{
int code = 0;
struct b2b_sdp_ctx *ctx = *(struct b2b_sdp_ctx **)((str *)param)->s;
if (!ctx) {
LM_ERR("No b2b sdp context!\n");
return -1;
}
if (type == B2B_REQUEST) {
if (msg->REQ_METHOD == METHOD_ACK)
return 0;
switch (msg->REQ_METHOD) {
case METHOD_ACK:
return 0;
case METHOD_BYE:
lock_get(&ctx->lock);
if (ctx->pending_no) {
LM_INFO("we still have pending clients!\n");
code = 491;
} else {
code = 200;
}
lock_release(&ctx->lock);
b2b_sdp_reply(&ctx->b2b_key, B2B_SERVER, msg->REQ_METHOD, code, NULL);
if (code == 200)
b2b_sdp_ctx_free(ctx);
return 0;
}
}
LM_ERR("TODO: NOT implemented yet %d\n", type);
return -1;
Expand Down

0 comments on commit b187650

Please sign in to comment.