C语言声讯代码

 

 

以前上班的公司写的....贴出来,大家伙看看!

哈!只是部份代码!

 


/*

    This program is a very basic Windows Application that uses
    List Boxes to display information into a window. Refer to 
    your Visuall C++ Help Files for descriptions of the Windows
    functions used in this program.
*/


/* C header files */
#define  STRICT
#include 
< windows.h >
#include 
< windowsx.h >
#include 
< share.h >
#include 
< memory.h >
#include 
" resource.h "
#include 
< winnt.h >
#include 
< limits.h >
#include 
< stdio.h >
#include 
< fcntl.h >
#include 
< io.h >
#include 
< stdlib.h >
#include 
< string .h >
#include 
< errno.h >
#include 
< signal.h >
#include 
< conio.h >
#include 
< time.h >
#include 
< sys / stat.h >

#include 
" globe.h "
#include 
" Child.h "


#define   MAIN_WND_WIDTH    300
#define   MAIN_WND_HEIGHT   400

/* Attributes of the Child windows inside the "main" frame window */
#define   ChildWinAttributes WS_CLIPSIBLINGS    | 
                            WS_CHILD        
|  
                            WS_VISIBLE        
|  
                            WS_CAPTION        
|  
                            WS_VSCROLL        
|  
                            WS_THICKFRAME   
|  
                            LBS_NOSEL        
|  
                            LBS_HASSTRINGS    
//                             WS_SYSMENU        | 

/* Global Thread Variables */
DWORD WINAPI ThreadDialogic(
void   * );
HANDLE hThread;
DWORD  dwThreadId;

HANDLE FaxSemaphore;
/* Global Window Variables */
HWND    MainhWnd;
HWND    D4XhChildWnd;
HWND    MSIhChildWnd;
HINSTANCE  ghInstance;
char  szBuff[ 200 ];
char  tmpbuf[ 100 ];
//  my code start
char  CallerID[ 15 ];
char  CalledID[ 8 ];
char  inDate[ 11 ];
char  inTime[ 9 ];
char  PHONE[ 11 ],MTYPE[ 2 ],STYPE[ 2 ];
char  CODE[ 6 ];
int  result;
//  my code end
char  MessageTitle[ 100 ] = " Message " ;
PORT PortMsg;
int   PlayVoxIdx[ 100 ];

/* Function Definitions */
BOOL InitWindows(HINSTANCE);
BOOL CALLBACK GetInitDigsProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT WINAPI D4XWndProc(HWND, UINT, WPARAM, LPARAM); 
// my function
void  QinRecAndPlay( char   * Path, char   * select);
// end of my function

// ??????
void  INPUTPHONE();          // 输入手机号码
void  INPUTMTYPE1();          // 输入手机类型
void  INPUTSCODE1();          // 输入彩信代码
void  INPUTMTYPE2();          // 输入手机类型
void  INPUTSCODE2();          // 输入动画代码
void  INPUTSCODE3();          // 输入和弦铃声代码
void  INPUTMTYPE3();          // 输入手机类型
void  SendMsg();          // 发送信息到互联网
void  SAVEDATA();          // 存储发送信息
ServiceStr  Service;


/****************************************************************
*    Name        : WinMain
*    Input Parms    : Default WinMain Parms.
*    Description    : This is the main windows function (similar to
*                : the main() in non-windows applications)
****************************************************************
*/

int  WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR LpCmdLine, int  nCmdShow)
{
    MSG msg;

    
//DefaultProcess();
    if (!hPrevInst)
    
{
        
/*    Initialize the windows */
        
if(!InitWindows(hInst))
            
return(FALSE);
    }


    
/*    The following loop remains until the window is exited
        Basically this loop gets messages intended for the window
        and send them to the window function defined for that 
        window. 
*/

    
while (GetMessage(&msg,NULL,0,0))
    
{
        TranslateMessage(
&msg);
        DispatchMessage(
&msg);
    }

}


