forked from VoiSmart/pjsip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch-pjsip.patch
103 lines (96 loc) · 3.89 KB
/
patch-pjsip.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
diff -ruN pjproject/pjsip/include/pjsip-ua/sip_regc.h ./pjsip/include/pjsip-ua/sip_regc.h
--- pjproject/pjsip/include/pjsip-ua/sip_regc.h 2016-06-24 15:03:25.000000000 +0200
+++ ./pjsip/include/pjsip-ua/sip_regc.h 2019-01-14 12:22:30.000000000 +0100
@@ -205,7 +205,8 @@
const pj_str_t *to_url,
int ccnt,
const pj_str_t contact[],
- pj_uint32_t expires);
+ pj_uint32_t expires,
+ const pj_str_t *cid);
/**
* Set callback to be called when the registration received a final response.
diff -ruN pjproject/pjsip/include/pjsua-lib/pjsua.h ./pjsip/include/pjsua-lib/pjsua.h
--- pjproject/pjsip/include/pjsua-lib/pjsua.h 2016-12-06 12:23:39.000000000 +0100
+++ ./pjsip/include/pjsua-lib/pjsua.h 2019-01-14 12:22:30.000000000 +0100
@@ -2939,6 +2939,14 @@
pj_str_t id;
/**
+ * The Call ID used in REGISTER. If the value is empty, a random generated
+ * value will be used.
+ *
+ * This field is optional.
+ */
+ pj_str_t call_id;
+
+ /**
* This is the URL to be put in the request URI for the registration,
* and will look something like "sip:serviceprovider".
*
diff -ruN pjproject/pjsip/src/pjsip-ua/sip_reg.c ./pjsip/src/pjsip-ua/sip_reg.c
--- pjproject/pjsip/src/pjsip-ua/sip_reg.c 2016-06-30 10:23:08.000000000 +0200
+++ ./pjsip/src/pjsip-ua/sip_reg.c 2019-02-08 11:16:09.000000000 +0100
@@ -334,7 +334,8 @@
const pj_str_t *to_url,
int contact_cnt,
const pj_str_t contact[],
- pj_uint32_t expires)
+ pj_uint32_t expires,
+ const pj_str_t *cid)
{
pj_str_t tmp;
pj_status_t status;
@@ -386,8 +387,12 @@
/* Set "Call-ID" header. */
regc->cid_hdr = pjsip_cid_hdr_create(regc->pool);
- pj_create_unique_string(regc->pool, ®c->cid_hdr->id);
-
+ if (cid->slen > 0){
+ pj_strdup_with_null(regc->pool, ®c->cid_hdr->id, cid);
+ PJ_LOG(4,(THIS_FILE, "regc: callID %.*s", regc->cid_hdr->id.slen, regc->cid_hdr->id.ptr));
+ }else {
+ pj_create_unique_string(regc->pool, ®c->cid_hdr->id);
+ }
/* Set "CSeq" header. */
regc->cseq_hdr = pjsip_cseq_hdr_create(regc->pool);
regc->cseq_hdr->cseq = pj_rand() % 0xFFFF;
diff -ruN pjproject/pjsip/src/pjsua-lib/pjsua_acc.c ./pjsip/src/pjsua-lib/pjsua_acc.c
--- pjproject/pjsip/src/pjsua-lib/pjsua_acc.c 2017-01-19 11:31:38.000000000 +0100
+++ ./pjsip/src/pjsua-lib/pjsua_acc.c 2019-02-08 12:31:53.000000000 +0100
@@ -96,6 +96,7 @@
pj_strdup_with_null(pool, &dst->rfc5626_instance_id,
&src->rfc5626_instance_id);
pj_strdup_with_null(pool, &dst->rfc5626_reg_id, &src->rfc5626_reg_id);
+ pj_strdup_with_null(pool, &dst->call_id, &src->call_id);
dst->proxy_cnt = src->proxy_cnt;
for (i=0; i<src->proxy_cnt; ++i)
@@ -430,7 +431,7 @@
if (acc->pool)
pj_pool_reset(acc->pool);
else
- acc->pool = pjsua_pool_create("acc%p", 512, 256);
+ acc->pool = pjsua_pool_create("acc%p", 1024, 256);
/* Copy config */
pjsua_acc_config_dup(acc->pool, &pjsua_var.acc[id].cfg, cfg);
@@ -2399,7 +2400,9 @@
&acc->cfg.id,
&acc->cfg.id,
1, &acc->reg_contact,
- acc->cfg.reg_timeout);
+ acc->cfg.reg_timeout,
+ &acc->cfg.call_id);
+
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE,
"Client registration initialization error",
diff -ruN pjproject/pjsip/src/pjsua-lib/pjsua_core.c ./pjsip/src/pjsua-lib/pjsua_core.c
--- pjproject/pjsip/src/pjsua-lib/pjsua_core.c 2016-10-06 11:48:10.000000000 +0200
+++ ./pjsip/src/pjsua-lib/pjsua_core.c 2019-02-08 11:25:59.000000000 +0100
@@ -258,7 +258,7 @@
pjsua_media_config med_cfg;
pj_bzero(cfg, sizeof(*cfg));
-
+ cfg->call_id = pj_str("");
cfg->reg_timeout = PJSUA_REG_INTERVAL;
cfg->reg_delay_before_refresh = PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH;
cfg->unreg_timeout = PJSUA_UNREG_TIMEOUT;