backup
[lcr.git] / action.cpp
index 51aa8db..3655032 100644 (file)
@@ -67,7 +67,7 @@ char *numberrize_callerinfo(char *string, int ntype)
 
 
 /*
- * process init 'internal' / 'external' / 'h323' / 'chan' / 'vbox-record' / 'partyline'...
+ * process init 'internal' / 'external' / 'chan' / 'vbox-record' / 'partyline'...
  */
 void EndpointAppPBX::_action_init_call(int chan)
 {
@@ -192,7 +192,7 @@ void EndpointAppPBX::action_dialing_internal(void)
        if (e_ext.rights < 1)
        {
                printlog("%3d  action   INTERN access to internal phones are denied for this caller.\n", ea_endpoint->ep_serial);
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): internal call from terminal %s denied.\n", ea_endpoint->ep_serial, e_terminal);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): internal call from terminal %s denied.\n", ea_endpoint->ep_serial, e_ext.number);
                new_state(EPOINT_STATE_OUT_DISCONNECT);
                message_disconnect_port(portlist, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, "");
                set_tone(portlist, "cause_81");
@@ -229,7 +229,7 @@ void EndpointAppPBX::action_dialing_external(void)
                if (strchr(e_extdialing, '#'))
                {
                        e_extdialing[0] = '\0';
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): '#' detected: terminal '%s' selected caller id '%s' and continues dialing: '%s'\n", ea_endpoint->ep_serial, e_terminal, e_callerinfo.id, e_extdialing);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): '#' detected: terminal '%s' selected caller id '%s' and continues dialing: '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id, e_extdialing);
                }
                /* eliminate digits before '*', which is a delete digit
                 */
@@ -245,7 +245,7 @@ void EndpointAppPBX::action_dialing_external(void)
                                }
                                UCPY(p, p+1); /* remove '*' */
                        }
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s deleted digits and got new string: %s\n", ea_endpoint->ep_serial, e_terminal, e_extdialing);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s deleted digits and got new string: %s\n", ea_endpoint->ep_serial, e_ext.number, e_extdialing);
                }
        }
 
@@ -325,7 +325,7 @@ void EndpointAppPBX::action_dialing_external(void)
        if (e_ext.rights < 2)
        {
                printlog("%3d  action   EXTERN calls are denied for this caller.\n", ea_endpoint->ep_serial);
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): external call from terminal denied: %s\n", ea_endpoint->ep_serial, e_terminal);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): external call from terminal denied: %s\n", ea_endpoint->ep_serial, e_ext.number);
                release(RELEASE_CALL, LOCATION_PRIVATE_LOCAL, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, 0);
                set_tone(portlist, "cause_82");
                denied:
@@ -342,7 +342,7 @@ void EndpointAppPBX::action_dialing_external(void)
                if (e_ext.rights < 3)
                {
                        printlog("%3d  action   EXTERN national calls are denied for this caller.\n", ea_endpoint->ep_serial);
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): national call from terminal %s denied.\n", ea_endpoint->ep_serial, e_terminal);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): national call from terminal %s denied.\n", ea_endpoint->ep_serial, e_ext.number);
                        release(RELEASE_CALL, LOCATION_PRIVATE_LOCAL, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, 0);
                        set_tone(portlist, "cause_83");
                        goto denied;
@@ -356,7 +356,7 @@ void EndpointAppPBX::action_dialing_external(void)
                if (e_ext.rights < 4)
                {
                        printlog("%3d  action   EXTERN international calls are denied for this caller.\n", ea_endpoint->ep_serial);
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): international call from terminal %s denied.\n", ea_endpoint->ep_serial, e_terminal);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): international call from terminal %s denied.\n", ea_endpoint->ep_serial, e_ext.number);
                        release(RELEASE_CALL, LOCATION_PRIVATE_LOCAL, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, 0);
                        set_tone(portlist, "cause_84");
                        goto denied;
@@ -374,432 +374,6 @@ void EndpointAppPBX::action_dialing_external(void)
 }
 
 
