call: Create a call with a SIP leg

Clone the MNCC code and create a call with a SIP leg.
This commit is contained in:
Holger Hans Peter Freyther 2016-03-26 19:51:33 +01:00
parent 586abf9f0f
commit b723cceee9
2 changed files with 25 additions and 0 deletions

View File

@ -79,6 +79,30 @@ struct call *call_mncc_create(void)
return call; return call;
} }
struct call *call_sip_create(void)
{
struct call *call;
call = talloc_zero(tall_mncc_ctx, struct call);
if (!call) {
LOGP(DCALL, LOGL_ERROR, "Failed to allocate memory for call\n");
return NULL;
}
call->id = ++last_call_id;
call->initial = (struct call_leg *) talloc_zero(call, struct sip_call_leg);
if (!call->initial) {
LOGP(DCALL, LOGL_ERROR, "Failed to allocate SIP leg\n");
talloc_free(call);
return NULL;
}
call->initial->type = CALL_TYPE_SIP;
call->initial->call = call;
llist_add(&call->entry, &g_call_list);
return call;
}
struct call_leg *call_leg_other(struct call_leg *leg) struct call_leg *call_leg_other(struct call_leg *leg)
{ {
if (leg->call->initial == leg) if (leg->call->initial == leg)

View File

@ -120,3 +120,4 @@ void call_leg_release(struct call_leg *leg);
struct call *call_mncc_create(void); struct call *call_mncc_create(void);
struct call *call_sip_create(void);