work on socket. (don't try yet)
[lcr.git] / apppbx.cpp
index e59bbea..9560103 100644 (file)
@@ -40,7 +40,7 @@ EndpointAppPBX::EndpointAppPBX(class Endpoint *epoint, int origin) : EndpointApp
         memset(&e_ext, 0, sizeof(struct extension));
        // *************** NOTE: also change value in read_extension() **************
        e_ext.rights = 4; /* international */
-       e_ext.rxvol = e_ext.txvol = 0;
+       e_ext.rx_gain = e_ext.tx_gain = 0;
         e_state = EPOINT_STATE_IDLE;
         e_ext.number[0] = '\0';
        e_extension_interface[0] = '\0';
@@ -1001,7 +1001,7 @@ void EndpointAppPBX::out_setup(void)
                                goto check_anycall_intern;
                        }
                        /* directory.list */
-                       if (e_callerinfo.id[0] && (e_ext.centrex || e_ext.display_name))
+                       if (e_callerinfo.id[0] && e_ext.display_name)
                        {
                                dirname = parse_directory(e_callerinfo.id, e_callerinfo.ntype);
                                if (dirname)
@@ -1025,8 +1025,8 @@ void EndpointAppPBX::out_setup(void)
                        SCPY(message->param.setup.callerinfo.display, apply_callerid_display(message->param.setup.callerinfo.id, message->param.setup.callerinfo.itype, message->param.setup.callerinfo.ntype, message->param.setup.callerinfo.present, message->param.setup.callerinfo.screen, message->param.setup.callerinfo.extension, message->param.setup.callerinfo.name));
 //printf("\n\ndisplay = %s\n\n\n",message->param.setup.callerinfo.display);
                        /* use cnip, if enabld */
-                       if (!e_ext.centrex)
-                               message->param.setup.callerinfo.name[0] = '\0';
+       //              if (!e_ext.centrex)
+       //                      message->param.setup.callerinfo.name[0] = '\0';
                        /* screen clip if prefix is required */
                        if (message->param.setup.callerinfo.id[0] && e_ext.clip_prefix[0])
                        {
@@ -1569,12 +1569,12 @@ void EndpointAppPBX::port_setup(struct port_list *portlist, int message_type, un
 
                /* set volume of rx and tx */
                if (param->setup.callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
-               if (e_ext.txvol!=0 || e_ext.rxvol!=0)
+               if (e_ext.tx_gain!=0 || e_ext.rx_gain!=0)
                {
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_mISDNSIGNAL);
                        message->param.mISDNsignal.message = mISDNSIGNAL_VOLUME;
-                       message->param.mISDNsignal.rxvol = e_ext.txvol;
-                       message->param.mISDNsignal.txvol = e_ext.rxvol;
+                       message->param.mISDNsignal.rx_gain = e_ext.tx_gain;
+                       message->param.mISDNsignal.tx_gain = e_ext.rx_gain;
                        message_put(message);
                }
 
@@ -2059,12 +2059,12 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
        new_state(EPOINT_STATE_CONNECT);
 
        /* set volume of rx and tx */
-       if (e_ext.txvol!=0 || e_ext.rxvol!=0)
+       if (e_ext.tx_gain!=0 || e_ext.rx_gain!=0)
        {
                message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_mISDNSIGNAL);
                message->param.mISDNsignal.message = mISDNSIGNAL_VOLUME;
-               message->param.mISDNsignal.rxvol = e_ext.txvol;
-               message->param.mISDNsignal.txvol = e_ext.rxvol;
+               message->param.mISDNsignal.rx_gain = e_ext.tx_gain;
+               message->param.mISDNsignal.tx_gain = e_ext.rx_gain;
                message_put(message);
        }
 
@@ -2439,13 +2439,13 @@ void EndpointAppPBX::port_notify(struct port_list *portlist, int message_type, u
                case INFO_NOTIFY_USER_RESUMED:
                /* set volume of rx and tx */
                if (param->setup.callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
-               if (e_ext.txvol!=0 || e_ext.rxvol!=0)
+               if (e_ext.tx_gain!=0 || e_ext.rx_gain!=0)
                if (portlist)
                {
                        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_mISDNSIGNAL);
                        message->param.mISDNsignal.message = mISDNSIGNAL_VOLUME;
-                       message->param.mISDNsignal.rxvol = e_ext.txvol;
-                       message->param.mISDNsignal.txvol = e_ext.rxvol;
+                       message->param.mISDNsignal.rx_gain = e_ext.tx_gain;
+                       message->param.mISDNsignal.tx_gain = e_ext.rx_gain;
                        message_put(message);
                }
                /* set current tone */
@@ -2845,7 +2845,7 @@ void EndpointAppPBX::join_facility(struct port_list *portlist, int message_type,
 {
        struct message *message;
 
-       if (!e_ext.facility)
+       if (!e_ext.facility && e_ext.number[0])
        {
                return;
        }
@@ -2877,7 +2877,10 @@ void EndpointAppPBX::join_overlap(struct port_list *portlist, int message_type,
        }
        if (e_action) if (e_action->index == ACTION_OUTDIAL || e_action->index == ACTION_EXTERNAL)
        {
-                       set_tone(portlist, "dialtone");
+                       if (e_dialinginfo.id[0])
+                               set_tone(portlist, "dialing");
+                       else
+                               set_tone(portlist, "dialtone");
                        return;
        }
        if (e_ext.number[0])
@@ -2986,8 +2989,8 @@ void EndpointAppPBX::join_connect(struct port_list *portlist, int message_type,
                SCPY(message->param.connectinfo.display, apply_callerid_display(message->param.connectinfo.id, message->param.connectinfo.itype, message->param.connectinfo.ntype, message->param.connectinfo.present, message->param.connectinfo.screen, message->param.connectinfo.extension, message->param.connectinfo.name));
 
                /* use conp, if enabld */
-               if (!e_ext.centrex)
-                       message->param.connectinfo.name[0] = '\0';
+//             if (!e_ext.centrex)
+//                     message->param.connectinfo.name[0] = '\0';
 
                /* send connect */
                message_put(message);
@@ -3120,7 +3123,7 @@ void EndpointAppPBX::join_disconnect_release(int message_type, union parameter *
 void EndpointAppPBX::join_setup(struct port_list *portlist, int message_type, union parameter *param)
 {
        struct message *message;
-       struct interface        *interface;
+//     struct interface        *interface;
 
        /* if we already in setup state, we just update the dialing with new digits */
        if (e_state == EPOINT_STATE_OUT_SETUP
@@ -3878,12 +3881,12 @@ void EndpointAppPBX::join_join(void)
        {
                if (other_relation->epoint_id == other_eapp->ea_endpoint->ep_serial)
                {
-               /* detach other endpoint on hold */
+                       /* detach other endpoint on hold */
                        *other_relation_pointer = other_relation->next;
                        FREE(other_relation, sizeof(struct join_relation));
                        cmemuse--;
                        other_relation = *other_relation_pointer;
-                       other_eapp->ea_endpoint->ep_join_id = NULL;
+                       other_eapp->ea_endpoint->ep_join_id = 0;
                        continue;
                }