-#ifdef H323
-/*
- * process dialing h323
- */
-#define set_ip_macro \
-       UNCPY(helpbuffer, address, sizeof(helpbuffer)); \
-       helpbuffer[sizeof(helpbuffer)-1] = '\0'; \
-       UNPRINT(helpbuffer + (int)(address - dial), sizeof(helpbuffer)-1 - (int)(address - dial), "%d.%d.%d.%d", ip_a, ip_b, ip_c, ip_d); \
-       ii = strlen(helpbuffer); \
-       UNCAT(helpbuffer, dial+i, sizeof(helpbuffer)-1); \
-       dial = address + ii; \
-       i = 0; \
-       UCPY(address, helpbuffer);
-#define set_port_macro \
-       UNCPY(helpbuffer, address, sizeof(helpbuffer)); \
-       helpbuffer[sizeof(helpbuffer)-1] = '\0'; \
-       UNPRINT(helpbuffer + (int)(address - dial), sizeof(helpbuffer)-1 - (int)(address - dial), "%d", port); \
-       ii = strlen(helpbuffer); \
-       UNCAT(helpbuffer, dial+i, sizeof(helpbuffer)-1); \
-       dial = address + ii; \
-       i = 0; \
-       UCPY(address, helpbuffer);
-void EndpointAppPBX::action_dialing_h323(void)
-{
-       struct message *message;
-       struct dialing_info dialinginfo;
-       int i,j, ii;
-       struct port_list *portlist = ea_endpoint->ep_portlist;
-       char *dial;
-       char address_buffer[256], *address=address_buffer;
-       char host[128] = "";
-       int ip_a=0, ip_b=0, ip_c=0, ip_d=0, port=0;
-       struct route_param *rparam;
-       char helpbuffer[128];
-
-       /* check if address parameter is given */
-       if ((rparam = routeparam(e_action, PARAM_ADDRESS)))
-       {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): complete address is given by parameter: '%s'\n", ea_endpoint->ep_serial, rparam->string_value);
-               SCPY(address_buffer, rparam->string_value);
-               goto address_complete;
-       }
-
-       /* check for given host */
-       if ((rparam = routeparam(e_action, PARAM_HOST)))
-       if (rparam->string_value[0])
-       {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): host is given by parameter: '%s'\n", ea_endpoint->ep_serial, rparam->string_value);
-               SCPY(host, rparam->string_value);
-               if ((rparam = routeparam(e_action, PARAM_PORT)))
-               {
-                       if (rparam->integer_value>0 && rparam->integer_value<65536)
-                       {
-                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): port is given with the host by parameter: %d\n", ea_endpoint->ep_serial, rparam->integer_value);
-                               if (strlen(host)+7 < sizeof(host))
-                                       UPRINT(host, ":%d/", rparam->integer_value);
-                       } else
-                       {
-                               SCAT(host, "/");
-                       }
-               } else
-               {
-                       SCAT(host, "/");
-               }
-       }
-
-       /* include prefix and put 'host'(port) in front */
-       if ((rparam = routeparam(e_action, PARAM_PREFIX)))
-       {
-               SPRINT(address_buffer, "%s%s%s", host, rparam->string_value, e_extdialing);
-       } else
-       {
-               if (host[0])
-               {
-                       SPRINT(address_buffer, "%s%s", host, e_extdialing);
-                       printf("address:%s host %s extdialing %s\n",address,host, e_extdialing);
-               } else {
-                       address = e_extdialing;
-               }
-       }
-       dial = address;
-
-       /* check dialing */
-       /* check for ip-number only with numerical digits (can be dialed by any phone) */
-       if (host[0])
-       {
-               dial = address + strlen(host);
-               goto check_user; /* we have complete host (port) */
-       }
-       i = 0;
-       while(i < 12)
-       {
-               if (dial[i] == '\0')
-                       return; /* unfinished */
-               if (dial[i]<'0' || dial[i]>'9')
-                       goto check_complex;
-               i++;
-
-               if (i == 3)
-               {
-                       ip_a = (dial[0]-'0')*100 + (dial[1]-'0')*10 + (dial[2]-'0');
-                       if (ip_a > 255)
-                       {
-                               invalid:
-                               printlog("%3d  action   H323 address '%s' is invalid.\n", ea_endpoint->ep_serial, address);
-                               message_disconnect_port(portlist, CAUSE_INVALID, LOCATION_PRIVATE_LOCAL, "");
-                               new_state(EPOINT_STATE_OUT_DISCONNECT);
-                               set_tone(portlist,"cause_1c");
-                               return;
-                       }
-               }
-               if (i == 6)
-               {
-                       ip_b = (dial[3]-'0')*100 + (dial[4]-'0')*10 + (dial[5]-'0');
-                       if (ip_b > 255)
-                               goto invalid;
-               }
-               if (i == 9)
-               {
-                       ip_c = (dial[6]-'0')*100 + (dial[7]-'0')*10 + (dial[8]-'0');
-                       if (ip_c > 255)
-                               goto invalid;
-               }
-               if (i == 12)
-               {
-                       ip_d = (dial[9]-'0')*100 + (dial[10]-'0')*10 + (dial[11]-'0');
-                       if (ip_d > 255)
-                               goto invalid;
-               }
-               if (i==4 || i==7 || i==10)
-               {
-                       if (dial[i-1] > '2')
-                               goto invalid;
-               }
-               if (i==5 || i==8 || i==11)
-               {
-                       if (dial[i-2]=='2' && dial[i-1]>'5')
-                               goto invalid;
-               }
-       }
-       UPRINT(address, "%d.%d.%d.%d", ip_a, ip_b, ip_c, ip_d);
-       i = strlen(address);
-       goto address_complete;
-
-       /* there are three stages of dialing: 1. ip, 2. port, 3. user, let's find out where we at */
-       check_complex:
-       if (strchr(address, '@'))
-       {
-               dial = strchr(address, '\0');
-               goto address_complete;
-       }
-       if (strchr(address, ':'))
-       {
-               dial = strchr(address, ':') + 1;
-               goto check_port;
-       }
-       if (strchr(address, '/'))
-       {
-               dial = strchr(address, '/') + 1;
-               goto check_user;
-       }
-
-       /* get ip from ip-number */
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): checking dialed for ip: %s\n", ea_endpoint->ep_serial, dial);
-       ip_a = ip_b = ip_c = ip_d = 0;
-       i = 0;
-       j = 0;
-       while(42)
-       {
-               if (j==4)
-                       goto invalid;
-               if (ip_a > 255)
-                       goto invalid;
-               if (dial[i]>='0' && dial[i]<='9')
-                       ip_a = (ip_a*10) + dial[i]-'0';
-               else if (dial[i]=='.' || dial[i]=='*')
-               {
-                       dial[i] = '.';
-//                     if (i && dial[i-1]=='.')
-//                     {
-//                             /* add 0 if two dots */
-//                             UCPY(dial+i+1, dial+i);
-//                             dial[i]='0';
-//                             i++;
-//                     }
-                       i++;
-                       break;
-               }
-               else if (dial[i]=='#')
-               {
-                       ip_d = ip_a;
-                       ip_a = 0;
-                       set_ip_macro
-                       i++;
-                       dial+= i;
-                       goto address_complete;
-               }
-               else if (dial[i] == '\0')
-               {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): ip so far: %d*\n", ea_endpoint->ep_serial, ip_a);
-                       return;
-               }
-               else
-                       goto invalid;
-               i++;
-               j++;
-       }
-       j = 0;
-       while(42)
-       {
-               if (j==4)
-                       goto invalid;
-               if (ip_b > 255)
-                       goto invalid;
-               if (dial[i]>='0' && dial[i]<='9')
-                       ip_b = (ip_b*10) + dial[i]-'0';
-               else if (dial[i]=='.' || dial[i]=='*')
-               {
-                       dial[i] = '.';
-                       i++;
-                       break;
-               }
-               else if (dial[i]=='#')
-               {
-                       ip_d = ip_b;
-                       ip_b = 0;
-                       set_ip_macro
-                       i++;
-                       dial+= i;
-                       goto address_complete;
-               }
-               else if (dial[i] == '\0')
-               {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): ip so far: %d.%d*\n", ea_endpoint->ep_serial, ip_a, ip_b);
-                       return;
-               }
-               else
-                       goto invalid;
-               i++;
-               j++;
-       }
-       j = 0;
-       while(42)
-       {
-               if (j==4)
-                       goto invalid;
-               if (ip_c > 255)
-                       goto invalid;
-               if (dial[i]>='0' && dial[i]<='9')
-                       ip_c = (ip_c*10) + dial[i]-'0';
-               else if (dial[i]=='.' || dial[i]=='*')
-               {
-                       dial[i] = '.';
-                       i++;
-                       break;
-               }
-               else if (dial[i]=='#')
-               {
-                       ip_d = ip_c;
-                       ip_c = 0;
-                       set_ip_macro
-                       i++;
-                       dial+= i;
-                       goto address_complete;
-               }
-               else if (dial[i] == '\0')
-               {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): ip so far: %d.%d.%d\n", ea_endpoint->ep_serial, ip_a, ip_b, ip_c);
-                       return;
-               }
-               else
-                       goto invalid;
-               i++;
-               j++;
-       }
-       j = 0;
-       while(42)
-       {
-               if (j==4)
-                       goto invalid;
-               if (ip_d > 255)
-                       goto invalid;
-               if (dial[i]>='0' && dial[i]<='9')
-                       ip_d = (ip_d*10) + dial[i]-'0';
-               else if (dial[i]=='*' || dial[i]==':')
-               {
-                       set_ip_macro
-                       dial[i] = ':';
-                       i++;
-                       dial+= i;
-                       goto check_port;
-               }
-               else if (dial[i]=='#')
-               {
-                       set_ip_macro
-                       i++;
-                       dial+= i;
-                       goto address_complete;
-               }
-               else if (dial[i] == '\0')
-               {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): ip so far: %d.%d.%d.%d*\n", ea_endpoint->ep_serial, ip_a, ip_b, ip_c, ip_d);
-                       return;
-               }
-               else
-                       goto invalid;
-               i++;
-               j++;
-       }
-
-       /* get port */
-       check_port:
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): checking dialed for port: %s\n", ea_endpoint->ep_serial, dial);
-       port = 0;
-       i = 0;
-       j = 0;
-       while(42)
-       {
-               if (j==6)
-                       goto invalid;
-               if (port > 65535)
-                       goto invalid;
-               if (dial[i]>='0' && dial[i]<='9')
-                       port = (port*10) + dial[i]-'0';
-               else if (dial[i]=='*' || dial[i]=='/')
-               {
-                       if (i) /* only if there is something entered */
-                       {
-                               set_port_macro
-                               dial[i] = '/';
-                       } else
-                       {
-                               i--;
-                               UCPY(dial+i, dial+i+1);
-                               dial[i] = '/';
-                       }
-                       i++;
-                       dial+= i;
-                       goto check_user;
-               }
-               else if (dial[i]=='#')
-               {
-                       set_port_macro
-                       i++;
-                       dial+= i;
-                       goto address_complete;
-               }
-               else if (dial[i] == '\0')
-               {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): h323 address so far: %s\n", ea_endpoint->ep_serial, address);
-                       return;
-               }
-               else
-                       goto invalid;
-               i++;
-               j++;
-       }
-
-       /* get user */
-       check_user:
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): checking dialed for user: %s\n", ea_endpoint->ep_serial, dial);
-       port = 0;
-       i = 0;
-       j = 0;
-       while(42)
-       {
-               if (dial[i]=='#')
-               {
-                       dial[i] = '\0';
-                       /* convert to @-notation */
-                       SCPY(helpbuffer, strchr(address, '/')+1);
-                       SCAT(helpbuffer, "@");
-                       *strchr(address, '/') = '\0';
-                       SCAT(helpbuffer, address);
-                       UCPY(address, helpbuffer);
-                       goto address_complete;
-               }
-               else if (dial[i] == '\0')
-               {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): h323 address so far: %s\n", ea_endpoint->ep_serial, address);
-                       return;
-               }
-               i++;
-               j++;
-       }
-
-       address_complete:
-       /* send proceeding, because number is complete */
-       set_tone(portlist, "proceeding");
-       message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_PROCEEDING);
-       message_put(message);
-       logmessage(message);
-       new_state(EPOINT_STATE_IN_PROCEEDING);
-
-       memset(&dialinginfo, 0, sizeof(dialinginfo));
-       dialinginfo.itype = INFO_ITYPE_H323;
-       dialinginfo.sending_complete = 1;
-       SPRINT(dialinginfo.number, "%s", address);
-       /* strip the # at the end */
-       if (dialinginfo.number[0])
-               if (dialinginfo.number[strlen(dialinginfo.number)-1] == '#')
-                       dialinginfo.number[strlen(dialinginfo.number)-1] = '\0';
-
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): complete multi-dial string \"%s\"\n", ea_endpoint->ep_serial, dialinginfo.number);
-
-       /* add or update internal call */
-       printlog("%3d  action   H323 call to address %s.\n", ea_endpoint->ep_serial, dialinginfo.number);
-       message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_call_id, EPOINT_TO_CALL, MESSAGE_SETUP);
-       memcpy(&message->param.setup.dialinginfo, &dialinginfo, sizeof(struct dialing_info));
-       memcpy(&message->param.setup.redirinfo, &e_redirinfo, sizeof(struct redir_info));
-       memcpy(&message->param.setup.callerinfo, &e_callerinfo, sizeof(struct caller_info));
-       memcpy(&message->param.setup.capainfo, &e_capainfo, sizeof(struct capa_info));
-       message_put(message);
-}
-#else
-void EndpointAppPBX::action_dialing_h323(void)
-{
-       struct port_list *portlist = ea_endpoint->ep_portlist;
-
-       printlog("%3d  action   H323 stack not implemented.\n", ea_endpoint->ep_serial);
-       message_disconnect_port(portlist, CAUSE_UNIMPLEMENTED, LOCATION_PRIVATE_LOCAL, "");
-       new_state(EPOINT_STATE_OUT_DISCONNECT);
-       set_tone(portlist,"cause_4f");
-}
-#endif
-
 void EndpointAppPBX::action_dialing_chan(void)
 {
        struct port_list *portlist = ea_endpoint->ep_portlist;
@@ -847,13 +421,13 @@ void EndpointAppPBX::action_dialing_vbox_record(void)
                return;
        }
 
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s dialing extension: %s\n", ea_endpoint->ep_serial, e_terminal, rparam->string_value);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s dialing extension: %s\n", ea_endpoint->ep_serial, e_ext.number, rparam->string_value);
 
        /* check if internal calls are denied */
        if (e_ext.rights < 1)
        {
                printlog("%3d  action   VBOX-RECORD calls are denied for this caller.\n", ea_endpoint->ep_serial);
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): internal call from terminal %s denied.\n", ea_endpoint->ep_serial, e_terminal);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): internal call from terminal %s denied.\n", ea_endpoint->ep_serial, e_ext.number);
                new_state(EPOINT_STATE_OUT_DISCONNECT);
                message_disconnect_port(portlist, CAUSE_REJECTED, LOCATION_PRIVATE_LOCAL, "");
                set_tone(portlist, "cause_81");
