... | ... |
@@ -123,6 +123,13 @@ int core2strar(struct sip_msg *req, str *c_vals, int *i_vals, char *t_vals) |
123 | 123 |
t_vals[2] = TYPE_NULL; |
124 | 124 |
} |
125 | 125 |
|
126 |
+ LM_DBG("default - totag[%.*s]\n", c_vals[2].len, c_vals[2].s); |
|
127 |
+ if (c_vals[2].len == 0 && acc_env.to_tag.s && acc_env.to_tag.len > 0) { |
|
128 |
+ LM_DBG("extra [%p] totag[%.*s]\n", acc_env.to_tag.s, acc_env.to_tag.len, acc_env.to_tag.s); |
|
129 |
+ c_vals[2].len = acc_env.to_tag.len; |
|
130 |
+ c_vals[2].s = acc_env.to_tag.s; |
|
131 |
+ } |
|
132 |
+ |
|
126 | 133 |
/* Callid */ |
127 | 134 |
if (req->callid && req->callid->body.len) { |
128 | 135 |
c_vals[3] = req->callid->body; |
... | ... |
@@ -79,8 +79,7 @@ struct acc_enviroment acc_env; |
79 | 79 |
static void tmcb_func( struct cell* t, int type, struct tmcb_params *ps ); |
80 | 80 |
|
81 | 81 |
|
82 |
-static inline struct hdr_field* get_rpl_to( struct cell *t, |
|
83 |
- struct sip_msg *reply) |
|
82 |
+static inline struct hdr_field* get_rpl_to( struct cell *t, struct sip_msg *reply) |
|
84 | 83 |
{ |
85 | 84 |
if (reply==FAKED_REPLY || !reply || !reply->to) |
86 | 85 |
return t->uas.request->to; |
... | ... |
@@ -88,13 +87,17 @@ static inline struct hdr_field* get_rpl_to( struct cell *t, |
88 | 87 |
return reply->to; |
89 | 88 |
} |
90 | 89 |
|
90 |
+void env_set_totag(struct cell *t, struct sip_msg *reply) |
|
91 |
+{ |
|
92 |
+ if (reply==FAKED_REPLY || !reply || !reply->to) |
|
93 |
+ tmb.t_get_reply_totag(t->uas.request, &acc_env.to_tag); |
|
94 |
+} |
|
91 | 95 |
|
92 | 96 |
static inline void env_set_to(struct hdr_field *to) |
93 | 97 |
{ |
94 | 98 |
acc_env.to = to; |
95 | 99 |
} |
96 | 100 |
|
97 |
- |
|
98 | 101 |
static inline void env_set_text(char *p, int len) |
99 | 102 |
{ |
100 | 103 |
acc_env.text.s = p; |
... | ... |
@@ -493,7 +496,9 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, |
493 | 496 |
|
494 | 497 |
/* set env variables */ |
495 | 498 |
env_set_to( get_rpl_to(t,reply) ); |
496 |
- env_set_code_status( code, reply); |
|
499 |
+ env_set_code_status(code, reply); |
|
500 |
+ /* for missed calls, we make sure to include the totag if it is locally generated */ |
|
501 |
+ env_set_totag(t, reply); |
|
497 | 502 |
|
498 | 503 |
/* we report on missed calls when the first |
499 | 504 |
* forwarding attempt fails; we do not wish to |
... | ... |
@@ -512,7 +517,6 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, |
512 | 517 |
acc_db_request( req ); |
513 | 518 |
flags_to_reset |= 1 << db_missed_flag; |
514 | 519 |
} |
515 |
- |
|
516 | 520 |
/* run extra acc engines */ |
517 | 521 |
acc_run_engines(req, 1, &flags_to_reset); |
518 | 522 |
|