int channel = 0;
int earlyb;
int mode = B_MODE_TRANSPARENT;
+ struct admin_list *admin;
/* set bchannel mode */
mode = e_capainfo.source_mode;
port = new Pgsm_ms(PORT_TYPE_GSM_MS_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
else
#endif
+#ifdef WITH_SIP
+ if (mISDNport->ifport->interface->sip)
+ port = new Psip(PORT_TYPE_SIP_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode, mISDNport->ifport->interface);
+ else
+#endif
+ if (mISDNport->ifport->remote) {
+ admin = admin_first;
+ while(admin) {
+ if (admin->remote_name[0] && !strcmp(admin->remote_name, mISDNport->ifport->remote_app))
+ break;
+ admin = admin->next;
+ }
+ if (!admin) {
+ trace_header("INTERFACE (remote not connected)", DIRECTION_NONE);
+ add_trace("application", NULL, "%s", mISDNport->ifport->remote_app);
+ end_trace();
+ continue;
+ }
+ port = new Premote(PORT_TYPE_REMOTE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode, admin->sock);
+ } else
port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
if (!port)
FATAL("Failed to create Port instance\n");
port = new Pgsm_ms(PORT_TYPE_GSM_MS_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
else
#endif
+#ifdef WITH_SIP
+ if (mISDNport->ifport->interface->sip)
+ port = new Psip(PORT_TYPE_SIP_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode, mISDNport->ifport->interface);
+ else
+#endif
+ if (mISDNport->ifport->remote) {
+ admin = admin_first;
+ while(admin) {
+ if (admin->remote_name[0] && !strcmp(admin->remote_name, mISDNport->ifport->remote_app))
+ break;
+ admin = admin->next;
+ }
+ if (!admin) {
+ trace_header("INTERFACE (remote not connected)", DIRECTION_NONE);
+ add_trace("application", NULL, "%s", mISDNport->ifport->remote_app);
+ end_trace();
+ continue;
+ }
+ port = new Premote(PORT_TYPE_REMOTE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode, admin->sock);
+ } else
port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
if (!port)
FATAL("No memory for Port instance\n");
/* other calls with no caller id (or not available for the extension) and force colp */
if ((e_connectinfo.id[0]=='\0' || (e_connectinfo.present==INFO_PRESENT_RESTRICTED && !e_ext.anon_ignore))&& e_ext.colp==COLP_FORCE) {
e_connectinfo.ntype = INFO_NTYPE_NOTPRESENT;
- if (portlist->port_type==PORT_TYPE_DSS1_TE_OUT
- || portlist->port_type==PORT_TYPE_DSS1_NT_OUT
- || portlist->port_type==PORT_TYPE_GSM_BS_OUT
- || portlist->port_type==PORT_TYPE_GSM_MS_OUT) { /* external extension answered */
+ if ((portlist->port_type & PORT_CLASS_DIR_MASK) == PORT_CLASS_DIR_OUT) {
+ /* external extension answered */
port = find_port_id(portlist->port_id);
if (port) {
SCPY(e_connectinfo.id, nationalize_callerinfo(port->p_dialinginfo.id, &e_connectinfo.ntype, options.national, options.international));
// PDEBUG(DEBUG_EPOINT, "received message %d (terminal %s, caller id %s)\n", message, e_ext.number, e_callerinfo.id);
switch(message_type) {
- case MESSAGE_DATA: /* data from port */
- /* check if there is a call */
- if (!ea_endpoint->ep_join_id)
- break;
- /* continue if only one portlist */
- if (ea_endpoint->ep_portlist->next != NULL)
- break;
- /* forward message */
- message_forward(ea_endpoint->ep_serial, ea_endpoint->ep_join_id, EPOINT_TO_JOIN, param);
- break;
-
case MESSAGE_TONE_EOF: /* tone is end of file */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) current tone is now end of file.\n", ea_endpoint->ep_serial);
if (e_action) {
}
}
+/* join MESSAGE_BRIDE */
+void EndpointAppPBX::join_bridge(struct port_list *portlist, int message_type, union parameter *param)
+{
+ struct lcr_msg *message;
+
+ while(portlist) {
+ message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_BRIDGE);
+ memcpy(&message->param, param, sizeof(union parameter));
+ message_put(message);
+ portlist = portlist->next;
+ }
+}
+
/* join MESSAGE_NOTIFY */
void EndpointAppPBX::join_notify(struct port_list *portlist, int message_type, union parameter *param)
{
portlist = ea_endpoint->ep_portlist;
- /* send MESSAGE_DATA to port */
- if (message_type == MESSAGE_DATA) {
- if (join_id == ea_endpoint->ep_join_id) { // still linked with JOIN
- /* skip if no port relation */
- if (!portlist)
- return;
- /* skip if more than one port relation */
- if (portlist->next)
- return;
- /* forward audio data to port */
- message_forward(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, param);
- return;
- }
- }
-
// PDEBUG(DEBUG_EPOINT, "EPOINT(%d) received message %d for active JOIN (terminal %s, caller id %s state=%d)\n", ea_endpoint->ep_serial, message, e_ext.number, e_callerinfo.id, e_state);
switch(message_type) {
/* JOIN SENDS TONE message */
join_mISDNsignal(portlist, message_type, param);
break;
-#if 0
- kann nach dem test gelöscht werden, da eine direkte funktion im join und im mISDN zum austausch der message existiert
- /* JOIN requests bchannel */
- case MESSAGE_BCHANNEL: /* indicates the need of own bchannel access */
- PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received bchannel assignment %d from join.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, param->bchannel.type);
- /* only one port is expected to be connected to bchannel */
- if (!portlist)
- break;
- if (portlist->next)
- break;
- e_join_pattern = 1;
- SCPY(e_tone, "");
- set_tone(portlist, NULL);
- message = message_forward(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, param);
- logmessage(message->type, &message->param, portlist->port_id, DIRECTION_OUT);
+ /* JOIN sends bridge message */
+ case MESSAGE_BRIDGE: /* bride message to port */
+ PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received bridge message.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id);
+ join_bridge(portlist, message_type, param);
break;
-#endif
/* JOIN has pattern available */
case MESSAGE_PATTERN: /* indicating pattern available */
while(42) {
/* eliminate white spaces */
- while (*list <= ' ')
+ while (*list > '\0' && *list <= ' ')
list++;
if (*list == ',') {
list++;
break;
}
}
- if ((port->p_type==PORT_TYPE_DSS1_NT_OUT
- || port->p_type==PORT_TYPE_DSS1_TE_OUT
- || port->p_type==PORT_TYPE_GSM_BS_OUT
- || port->p_type==PORT_TYPE_GSM_MS_OUT)
+ if ((portlist->port_type & PORT_CLASS_DIR_MASK) == PORT_CLASS_DIR_OUT
&& port->p_state==PORT_STATE_OUT_ALERTING)
if (match_list(extensions, eapp->e_ext.number)) {
found = eapp;