@@ -966,7 +540,7 @@ void EndpointAppPBX::action_init_partyline(void)
        }
        ea_endpoint->ep_call_id = call->c_serial;
 
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s dialing room: %d\n", ea_endpoint->ep_serial, e_terminal, partyline);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s dialing room: %d\n", ea_endpoint->ep_serial, e_ext.number, partyline);
 
        set_tone(portlist, "proceeding");
        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_PROCEEDING);
@@ -995,29 +569,29 @@ void EndpointAppPBX::action_hangup_call(void)
 
        printlog("%3d  action   CALL to '%s' hangs up.\n", ea_endpoint->ep_serial, e_dialinginfo.number);
        /* check */
-       if (e_terminal[0] == '\0')
+       if (e_ext.number[0] == '\0')
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because caller is unknown (not internal).\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because caller is unknown (not internal).\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
                return;
        }
-       if (!(read_extension(&e_ext, e_terminal)))
+       if (!(read_extension(&e_ext, e_ext.number)))
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because cannot read settings.\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because cannot read settings.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
                return;
        }
        if (e_dialinginfo.number[0] == '\0')
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number because nothing was dialed.\n", ea_endpoint->ep_serial, e_terminal);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number because nothing was dialed.\n", ea_endpoint->ep_serial, e_ext.number);
                return;
        }
        if (!strcmp(e_dialinginfo.number, e_ext.last_out[0]))
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last dialed number '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
                return;
        }
 
        /* insert */
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last number '%s'.\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last number '%s'.\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number);
        i = MAX_REMEMBER-1;
        while(i)
        {
@@ -1027,7 +601,7 @@ void EndpointAppPBX::action_hangup_call(void)
        SCPY(e_ext.last_out[0], e_dialinginfo.number);
 
        /* write extension */
-       write_extension(&e_ext, e_terminal);
+       write_extension(&e_ext, e_ext.number);
 }
 
 
