X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=action.cpp;h=3e8ba8b03a49c8e838560fe68e16bd8d68d958a0;hp=b77d9378599181863db3fab0710203a206e0bd47;hb=ef3fc1931a2fa82f482d21fb1296735206463d3a;hpb=2746009aca7e00678ad6f5f64da8b208ab635d60 diff --git a/action.cpp b/action.cpp index b77d937..3e8ba8b 100644 --- a/action.cpp +++ b/action.cpp @@ -67,12 +67,13 @@ char *numberrize_callerinfo(char *string, int ntype) /* - * process init 'internal' / 'external' / 'chan' / 'vbox-record' / 'partyline'... + * process init 'internal' / 'external' / 'asterisk' / 'vbox-record' / 'partyline'... */ -void EndpointAppPBX::_action_init_call(int chan) +void EndpointAppPBX::_action_init_call(int asterisk) { class Call *call; struct port_list *portlist = ea_endpoint->ep_portlist; + struct admin_list *admin; /* a created call, this should never happen */ if (ea_endpoint->ep_call_id) @@ -84,18 +85,29 @@ void EndpointAppPBX::_action_init_call(int chan) /* create call */ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): Creating new call instance.\n", ea_endpoint->ep_serial); - if (chan) - call = new CallChan(ea_endpoint); + if (asterisk) + { + admin = admin_list; + while(admin) + { + if (admin->asterisk) + break; + admin = admin->next; + } + if (!admin) + { + /* resource not available */ + message_disconnect_port(portlist, CAUSE_RESSOURCEUNAVAIL, LOCATION_PRIVATE_LOCAL, ""); + new_state(EPOINT_STATE_OUT_DISCONNECT); + set_tone(portlist,"cause_22"); + return; + } + call = new CallAsterisk(ea_endpoint->ep_serial); + } else call = new CallPBX(ea_endpoint); if (!call) - { - /* resource not available */ - message_disconnect_port(portlist, CAUSE_RESSOURCEUNAVAIL, LOCATION_PRIVATE_LOCAL, ""); - new_state(EPOINT_STATE_OUT_DISCONNECT); - set_tone(portlist,"cause_22"); - return; - } + FATAL("No memoy for Call instance.\n"); ea_endpoint->ep_call_id = call->c_serial; } void EndpointAppPBX::action_init_call(void) @@ -527,19 +539,13 @@ void EndpointAppPBX::action_init_partyline(void) /* create call */ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): Creating new call instance.\n", ea_endpoint->ep_serial); if (!(call = new CallPBX(ea_endpoint))) - { - PERROR("no memory for call, exitting"); - exit(-1); - } + FATAL("No memory for Call object\n"); } else { //NOTE: callpbx must be set here /* add relation to existing call */ if (!(relation=callpbx->add_relation())) - { - PERROR("no memory for call relation, exitting"); - exit(-1); - } + FATAL("No memory for Call relation\n"); relation->type = RELATION_TYPE_SETUP; relation->channel_state = CHANNEL_STATE_CONNECT; relation->rx_state = NOTIFY_STATE_ACTIVE;