/****************************************************************
*    Name        : SetWindowFonts
*    Input Parms    : None.
*    Description    : Sets the font of the created windows.  Each
*                : child window created should have a call here.
****************************************************************
*/

void  SetWindowFonts( void )
{
    HANDLE handle;

    
/*    Get the handle to the stock font ANSI_VAR_FONT */
    handle 
= GetStockObject(ANSI_VAR_FONT);

    
/*    This Message uses the above handle to the ANSI VAR FONT
        for the child windows specified in the call.  One of these 
        messages should be sent for each child window created.

        By setting LPARAM to TRUE, the window is redrawn immediately
        with the new font. 
*/

    
//SendMessage(D4XhChildWnd, WM_SETFONT, (WPARAM)handle, (LPARAM)TRUE);
    SendMessage(MSIhChildWnd, WM_SETFONT, (WPARAM)handle, (LPARAM)TRUE);
}


/****************************************************************
* Name            : InitWindows
* Input            : HINSTANCE - current instance of the application
* Description    : It registers window classes for main and child 
*                : window and create the windows. 
****************************************************************
*/

BOOL InitWindows(HINSTANCE hInst)
{
    WNDCLASS wc;


    ghInstance 
= hInst;


    ZeroMemory(
&wc,sizeof(wc));


    
/*    Create a style for the main frame window. */
    wc.style            
= CS_HREDRAW|CS_VREDRAW;
    wc.lpfnWndProc        
= D4XWndProc;
    wc.cbClsExtra        
= 0;
    wc.cbWndExtra        
= 0;
    wc.hInstance        
= hInst; 
    wc.hCursor            
= LoadCursor(NULL,IDC_ARROW);
    wc.hIcon            
= LoadIcon(hInst,MAKEINTRESOURCE(IDI_ICON1));
    wc.lpszMenuName        
= MAKEINTRESOURCE(IDR_MENU1);
    wc.hbrBackground    
= GetStockObject(GRAY_BRUSH); 
    wc.lpszClassName    
= "MainWndClass"

    
/*    Register the window class.  This class will now be 
        recognized by Windows. 
*/

    
if (!RegisterClass(&wc))
        
return(FALSE);

    
/*    Create the Main "frame" Window */
    MainhWnd 
= CreateWindow("MainWndClass",    
                            
"放语音信箱"
                            WS_OVERLAPPEDWINDOW
|WS_CAPTION,
                            
100,    
                            
50
                            MAIN_WND_WIDTH, 
                            MAIN_WND_HEIGHT, 
                            NULL, 
                            LoadMenu(hInst,
"GenericAppMenu"),
                            hInst, 
                            NULL);

    
/* Show the window */
    ShowWindow(MainhWnd, SW_SHOWNORMAL); 

    
/*    Create the first Child Window */
     
/*
    D4XhChildWnd = CreateWindow("LISTBOX", 
                                "Voice Channel Status", 
                                ChildWinAttributes,
                                20,
                                10, 
                                MAIN_WND_WIDTH/2, 
                                MAIN_WND_HEIGHT, 
                                MainhWnd, 
                                NULL, 
                                hInst, 
                                NULL );

    // Show the window 
    ShowWindow(D4XhChildWnd, SW_SHOWNORMAL);
    
*/

    
/*    Create the second Child Window */
    MSIhChildWnd 
= CreateWindow("LISTBOX"
                                MessageTitle,
                                
//"Message", 
                                ChildWinAttributes,
                                
10
                                
10
                                MAIN_WND_WIDTH
-20
                                MAIN_WND_HEIGHT
-20
                                MainhWnd, 
                                NULL, 
                                hInst, 
                                NULL);

    
/*    Show the window */
/*    ShowWindow(MSIhChildWnd, SW_SHOWNORMAL);  */

    
/*    Set the font of the created child windows */
    SetWindowFonts();

    
/*    Creating thread for processing Dialogic device events */
    
    hThread 
= CreateThread(NULL, 
                           
0,
                           ThreadDialogic, 
                           NULL, 
                           CREATE_SUSPENDED, 
                           
&dwThreadId);

    
//    Set the thread priority 
    SetThreadPriority ( hThread, THREAD_PRIORITY_NORMAL );

    
//    "run" the thread 
    ResumeThread ( hThread );  
    
    
return(TRUE);
}


