X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=remote.cpp;h=fc28a59544ca4cf08dfbc5e4b0565ac12c307316;hp=81268b5207c10049980c61b2dce38da303f747c2;hb=d19b20fa4e130683b9b5c088019f5988e6b8e19b;hpb=240562640f51eb85e8c0d1062611028140b04e52 diff --git a/remote.cpp b/remote.cpp index 81268b5..fc28a59 100644 --- a/remote.cpp +++ b/remote.cpp @@ -16,14 +16,13 @@ unsigned int new_remote = 1000; /* * constructor */ -Premote::Premote(int type, char *portname, struct port_settings *settings, struct interface *interface, int remote_id) : Port(type, portname, settings) +Premote::Premote(int type, char *portname, struct port_settings *settings, struct interface *interface, int remote_id) : Port(type, portname, settings, interface) { union parameter param; p_callerinfo.itype = (interface->extension)?INFO_ITYPE_ISDN_EXTENSION:INFO_ITYPE_ISDN; p_r_ref = new_remote++; SCPY(p_r_remote_app, interface->remote_app); - SCPY(p_r_interface_name, interface->name); p_r_tones = (interface->is_tones == IS_YES); /* send new ref to remote socket */ @@ -59,9 +58,9 @@ int Premote::message_epoint(unsigned int epoint_id, int message_type, union para switch (message_type) { case MESSAGE_SETUP: struct interface *interface; - interface = getinterfacebyname(p_r_interface_name); + interface = getinterfacebyname(p_interface_name); if (!interface) { - PERROR("Cannot find interface %s.\n", p_r_interface_name); + PERROR("Cannot find interface %s.\n", p_interface_name); return 0; } /* attach only if not already */ @@ -81,6 +80,16 @@ int Premote::message_epoint(unsigned int epoint_id, int message_type, union para else SCPY(param->setup.dialinginfo.context, "lcr"); } + memcpy(&p_dialinginfo, ¶m->setup.dialinginfo, sizeof(p_dialinginfo)); + memcpy(&p_capainfo, ¶m->setup.capainfo, sizeof(p_capainfo)); + memcpy(&p_callerinfo, ¶m->setup.callerinfo, sizeof(p_callerinfo)); + memcpy(&p_redirinfo, ¶m->setup.redirinfo, sizeof(p_redirinfo)); + /* screen */ + do_screen(1, p_callerinfo.id, sizeof(p_callerinfo.id), &p_callerinfo.ntype, &p_callerinfo.present, p_interface_name); + do_screen(1, p_callerinfo.id2, sizeof(p_callerinfo.id2), &p_callerinfo.ntype2, &p_callerinfo.present2, p_interface_name); + do_screen(1, p_redirinfo.id, sizeof(p_redirinfo.id), &p_redirinfo.ntype, &p_redirinfo.present, p_interface_name); + memcpy(¶m->setup.callerinfo, &p_callerinfo, sizeof(p_callerinfo)); + memcpy(¶m->setup.redirinfo, &p_redirinfo, sizeof(p_redirinfo)); new_state(PORT_STATE_OUT_SETUP); break; @@ -94,6 +103,7 @@ int Premote::message_epoint(unsigned int epoint_id, int message_type, union para break; case MESSAGE_CONNECT: + memcpy(&p_connectinfo, ¶m->connectinfo, sizeof(p_connectinfo)); new_state(PORT_STATE_CONNECT); break; @@ -130,12 +140,16 @@ void Premote::message_remote(int message_type, union parameter *param) switch (message_type) { case MESSAGE_TRAFFIC: bridge_tx(param->traffic.data, param->traffic.len); - break; + if (p_tone_name[0]) { + read_audio(param->traffic.data, param->traffic.len); + admin_message_from_lcr(p_r_remote_id, p_r_ref, MESSAGE_TRAFFIC, param); + } + return; case MESSAGE_SETUP: - interface = getinterfacebyname(p_r_interface_name); + interface = getinterfacebyname(p_interface_name); if (!interface) { - PERROR("Cannot find interface %s.\n", p_r_interface_name); + PERROR("Cannot find interface %s.\n", p_interface_name); return; } @@ -161,6 +175,11 @@ void Premote::message_remote(int message_type, union parameter *param) epointlist_new(epoint->ep_serial); + memcpy(&p_dialinginfo, ¶m->setup.dialinginfo, sizeof(p_dialinginfo)); + memcpy(&p_capainfo, ¶m->setup.capainfo, sizeof(p_capainfo)); + memcpy(&p_callerinfo, ¶m->setup.callerinfo, sizeof(p_callerinfo)); + memcpy(&p_redirinfo, ¶m->setup.redirinfo, sizeof(p_redirinfo)); + new_state(PORT_STATE_IN_SETUP); break; @@ -173,6 +192,7 @@ void Premote::message_remote(int message_type, union parameter *param) break; case MESSAGE_CONNECT: + memcpy(&p_connectinfo, ¶m->connectinfo, sizeof(p_connectinfo)); new_state(PORT_STATE_CONNECT); break; @@ -208,6 +228,9 @@ int Premote::bridge_rx(unsigned char *data, int len) && p_state != PORT_STATE_CONNECT) return 0; + if (p_tone_name[0]) + return 0; + memset(&newparam, 0, sizeof(union parameter)); /* split, if exeeds data size */ while(len) {