pjproject_bundled: check whether UPDATE is supported on outgoing calls
[asterisk/asterisk.git] / third-party / pjproject / patches / 0010-outgoing_connected_line_method_update.patch
1 diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
2 --- a/pjsip/src/pjsip-ua/sip_inv.c
3 +++ b/pjsip/src/pjsip-ua/sip_inv.c
4 @@ -4185,6 +4185,29 @@
5  
6             if (tsx->status_code != 100) {
7  
8 +               if (inv->role == PJSIP_ROLE_UAC) {
9 +                   pjsip_rx_data *rdata = e->body.tsx_state.src.rdata;
10 +                   pjsip_allow_hdr *allow = NULL;
11 +                   pjsip_msg *msg = rdata->msg_info.msg;
12 +
13 +                   if (msg) {
14 +                       allow = (pjsip_allow_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_ALLOW,
15 +                               NULL);
16 +                   }
17 +                   if (allow) {
18 +                       unsigned i;
19 +                       const pj_str_t STR_UPDATE = { "UPDATE", 6 };
20 +
21 +                       for (i=0; i<allow->count; ++i) {
22 +                           if (pj_stricmp(&allow->values[i], &STR_UPDATE)==0) {
23 +                               /* UPDATE is present in Allow */
24 +                               inv->options |= PJSIP_INV_SUPPORT_UPDATE;
25 +                               break;
26 +                           }
27 +                       }
28 +                   }
29 +               }
30 +
31                 if (dlg->remote.info->tag.slen)
32                     inv_set_state(inv, PJSIP_INV_STATE_EARLY, e);
33