/****************************************************************
*    Name        : WndProc
*    Input Parms    : Default Windows Parameters
*    Description    : This function is called when the main Window
*                : receives any messages. 
****************************************************************
*/

LRESULT WINAPI D4XWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{   
    
switch(uMsg)
    
{
        
case WM_CREATE:
            
break;
        
case WM_COMMAND: switch(wParam)
                        
{
                        
case IDM_ABOUT:    
                            MessageBox( NULL, 
"FaxSwitch Developed by Rob Teets ""About", MB_OK );
                            
break;

                        
case IDM_INITDIGS:    
                            
if!(DialogBox(ghInstance, MAKEINTRESOURCE(IDD_INITDIGS), hWnd, (DLGPROC)GetInitDigsProc) == IDOK ))
                                MessageBox( NULL, 
"Action cancelled""Initial Digits", MB_OK );
                            
break;
                        }

                        
break;

        
case WM_CLOSE:    //CloseFHandle(FaxSemaphore);
                        DestroyWindow(hWnd);
                        
break;

        
case WM_DESTROY: PostQuitMessage(0);
                         
break;
         
        
default:
            
return(DefWindowProc(hWnd,uMsg,wParam,lParam));
   }

}




/****************************************************************
*    Name        :
*    Input Parms    :
*    Description    :
****************************************************************
*/

BOOL CALLBACK GetInitDigsProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) 
{
    
char buf[30];
    
    
switch(uMsg)
    
{
    
case WM_INITDIALOG:
        
return TRUE;

    
case WM_COMMAND:
        
switch(wParam)
        
{
        
case IDOK:
            GetDlgItemText( hDlg, IDC_EDITDIGS, szBuff, 
sizeof(szBuff) );
            sprintf(buf, 
"Initial Digits = %s ",szBuff);
            MessageBox( hDlg, buf, 
"Initial Digits", MB_OK );
            
/*    SetFocus puts the window back up in case an invalid input is put in.
                For now, take anything. 
*/

            
/* SetFocus( GetDlgItem(hDlg, IDC_EDITDIGS) ); */
            EndDialog(hDlg, wParam);
            
return TRUE;

        
case IDCANCEL:
            EndDialog(hDlg, wParam);
            
return TRUE;
        }

    }

    
return FALSE;
}