@@ -1073,7 +647,7 @@ void EndpointAppPBX::action_dialing_login(void)
        }
 
        /* we changed our extension */
-       SCPY(e_terminal, extension);
+       SCPY(e_ext.number, extension);
        new_state(EPOINT_STATE_CONNECT);
        e_dtmf = 1;
        e_connectedmode = 1;
@@ -1105,7 +679,7 @@ void EndpointAppPBX::action_dialing_login(void)
        if (!(rparam = routeparam(e_action, PARAM_NOPASSWORD)))
        {
                /* make call state to enter password */
-               printlog("%3d  action   LOGIN to extension %s, ask for password.\n", ea_endpoint->ep_serial, e_terminal);
+               printlog("%3d  action   LOGIN to extension %s, ask for password.\n", ea_endpoint->ep_serial, e_ext.number);
                new_state(EPOINT_STATE_IN_OVERLAP);
                e_ruleset = NULL;
                e_rule = NULL;
@@ -1200,9 +774,9 @@ void EndpointAppPBX::_action_callerid_calleridnext(int next)
                }
 
        /* caller id complete, dialing with new caller id */
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing callerid '%s' for all following calls.\n", ea_endpoint->ep_serial, e_terminal, callerid);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing callerid '%s' for all following calls.\n", ea_endpoint->ep_serial, e_ext.number, callerid);
        /* write new parameters */
