TT#89352 allow create-only mode for call_get_*

Change-Id: I4dd760b14ef1c91d463a2390ff3c52d71acedf4a
pull/1311/head
Richard Fuchs 4 years ago
parent 765b1e3bca
commit 5c519ec2db

@ -3100,7 +3100,7 @@ static struct call *call_create(const str *callid) {
}
/* returns call with master_lock held in W */
struct call *call_get_or_create(const str *callid, bool foreign) {
struct call *call_get_or_create(const str *callid, bool foreign, bool exclusive) {
struct call *c;
restart:
@ -3157,12 +3157,17 @@ restart:
mqtt_timer_start(&c->mqtt_timer, c, NULL);
}
else {
obj_hold(c);
rwlock_lock_w(&c->master_lock);
if (exclusive)
c = NULL;
else {
obj_hold(c);
rwlock_lock_w(&c->master_lock);
}
rwlock_unlock_r(&rtpe_callhash_lock);
}
log_info_call(c);
if (c)
log_info_call(c);
return c;
}
@ -3188,7 +3193,7 @@ struct call *call_get(const str *callid) {
/* returns call with master_lock held in W, or possibly NULL iff opmode == OP_ANSWER */
struct call *call_get_opmode(const str *callid, enum call_opmode opmode) {
if (opmode == OP_OFFER)
return call_get_or_create(callid, false);
return call_get_or_create(callid, false, false);
return call_get(callid);
}

@ -1401,7 +1401,7 @@ static const char *call_offer_answer_ng(struct ng_buffer *ngbuf, bencode_item_t
goto out;
}
call = call_get_or_create(&flags.call_id, false);
call = call_get_or_create(&flags.call_id, false, false);
}
errstr = "Unknown call-id";

@ -1826,7 +1826,7 @@ static void json_restore_call(struct redis *r, const str *callid, bool foreign)
if (!root_reader)
goto err1;
c = call_get_or_create(callid, foreign);
c = call_get_or_create(callid, foreign, false);
err = "failed to create call struct";
if (!c)
goto err1;

@ -536,7 +536,7 @@ void free_sink_handler(void *);
void __add_sink_handler(GQueue *, struct packet_stream *);
struct call *call_get_or_create(const str *callid, bool foreign);
struct call *call_get_or_create(const str *callid, bool foreign, bool exclusive);
struct call *call_get_opmode(const str *callid, enum call_opmode opmode);
void call_make_own_foreign(struct call *c, bool foreign);
int call_get_mono_dialogue(struct call_monologue *dialogue[2], struct call *call, const str *fromtag,

Loading…
Cancel
Save