void  Msg_display(LPSTR  string )
{
    
int index;
    
    SendMessage(MSIhChildWnd, LB_ADDSTRING, (WPARAM)
0, (LPARAM)string);
    index 
= SendMessage (MSIhChildWnd, LB_GETCARETINDEX, 0,0);
    
if (index>200{
       SendMessage (MSIhChildWnd, LB_DELETESTRING, (WPARAM)
00);
    }

    SendMessage(MSIhChildWnd, LB_SETCARETINDEX, (WPARAM)
++index, (LPARAM)FALSE);
/*
    SendMessage(MainhWnd, LB_ADDSTRING, (WPARAM)0, (LPARAM)string);
    index = SendMessage (MainhWnd, LB_GETCARETINDEX, 0,0);
    if (index>200) {
       SendMessage (MainhWnd, LB_DELETESTRING, (WPARAM)0, 0);
    }
    SendMessage(MainhWnd, LB_SETCARETINDEX, (WPARAM)++index, (LPARAM)FALSE);

*/

}


/****************************************************************
*    Name        :
*    Input Parms    :
*    Description    :
****************************************************************
*/

DWORD WINAPI ThreadDialogic(
void   * x)
// int DefaultProcess(void)
{
      
int channel;      /* set channel with evtp->devchan */
       
//start of my code
      char VoxFile[50],callx[15];
      
char TEXT[1];
      
//end of my code

      channel 
= InitChild();
      
if (channel<=0 )
      
{
          Msg_display(
"Setup channel in child proecee is error"); 
          Sleep(
1000);
          exit (
0);
      }

       
      sprintf(tmpbuf, 
"Channel: %d", channel);                //通道号
      Msg_display(tmpbuf);            
      GetPortMsg(
&PortMsg);
      sprintf(tmpbuf, 
"Caller is: %s", PortMsg.CallerNum);    //主叫号
      Msg_display(tmpbuf);
      strcpy(CallerID,PortMsg.CallerNum);
//send caller to CallerID
      sprintf(tmpbuf, "Called is: %s", PortMsg.CalledNum);    //被叫号
      Msg_display(tmpbuf);
      strcpy(CalledID,PortMsg.CalledNum);
//send called to CalledID
      strcpy(inDate,PortMsg.InDate);//呼叫日期->inDate
      strcpy(inTime,PortMsg.InTime);//呼叫时间->inTime
      
      
//编程开始
      ReadService(channel, &Service);
    
//联通用户提示音
    if(atoi(midstr(PortMsg.CallerNum,0,1))==1)
    
{
//    WriteFeeRate(channel,150);//重写费率
//    goto k;
    sprintf(VoxFile,"%s","95029/pv.vox");
    ClearDTMF();
    PlayFile(VoxFile,ANY_DIG);
    EndChildProcess(
1);
    }

//          if(atoi(midstr(PortMsg.CallerNum),0,2)==85 || atoi(midstr(PortMsg.CallerNum),0,2)==22)
//        {
        sprintf(VoxFile,"%s%d.vox","95029/price/",Service.FeeRate);
        ClearDTMF();
        PlayFile(VoxFile,ANY_DIG);
//}

      sprintf(callx, 
"%s", PortMsg.CallerNum);
/*      if(callx[0]!='1')
      {
          sprintf(VoxFile,"%s%d.vox","95029/price/",Service.FeeRate);
          ClearDTMF();
          Msg_display(VoxFile);
          PlayFile(VoxFile,ANY_DIG);
      }
      else
      {
          sprintf(VoxFile,"%s.vox","95029/price/150");
          ClearDTMF();
          Msg_display(VoxFile);
          PlayFile(VoxFile,ANY_DIG);
      }
*/
      
      
while (strlen(callx)==8 || strlen(callx)==11 || strlen(callx)==12)
      
{
         sprintf(VoxFile,
"%swelcome.vox",Service.Buff[0]);
         ClearDTMF();
         PlayFile(VoxFile,ANY_DIG);
         sprintf(VoxFile,
"%sselecta.vox",Service.Buff[0]);
         ClearDTMF();
         PlayFile(VoxFile,ANY_DIG);
         GetDigit(
1,30,"",TEXT);
         
if(strlen(TEXT)==0)continue;
         
switch (TEXT[0]){
         
case '1'://发送彩信
             sprintf(VoxFile,"%s%s",Service.Buff[0],"introduce1.vox");
             PlayFile(VoxFile,ANY_DIG);
             INPUTSCODE1();         
//输入彩信代码
             INPUTMTYPE1();         //输入手机类型
             INPUTPHONE();          //输入电话号码
             break;
         
case '2'://发送动画
             sprintf(VoxFile,"%s%s",Service.Buff[0],"introduce2.vox");
             PlayFile(VoxFile,ANY_DIG);
             INPUTSCODE2();         
//输入动画代码
             INPUTMTYPE2();         //输入手机类型
             INPUTPHONE();          //输入电话号码
             break;
         
case '3'://发送和弦铃声
             sprintf(VoxFile,"%s%s",Service.Buff[0],"introduce3.vox");
             PlayFile(VoxFile,ANY_DIG);
             INPUTSCODE3();         
//输入和弦铃声代码
             INPUTMTYPE3();         //输入手机类型
             INPUTPHONE();         //输入手机号码
             while(1)
             
{
                 
if(strcmp(STYPE,"99")==0)
                 
{
                     sprintf(VoxFile,
"%s%s",Service.Buff[0],"error.vox");
                     PlayFile(VoxFile,ANY_DIG);
                     
continue;
                 }

                 
break;
             }

             
break;
         
case '4'://人工
             ProgSwitch("88");     
             
break;
         
default:
             sprintf(VoxFile,
"%s%s",Service.Buff[0],"error.vox");
             PlayFile(VoxFile,ANY_DIG);
             
continue;
         }

         sprintf(VoxFile,
"%s%s",Service.Buff[0],"wait.vox");
         ClearDTMF();
         PlayFile(VoxFile,
"%");
         sprintf(PHONE,
"%s",leftstr(PHONE,11));
         sprintf(MTYPE,
"%s",leftstr(MTYPE,2));
         sprintf(STYPE,
"%s",leftstr(STYPE,2));
         sprintf(CODE,
"%s",leftstr(CODE,6));
         sprintf(VoxFile,
"PHONE is:%s",PHONE);
         Msg_display(VoxFile);
         sprintf(VoxFile,
"MTYPE is:%s",MTYPE);
         Msg_display(VoxFile);
         sprintf(VoxFile,
"STYPE is:%s",STYPE);
         Msg_display(VoxFile);
         sprintf(VoxFile,
"CODE is:%s",CODE);
         Msg_display(VoxFile);
         ClearDTMF();
re22:
         SendMsg();         
//发送信息到互联网
         if(result==-18)goto re22;
         SAVEDATA();         
//存储发送信息
         ClearDTMF();
         
if(result==0)
         
{
             sprintf(VoxFile,
"%s%s",Service.Buff[0],"complete.vox");
             PlayFile(VoxFile,ANY_DIG);
         }

         
else
         
{
             sprintf(VoxFile,
"%s%s","95029/vox/","error.vox");
             PlayFile(VoxFile,ANY_DIG);
         }

         
continue;
      }

      PlayFile(
"pubvox/noplay.VOX",ANY_DIG);
      exit (
0);
}


void  INPUTSCODE1()          // 输入彩信代码
{
    
char MesgName[100],yn[1];
    
while(1)
    
{
        sprintf(MesgName,
"%sincode1.vox",Service.Buff[0]);//输入要发送的彩信代码
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
6,120,"#",CODE);
        
if(strlen(CODE)==0)continue;
        
if(strlen(CODE)!=6||CODE[5]=='#')
        
{
            sprintf(MesgName,
"%s%s",Service.Buff[0],"error.vox");
            PlayFile(MesgName,ANY_DIG);
            
continue;
         }

        sprintf(MesgName,
"%scodeis.vox",Service.Buff[0]);
        PlayFile(MesgName,ANY_DIG);     
//报要发送的彩信代码
        PlayDigit(CODE,"%");
        sprintf(MesgName,
"%s%s",Service.Buff[0],"yesno.vox");//确认
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
1,30,"",yn);
        
if(yn[0]!='1')continue;
        Msg_display(CODE);
        
return;
    }

}