-       if (read_extension(&e_ext, e_terminal))
+       if (read_extension(&e_ext, e_ext.number))
        {
                if (callerid[0] == '\0')
                {
@@ -1225,7 +799,7 @@ void EndpointAppPBX::_action_callerid_calleridnext(int next)
                        if (!next) e_ext.id_next_call_type = -1;
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d): nationalized callerid: '%s' type=%d\n", ea_endpoint->ep_serial, (!next)?e_ext.callerid:e_ext.id_next_call, (!next)?e_ext.callerid_type:e_ext.id_next_call_type);
                }
-               write_extension(&e_ext, e_terminal);
+               write_extension(&e_ext, e_ext.number);
        }
 
        /* function activated */
@@ -1293,8 +867,8 @@ void EndpointAppPBX::action_dialing_forward(void)
                dest = e_extdialing;
        }
 
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing forwarding to '%s'.\n", ea_endpoint->ep_serial, e_terminal, dest);
-       if (read_extension(&e_ext, e_terminal))
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing forwarding to '%s'.\n", ea_endpoint->ep_serial, e_ext.number, dest);
+       if (read_extension(&e_ext, e_ext.number))
        {
                switch(diversion)
                {
@@ -1317,7 +891,7 @@ void EndpointAppPBX::action_dialing_forward(void)
                        SCPY(e_ext.cfp, dest);
                        break;
                }
-               write_extension(&e_ext, e_terminal);
+               write_extension(&e_ext, e_ext.number);
        }
        /* function (de)activated */
        message_disconnect_port(portlist, CAUSE_NORMAL, LOCATION_PRIVATE_LOCAL, "");
@@ -1412,9 +986,6 @@ void EndpointAppPBX::_action_redial_reply(int in)
        if (!strncmp(last, "intern:", 7))
                SPRINT(message->param.notifyinfo.display, "(%d) %s int", e_select+1, last+7);
        else
-       if (!strncmp(last, "h323:", 5))
-               SPRINT(message->param.notifyinfo.display, "(%d) %s h323", e_select+1, last+5);
-       else
        if (!strncmp(last, "chan:", 4))
                SPRINT(message->param.notifyinfo.display, "(%d) %s chan", e_select+1, last+5);
        else
@@ -1422,7 +993,7 @@ void EndpointAppPBX::_action_redial_reply(int in)
                SPRINT(message->param.notifyinfo.display, "(%d) %s vbox", e_select+1, last+5);
        else
                SPRINT(message->param.notifyinfo.display, "(%d) %s", e_select+1, (last[0])?last:"- empty -");
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s sending display:%s\n", ea_endpoint->ep_serial, e_terminal, message->param.notifyinfo.display);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s sending display:%s\n", ea_endpoint->ep_serial, e_ext.number, message->param.notifyinfo.display);
        message_put(message);
        logmessage(message);
 }
@@ -1490,7 +1061,7 @@ void EndpointAppPBX::action_dialing_powerdial(void)
 
        /* send connect to avoid overlap timeout */
 //     new_state(EPOINT_STATE_CONNECT); connect may prevent further dialing
-       if (e_terminal[0])
+       if (e_ext.number[0])
                e_dtmf = 1;
        memset(&e_connectinfo, 0, sizeof(e_connectinfo));
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
@@ -1619,7 +1190,7 @@ void EndpointAppPBX::action_dialing_abbrev(void)
        portlist = ea_endpoint->ep_portlist;
 
        /* abbrev dialing is only possible if we have a caller defined */
