From fd2045584f7084d209607f4d717a66bea9afe88e Mon Sep 17 00:00:00 2001 From: Super User Date: Tue, 15 May 2007 22:59:29 +0200 Subject: backup --- action.cpp | 441 +------------------------------------------------------------ 1 file changed, 1 insertion(+), 440 deletions(-) (limited to 'action.cpp') diff --git a/action.cpp b/action.cpp index 51aa8db..003dcf4 100644 --- a/action.cpp +++ b/action.cpp @@ -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) { @@ -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; @@ -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 @@ -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)) { @@ -2808,9 +2372,6 @@ void EndpointAppPBX::process_hangup(int cause, int location) 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); 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; -- cgit v1.2.3-55-g7522