void  INPUTMTYPE1()          // 输入手机类型
{
    
char MesgName[100],TEXT[1],yn[1];

    
while(1)
    
{
        sprintf(MesgName,
"%smtype1.vox",Service.Buff[0]);//输入手机类型
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
1,30,"1234",TEXT);
        
if(strlen(TEXT)==0)continue;
        
if(TEXT[0]=='0'||TEXT[0]=='*'||TEXT[0]=='#')
        
{
            sprintf(MesgName,
"%s%s",Service.Buff[0],"error.vox");
            PlayFile(MesgName,ANY_DIG);
            
continue;
        }

        
if(strcmp(TEXT,"1")==0)
        
{
            sprintf(MTYPE,
"01");
        }

        
if(strcmp(TEXT,"2")==0)
        
{
            sprintf(MTYPE,
"02");
        }

        
if(strcmp(TEXT,"3")==0)
        
{
            sprintf(MTYPE,
"04");
        }

        
if(strcmp(TEXT,"4")==0)
        
{
            sprintf(MTYPE,
"05");
        }

        
if(strcmp(TEXT,"5")==0)
        
{
            sprintf(MTYPE,
"07");
        }

        
if(strcmp(TEXT,"6")==0)
        
{
            sprintf(MTYPE,
"10");
        }

        
if(strcmp(TEXT,"7")==0)
        
{
            sprintf(MTYPE,
"13");
        }

        
if(strcmp(TEXT,"8")==0)
        
{
            sprintf(MTYPE,
"14");
        }

        
if(strcmp(TEXT,"9")==0)
        
{
            sprintf(MTYPE,
"15");
        }

        sprintf(STYPE,
"10");
        sprintf(MesgName,
"%s%s",Service.Buff[0],"mtypeis.vox");
        PlayFile(MesgName,
"%");
        sprintf(MesgName,
"%s%s%s%s",Service.Buff[0],"mtype",MTYPE,".vox");
        PlayFile(MesgName,
"%");
        sprintf(MesgName,
"%s%s",Service.Buff[0],"yesno.vox");//确认
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
1,30,"",yn);
        