-       if (!e_terminal[0])
+       if (!e_ext.number[0])
        {
                printlog("%3d  action   ABBREVIATION only possible for internal callers.\n", ea_endpoint->ep_serial);
                new_state(EPOINT_STATE_OUT_DISCONNECT);
@@ -1632,7 +1203,7 @@ void EndpointAppPBX::action_dialing_abbrev(void)
        abbrev = e_extdialing;
        phone = NULL;
        name = NULL;
-       result = parse_phonebook(e_terminal, &abbrev, &phone, &name);
+       result = parse_phonebook(e_ext.number, &abbrev, &phone, &name);
        if (result == 0)
        {
                printlog("%3d  action   ABBREVIATION '%s' not found.\n", ea_endpoint->ep_serial, abbrev);
@@ -1695,7 +1266,7 @@ void EndpointAppPBX::action_dialing_test(void)
                case '3':
                printlog("%3d  action   TESTMODE executing 'echo connect' test.\n", ea_endpoint->ep_serial);
                new_state(EPOINT_STATE_CONNECT);
-               if (e_terminal[0])
+               if (e_ext.number[0])
                        e_dtmf = 1;
                set_tone(portlist, NULL);
                memset(&e_connectinfo, 0, sizeof(e_connectinfo));
@@ -1725,7 +1296,7 @@ void EndpointAppPBX::action_dialing_test(void)
                case '4':
                printlog("%3d  action   TESTMODE executing 'tone connect' test.\n", ea_endpoint->ep_serial);
                new_state(EPOINT_STATE_CONNECT);
-               if (e_terminal[0])
+               if (e_ext.number[0])
                        e_dtmf = 1;
                memset(&e_connectinfo, 0, sizeof(e_connectinfo));
                message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
@@ -1737,7 +1308,7 @@ void EndpointAppPBX::action_dialing_test(void)
                case '5':
                printlog("%3d  action   TESTMODE executing 'hold music' test.\n", ea_endpoint->ep_serial);
                new_state(EPOINT_STATE_CONNECT);
-               if (e_terminal[0])
+               if (e_ext.number[0])
                        e_dtmf = 1;
                memset(&e_connectinfo, 0, sizeof(e_connectinfo));
                message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_CONNECT);
@@ -1755,7 +1326,7 @@ void EndpointAppPBX::action_dialing_test(void)
                        cause = 0;
                printlog("%3d  action   TESTMODE executing 'announcement' test with cause %d.\n", ea_endpoint->ep_serial, cause);
                new_state(EPOINT_STATE_CONNECT);
-               if (e_terminal[0])
+               if (e_ext.number[0])
                        e_dtmf = 1;
                SPRINT(causestr,"cause_%02x",cause);
                memset(&e_connectinfo, 0, sizeof(e_connectinfo));
@@ -1789,7 +1360,7 @@ void EndpointAppPBX::action_dialing_test(void)
                case '9': /* text callerid test */
                printlog("%3d  action   TESTMODE executing 'caller id' test.\n", ea_endpoint->ep_serial);
                new_state(EPOINT_STATE_CONNECT);
-               if (e_terminal[0])
+               if (e_ext.number[0])
                        e_dtmf = 1;
                memset(&e_connectinfo, 0, sizeof(e_connectinfo));
                SCPY(e_connectinfo.id, "12345678");
@@ -1836,7 +1407,7 @@ void EndpointAppPBX::action_init_play(void)
                goto disconnect;
        }
 
-       if (e_terminal[0])
+       if (e_ext.number[0])
                e_dtmf = 1;
 
        set_tone(ea_endpoint->ep_portlist, rparam->string_value);
@@ -2091,7 +1662,7 @@ void EndpointAppPBX::action_dialing_calculator(void)
        /* display dialing */   
        message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_NOTIFY);
        SPRINT(message->param.notifyinfo.display, ">%s", e_extdialing);
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s displaying interpreted dialing '%s' internal values: %f %f\n", ea_endpoint->ep_serial, e_terminal, e_extdialing, value1, value2);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s displaying interpreted dialing '%s' internal values: %f %f\n", ea_endpoint->ep_serial, e_ext.number, e_extdialing, value1, value2);
        message_put(message);
        logmessage(message);
 
@@ -2301,7 +1872,7 @@ void EndpointAppPBX::action_dialing_help(void)
                //SCAT(dialing, e_dialinginfo.number);
                SCPY(e_dialinginfo.number, dialing);
                e_extdialing = e_dialinginfo.number+strlen(numbering->prefix);
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' dialing: %s\n", ea_endpoint->ep_serial, e_terminal, numb_actions[numbering->action], e_dialinginfo.number);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' dialing: %s\n", ea_endpoint->ep_serial, e_ext.number, numb_actions[numbering->action], e_dialinginfo.number);
 nesting?:
                process_dialing();
                return;
@@ -2310,7 +1881,7 @@ nesting?:
        /* send display message to port */
        message = message_create(ea_endpoint->ep_serial, ea_endpoint->ep_portlist->port_id, EPOINT_TO_PORT, MESSAGE_NOTIFY);
        SPRINT(message->param.notifyinfo.display, ">%s %s%s%s", numbering->prefix, numb_actions[numbering->action], (numbering->param[0])?" ":"", numbering->param);
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' sending display:%s\n", ea_endpoint->ep_serial, e_terminal, numb_actions[numbering->action], message->param.notifyinfo.display);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s selected a new menu '%s' sending display:%s\n", ea_endpoint->ep_serial, e_ext.number, numb_actions[numbering->action], message->param.notifyinfo.display);
        message_put(message);
        logmessage(message);
 #endif
