Minor fix in interface.conf example
[lcr.git] / gsm_bs.cpp
index 902065b..9608be6 100644 (file)
@@ -65,7 +65,6 @@ Pgsm_bs::~Pgsm_bs()
 /* DTMF INDICATION */
 void Pgsm_bs::start_dtmf_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc)
 {
-       struct lcr_msg *message;
        struct gsm_mncc *resp;
 
        gsm_trace_header(p_g_interface_name, this, msg_type, DIRECTION_IN);
@@ -84,10 +83,16 @@ void Pgsm_bs::start_dtmf_ind(unsigned int msg_type, unsigned int callref, struct
        send_and_free_mncc(p_g_lcr_gsm, resp->msg_type, resp);
 
        if (p_g_rtp_bridge) {
-               /* send dtmf information, because we bridge RTP directly */
-               message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_DTMF);
-               message->param.dtmf = mncc->keypad;
-               message_put(message);
+               class Port *remote = bridge_remote();
+
+               if (remote) {
+                       struct lcr_msg *message;
+
+                       /* send dtmf information, because we bridge RTP directly */
+                       message = message_create(0, remote->p_serial, EPOINT_TO_PORT, MESSAGE_DTMF);
+                       message->param.dtmf = mncc->keypad;
+                       message_put(message);
+               }
        } else {
                /* generate DTMF tones, since we do audio forwarding inside LCR */
                switch (mncc->keypad) {
@@ -207,6 +212,17 @@ void Pgsm_bs::setup_ind(unsigned int msg_type, unsigned int callref, struct gsm_
        class Endpoint *epoint;
        struct lcr_msg *message;
        struct gsm_mncc *mode, *proceeding, *frame;
+       struct interface *interface = interface_first;
+
+       while (interface) {
+               if (!strcmp(interface->name, p_g_interface_name))
+                       break;
+               interface = interface->next;
+       }
+       if (!interface) {
+               PERROR("Cannot find interface %s.\n", p_g_interface_name);
+               return;
+       }
 
        /* process given callref */
        gsm_trace_header(p_g_interface_name, this, 0, DIRECTION_IN);
@@ -294,8 +310,7 @@ void Pgsm_bs::setup_ind(unsigned int msg_type, unsigned int callref, struct gsm_
                FATAL("Incoming call but already got an endpoint.\n");
        if (!(epoint = new Endpoint(p_serial, 0)))
                FATAL("No memory for Endpoint instance\n");
-       if (!(epoint->ep_app = new DEFAULT_ENDPOINT_APP(epoint, 0))) //incoming
-               FATAL("No memory for Endpoint Application instance\n");
+       epoint->ep_app = new_endpointapp(epoint, 0, interface->app); //incoming
        epointlist_new(epoint->ep_serial);
 
        /* modify lchan to GSM codec V1 */