if(yn[0]!='1')continue;
        Msg_display(MTYPE);
        Msg_display(STYPE);
        
return;
    }

}


void  INPUTSCODE2()          // 输入动画代码
{
    
char MesgName[100],yn[1];
    
while(1)
    
{
        sprintf(MesgName,
"%sincode2.vox",Service.Buff[0]);//输入要发送的动画代码
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
6,120,"#",CODE);
        
if(strlen(CODE)==0)continue;
        
if(strlen(CODE)!=6||CODE[5]=='#')
        
{
            sprintf(MesgName,
"%s%s",Service.Buff[0],"error.vox");
            PlayFile(MesgName,ANY_DIG);
            
continue;
         }

        sprintf(MesgName,
"%scodeis.vox",Service.Buff[0]);
        PlayFile(MesgName,ANY_DIG);     
//报要发送的动画代码
        PlayDigit(CODE,"%");
        sprintf(MesgName,
"%s%s",Service.Buff[0],"yesno.vox");//确认
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
1,30,"",yn);
        
if(yn[0]!='1')continue;
        Msg_display(CODE);
        
return;
    }

}


void  INPUTMTYPE2()          // 输入手机类型
{
    
char MesgName[100],TEXT[1],yn[1];

    
while(1)
    
{
        sprintf(MesgName,
"%smtype2.vox",Service.Buff[0]);//输入手机类型
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
1,30,"1234",TEXT);
        
if(strlen(TEXT)==0)continue;
        
if(TEXT[0]=='0'||TEXT[0]=='*'||TEXT[0]=='#'||strcmp(TEXT,"7")>0)
        
{
            sprintf(MesgName,
"%s%s",Service.Buff[0],"error.vox");
            PlayFile(MesgName,ANY_DIG);
            
continue;
        }

        
if(strcmp(TEXT,"1")==0)
        
{
            sprintf(MTYPE,
"01");
        }

        
if(strcmp(TEXT,"2")==0)
        
{
            sprintf(MTYPE,
"02");
        }

        
if(strcmp(TEXT,"3")==0)
        
{
            sprintf(MTYPE,
"04");
        }

        
if(strcmp(TEXT,"4")==0)
        
{
            sprintf(MTYPE,
"05");
        }

        
if(strcmp(TEXT,"5")==0)
        
{
            sprintf(MTYPE,
"07");
        }

        
if(strcmp(TEXT,"6")==0)
        
{
            sprintf(MTYPE,
"13");
        }

        
if(strcmp(TEXT,"7")==0)
        
{
            sprintf(MTYPE,
"15");
        }

        sprintf(STYPE,
"11");
        sprintf(MesgName,
"%s%s",Service.Buff[0],"mtypeis.vox");
        PlayFile(MesgName,
"%");
        sprintf(MesgName,
"%s%s%s%s",Service.Buff[0],"mtype",MTYPE,".vox");
        PlayFile(MesgName,
"%");
        sprintf(MesgName,
"%s%s",Service.Buff[0],"yesno.vox");//确认
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
1,30,"",yn);
        