@@ -2349,11 +1920,11 @@ void EndpointAppPBX::action_hangup_execute(void)
        if (command[0] == '\0')
        {
                printlog("%3d  action   EXECUTE no 'execute' parameter given at routing.conf.\n", ea_endpoint->ep_serial);
-               PERROR("EPOINT(%d): terminal %s: NO PARAMETER GIVEN for 'execute' action. see routing.conf\n", ea_endpoint->ep_serial, e_terminal);
+               PERROR("EPOINT(%d): terminal %s: NO PARAMETER GIVEN for 'execute' action. see routing.conf\n", ea_endpoint->ep_serial, e_ext.number);
                return;
        }
        printlog("%3d  action   EXECUTE command='%s'\n", ea_endpoint->ep_serial, command);
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: executing '%s'.\n", ea_endpoint->ep_serial, e_terminal, command);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: executing '%s'.\n", ea_endpoint->ep_serial, e_ext.number, command);
 
        argv[0] = command;
        while(strchr(argv[0], '/'))
@@ -2400,17 +1971,17 @@ void EndpointAppPBX::action_hangup_file(void)
        if (file[0] == '\0')
        {
                printlog("%3d  action   FILE no filename given.\n", ea_endpoint->ep_serial);
-               PERROR("EPOINT(%d): terminal %s: NO FILENAME GIVEN for 'file' action. see routing.conf\n", ea_endpoint->ep_serial, e_terminal);
+               PERROR("EPOINT(%d): terminal %s: NO FILENAME GIVEN for 'file' action. see routing.conf\n", ea_endpoint->ep_serial, e_ext.number);
                return;
        }
        if (!(fp = fopen(file, mode)))
        {
                printlog("%3d  action   FILE file '%s' cannot be opened. (errno = %d)\n", ea_endpoint->ep_serial, file, errno);
-               PERROR("EPOINT(%d): terminal %s: given file '%s' cannot be opened. see routing.conf\n", ea_endpoint->ep_serial, e_terminal, file);
+               PERROR("EPOINT(%d): terminal %s: given file '%s' cannot be opened. see routing.conf\n", ea_endpoint->ep_serial, e_ext.number, file);
                return;
        }
        printlog("%3d  action   FILE file='%s' content='%s'\n", ea_endpoint->ep_serial, file, content);
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: writing file '%s' with content '%s'.\n", ea_endpoint->ep_serial, e_terminal, file, content);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: writing file '%s' with content '%s'.\n", ea_endpoint->ep_serial, e_ext.number, file, content);
        fprintf(fp, "%s\n", content);
        fclose(fp);
 }
@@ -2472,7 +2043,7 @@ void EndpointAppPBX::action_dialing_password(void)
        if (e_action)
        if (e_action->index == ACTION_PASSWORD_WRITE)
        {
-               append_callbackauth(e_terminal, &e_callbackinfo);
+               append_callbackauth(e_ext.number, &e_callbackinfo);
                printlog("%3d  action   PASSWORD WRITE password written\n", ea_endpoint->ep_serial);
        }
 
@@ -2510,7 +2081,7 @@ void EndpointAppPBX::process_dialing(void)
        if (!portlist)
        {
                portlist_error:
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): note: dialing call requires exactly one port object to process dialing. this case could happen due to a parked call. we end dialing here.\n", ea_endpoint->ep_serial, e_terminal);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): note: dialing call requires exactly one port object to process dialing. this case could happen due to a parked call. we end dialing here.\n", ea_endpoint->ep_serial, e_ext.number);
                e_action_timeout = 0;
                e_match_timeout = 0;
                return;
@@ -2629,13 +2200,6 @@ void EndpointAppPBX::process_dialing(void)
                        e_action = &action_internal;
                        goto process_action;
                }
-               /* check for h323 call */
-               if (!strncmp(e_dialinginfo.number, "h323:", 5))
-               {
-                       e_extdialing = e_dialinginfo.number+5;
-                       e_action = &action_h323;
-                       goto process_action;
-               }
                /* check for chan call */
                if (!strncmp(e_dialinginfo.number, "chan:", 5))
                {
@@ -2654,7 +2218,7 @@ void EndpointAppPBX::process_dialing(void)
                if (e_match_timeout && now_d>=e_match_timeout)
                {
                        /* return timeout rule */
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', timeout in ruleset '%s'\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number, e_ruleset->name);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', timeout in ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number, e_ruleset->name);
                        e_match_timeout = 0;
                        e_action = e_match_to_action;
                        e_extdialing = e_match_to_extdialing;
@@ -2664,7 +2228,7 @@ void EndpointAppPBX::process_dialing(void)
                {
 //PDEBUG(~0, "HANG-BUG-DEBUGGING: before routing\n");
                        /* check for matching rule */
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', checking matching rule of ruleset '%s'\n", ea_endpoint->ep_serial, e_terminal, e_dialinginfo.number, e_ruleset->name);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', checking matching rule of ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.number, e_ruleset->name);
                        if (e_ruleset)
                        {
                                e_action = route(e_ruleset);
@@ -2680,7 +2244,7 @@ void EndpointAppPBX::process_dialing(void)
                }
                if (!e_action)
                {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): no rule within the current ruleset matches yet.\n", ea_endpoint->ep_serial, e_terminal);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): no rule within the current ruleset matches yet.\n", ea_endpoint->ep_serial, e_ext.number);
                        goto display;
                }
 
@@ -2727,7 +2291,7 @@ void EndpointAppPBX::process_dialing(void)
 
                if (action_defs[e_action->index].init_func)
                {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a init function, so we call it...\n", ea_endpoint->ep_serial, e_terminal, action_defs[e_action->index].name);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a init function, so we call it...\n", ea_endpoint->ep_serial, e_ext.number, action_defs[e_action->index].name);
                        (this->*(action_defs[e_action->index].init_func))();
                }
                if (e_state!=EPOINT_STATE_IN_SETUP
@@ -2739,11 +2303,11 @@ void EndpointAppPBX::process_dialing(void)
        }
 
        /* show what we are doing */
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' action: %s (dialing '%s')\n", ea_endpoint->ep_serial, e_terminal, action_defs[e_action->index].name, e_extdialing);
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' action: %s (dialing '%s')\n", ea_endpoint->ep_serial, e_ext.number, action_defs[e_action->index].name, e_extdialing);
        /* go to action's dialing function */
        if (action_defs[e_action->index].dialing_func)
        {
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a dialing function, so we call it...\n", ea_endpoint->ep_serial, e_terminal, action_defs[e_action->index].name);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a dialing function, so we call it...\n", ea_endpoint->ep_serial, e_ext.number, action_defs[e_action->index].name);
                (this->*(action_defs[e_action->index].dialing_func))();
        }
 
@@ -2775,7 +2339,7 @@ void EndpointAppPBX::process_dialing(void)
                        SPRINT(message->param.notifyinfo.display, "%s%s%s", action_defs[e_action->index].name, (e_extdialing[0])?" ":"", e_extdialing);
                }
 
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s displaying interpreted dialing '%s'\n", ea_endpoint->ep_serial, e_terminal, message->param.notifyinfo.display);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s displaying interpreted dialing '%s'\n", ea_endpoint->ep_serial, e_ext.number, message->param.notifyinfo.display);
                message_put(message);
                logmessage(message);
        }
@@ -2792,10 +2356,10 @@ void EndpointAppPBX::process_hangup(int cause, int location)
        char callertext[256], dialingtext[256];
        int writeext = 0, i;
 
-       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s'\n", ea_endpoint->ep_serial, e_terminal);
-       if (e_terminal[0])
+       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s'\n", ea_endpoint->ep_serial, e_ext.number);
+       if (e_ext.number[0])
        {
-               if (read_extension(&e_ext, e_terminal))
+               if (read_extension(&e_ext, e_ext.number))
                        writeext = 0x10;
 
                if (!e_start)
@@ -2805,12 +2369,9 @@ void EndpointAppPBX::process_hangup(int cause, int location)
                } else
                if (!e_stop)
                        time(&e_stop);
-               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): writing connect from %s to %s into logfile of %s\n", ea_endpoint->ep_serial, e_callerinfo.id, e_dialinginfo.number, e_terminal);
+               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): writing connect from %s to %s into logfile of %s\n", ea_endpoint->ep_serial, e_callerinfo.id, e_dialinginfo.number, e_ext.number);
                switch(e_dialinginfo.itype)
                {
-                       case INFO_ITYPE_H323:
-                       SPRINT(dialingtext, "h323:%s", e_dialinginfo.number);
-                       break;
                        case INFO_ITYPE_CHAN:
                        SPRINT(dialingtext, "chan:%s", e_dialinginfo.number);
                        break;
@@ -2835,7 +2396,7 @@ void EndpointAppPBX::process_hangup(int cause, int location)
                        UNPRINT(strchr(callertext,'\0'), sizeof(callertext)-1+strlen(callertext), " (intern %s)", e_callerinfo.intern);
                if (e_callerinfo.voip[0]) /* add voip if present */
                        UNPRINT(strchr(callertext,'\0'), sizeof(callertext)-1+strlen(callertext), " (voip %s)", e_callerinfo.voip);
-               write_log(e_terminal, callertext, dialingtext, e_start, e_stop, 0, cause, location);
+               write_log(e_ext.number, callertext, dialingtext, e_start, e_stop, 0, cause, location);
 
                /* store last received call for reply-list */
                if (e_callerinfo.id[0] || e_callerinfo.intern[0])
@@ -2855,21 +2416,21 @@ void EndpointAppPBX::process_hangup(int cause, int location)
                                }
                                SCPY(e_ext.last_in[0], callertext);
                                writeext |= 1; /* store extension later */
-                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last received caller id '%s'.\n", ea_endpoint->ep_serial, e_terminal, e_ext.last_in[0]);
+                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: storing last received caller id '%s'.\n", ea_endpoint->ep_serial, e_ext.number, e_ext.last_in[0]);
                        } else
-                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last received id '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_terminal, callertext);
+                               PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: cannot store last received id '%s' because it is identical with the last one.\n", ea_endpoint->ep_serial, e_ext.number, callertext);
                }
        }
 
        /* write extension if needed */
        if (writeext == 0x11)
-               write_extension(&e_ext, e_terminal);
+               write_extension(&e_ext, e_ext.number);
 
        if (e_action)
        {
                if (action_defs[e_action->index].hangup_func)
                {
-                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a hangup function, so we call it...\n", ea_endpoint->ep_serial, e_terminal, action_defs[e_action->index].name);
+                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal %s: current action '%s' has a hangup function, so we call it...\n", ea_endpoint->ep_serial, e_ext.number, action_defs[e_action->index].name);
                        (this->*(action_defs[e_action->index].hangup_func))();
                }
        }