if(yn[0]!='1')continue;
        Msg_display(MTYPE);
        Msg_display(STYPE);
        
return;
    }

}


void  INPUTSCODE3()          // 输入和弦铃声代码
{
    
char MesgName[100],yn[1];
    
while(1)
    
{
        sprintf(MesgName,
"%sincode3.vox",Service.Buff[0]);//输入要发送的和弦铃声代码
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
6,120,"#",CODE);
        
if(strlen(CODE)==0)continue;
        
if(strlen(CODE)!=6||CODE[5]=='#')
        
{
            sprintf(MesgName,
"%s%s",Service.Buff[0],"error.vox");
            PlayFile(MesgName,ANY_DIG);
            
continue;
         }

        sprintf(MesgName,
"%scodeis.vox",Service.Buff[0]);
        PlayFile(MesgName,ANY_DIG);     
//报要发送的代码
        PlayDigit(CODE,"%");
re11:
        sprintf(MesgName,
"%s%s",Service.Buff[0],"listen1.vox");//确认
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
1,30,"",yn);
        
if(yn[0]=='2')
        
{
            sprintf(MesgName,
"%s%s%s","95029/92/midvox/05",CODE,".vox");//确认
            PlayFile(MesgName,ANY_DIG);
            
goto re11;
        }

        
if(yn[0]=='3')
        
{
            sprintf(MesgName,
"%s%s%s","95029/92/oldvox/",CODE,".vox");
            PlayFile(MesgName,ANY_DIG);
            
goto re11;
        }

        
if(yn[0]!='1')continue;
        Msg_display(CODE);
        
return;
    }

}


void  INPUTMTYPE3()          // 输入手机类型
{
    
char MesgName[100],TEXT[2],yn[1];

    
while(1)
    
{
        sprintf(MesgName,
"%smtype3.vox",Service.Buff[0]);//输入手机类型
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
2,50,"",TEXT);
        
if(strlen(TEXT)<2)continue;
        
if(TEXT[0]=='*'||TEXT[0]=='#'||TEXT[1]=='*'||TEXT[1]=='#'||strcmp(TEXT,"00")==0||strcmp(TEXT,"11")>0)
        
{
            sprintf(MesgName,
"%s%s",Service.Buff[0],"error.vox");
            PlayFile(MesgName,ANY_DIG);
            
continue;
        }

        
if(strcmp(TEXT,"01")==0)
        
{
            sprintf(MTYPE,
"01");
        }

        
if(strcmp(TEXT,"02")==0)
        
{
            sprintf(MTYPE,
"07");
        }

        
if(strcmp(TEXT,"03")==0)
        
{
            sprintf(MTYPE,
"05");
        }

        
if(strcmp(TEXT,"04")==0)
        
{
            sprintf(MTYPE,
"04");
        }

        
if(strcmp(TEXT,"05")==0)
        
{
            sprintf(MTYPE,
"02");
        }

        
if(strcmp(TEXT,"06")==0)
        
{
            sprintf(MTYPE,
"13");
        }

        
if(strcmp(TEXT,"07")==0)
        
{
            sprintf(MTYPE,
"01");
        }

        
if(strcmp(TEXT,"08")==0)
        
{
            sprintf(MTYPE,
"15");
        }

        
if(strcmp(TEXT,"09")==0)
        
{
            sprintf(MTYPE,
"08");
        }

        
if(strcmp(TEXT,"10")==0)
        
{
            sprintf(MTYPE,
"14");
        }

        
if(strcmp(TEXT,"11")==0)
        
{
            sprintf(MTYPE,
"16");
        }

        sprintf(STYPE,
"12");
        sprintf(MesgName,
"%s%s",Service.Buff[0],"mtypeis.vox");
        PlayFile(MesgName,
"%");
        sprintf(MesgName,
"%s%s%s%s",Service.Buff[0],"mtype",MTYPE,".vox");
        PlayFile(MesgName,
"%");
        sprintf(MesgName,
"%s%s",Service.Buff[0],"yesno.vox");//确认
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
1,30,"",yn);
        
if(yn[0]!='1')continue;
        Msg_display(MTYPE);
        Msg_display(STYPE);
        
return;
    }

}


void  INPUTPHONE()          // 输入手机号码
{
    
char MesgName[100],yn[1];

    
while(1)
    
{
        sprintf(MesgName,
"%sinputnum.vox",Service.Buff[0]);//输入手机号码
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
11,180,"#",PHONE);
        
if(strlen(PHONE)==0)continue;
        
if(strlen(PHONE)!=11 || (PHONE[10]=='#'|| (PHONE[0]!='1'))
        
{
        sprintf(MesgName,
"%s%s",Service.Buff[0],"error.vox");
        PlayFile(MesgName,ANY_DIG);
        
continue;
        }

        sprintf(MesgName,
"%snumis.vox",Service.Buff[0]);
        PlayFile(MesgName,ANY_DIG);     
//报手机号码
        PlayDigit(PHONE,ANY_DIG);
        sprintf(MesgName,
"%s%s",Service.Buff[0],"yesno.vox");//确认
        PlayFile(MesgName,ANY_DIG);
        GetDigit(
1,30,"",yn);
        
if(yn[0]!='1')continue;
        Msg_display(PHONE);
        
return;
    }

}


void  SAVEDATA()          // 存储发送信息
{
    
char DbaseName[100],stryear[2],strmonth[2],strdate[2];
    
char stats[100];
    
int fh1;

    strcpy(stryear,midstr(inDate,
8,2)); //得到当前年份
    strcpy(strmonth,midstr(inDate,0,2)); //得到当前月份
    strcpy(strdate,midstr(inDate,3,2)); //得到当前日期
    sprintf(DbaseName,"sendmsg/s%s%s%s.txt",stryear,strmonth,strdate);
//    memset(stats,0,100);
    sprintf(stats,"%11s %11s %2s %2s %3d %8s %8s %11s %9s ",CallerID,PHONE,MTYPE,STYPE,result,CODE,CalledID,inDate,inTime);
    fh1 
= _open(DbaseName, _O_RDWR | _O_CREAT|_O_APPEND,_S_IREAD |_S_IWRITE);
    
if( fh1 == -1 )
        perror(DbaseName);
    
if( _write( fh1, stats, strlen(stats)) == -1 )
        perror(DbaseName);
    _close(fh1);
}


void  SendMsg()          // 发送信息到互联网
{
    HINSTANCE hDLL;
    typedef 
int (CALLBACK * t_post)(char *to,char* mobiletype, char *smstype ,char *smscode);
    t_post tpost;

    hDLL
=LoadLibrary("sendmsg.dll");
    
if(hDLL!=NULL)
    
{
        tpost
=(t_post)GetProcAddress(hDLL,"post");
        
if(    tpost!=NULL)
        
{
            
            result
=tpost(PHONE,MTYPE,STYPE,CODE);
        }

        
else
        
{
            MessageBox(NULL,
"error","Error",0);
        }

        FreeLibrary(hDLL);
    }

    
else
    
{
        MessageBox(NULL,
"error","Error",0);
    }

    
return;
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值