From: <st...@us...> - 2003-06-16 23:01:31
|
Update of /cvsroot/iaxclient/iaxclient/simpleclient/WinIAX In directory sc8-pr-cvs1:/tmp/cvs-serv20862/simpleclient/WinIAX Modified Files: WinIAX.cpp Log Message: A pretty big commit. 1) Change the overall "event" callback mechanism, to use a structure/union, with just one callback for all events. clients can accept or decline each event, in which case the library might take a "default" action for the event. (currently, the library will ignore all events except for text, which it will print to stderr/stdout). 2) Totally rework call handling, and allow the library to manage multiple calls. Call state is more or less followed through the lifetime of the call, but may not be right in all cases. 3) Implement call appearances based on all of this in wx. 4) Make testcall work with this (only one call). 5) Try to keep Faizan's "WinIAX" client up to date with the API changes, haven't tested the changes there, but they should work for one call. 6) #define out the WIN AUDIO stuff, it's pretty far behind now, and would need some work to get going. portaudio seems to handle the gory details for us very nicely. Need to do more testing with all of this, but this now allows you to make IAXClient -> IAXClient calls. Of course, allowing people to reject calls would be nice too, but I suppose you can always hang up :) Index: WinIAX.cpp =================================================================== RCS file: /cvsroot/iaxclient/iaxclient/simpleclient/WinIAX/WinIAX.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WinIAX.cpp 13 Jun 2003 22:32:00 -0000 1.1 +++ WinIAX.cpp 16 Jun 2003 23:01:29 -0000 1.2 @@ -14,6 +14,7 @@ #define LEVEL_MIN -50 #define TIMER_PROCESS_CALLS 1001 +int iaxc_callback(iaxc_event e); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, @@ -176,12 +177,12 @@ // TMessageBox("OnInitDialog"); double silence_threshold = -99; - iaxc_initialize(AUDIO_INTERNAL_PA); + iaxc_initialize(AUDIO_INTERNAL_PA,1); iaxc_set_encode_format(IAXC_FORMAT_GSM); iaxc_set_silence_threshold(silence_threshold); - iaxc_set_error_callback(status_callback); - iaxc_set_levels_callback(levels_callback); + iaxc_set_event_callback(iaxc_callback); + iaxc_start_processing_thread(); PostMessage(GetDlgItem(m_hwndMainDlg,IDC_PROG_OUTPUT),PBM_SETRANGE,0,LEVEL_MIN-LEVEL_MAX); PostMessage(GetDlgItem(m_hwndMainDlg,IDC_PROG_INPUT),PBM_SETRANGE,0,LEVEL_MIN-LEVEL_MAX); @@ -218,9 +219,10 @@ { iaxc_dump_call(); } -void status_callback(char *msg) +int status_callback(char *msg) { SetDlgItemText(m_hwndMainDlg,IDC_ST_STATUS,msg); + return 1 } int levels_callback(float input, float output) @@ -248,9 +250,24 @@ // Set // theFrame->input->SetValue(inputLevel); // theFrame->output->SetValue(outputLevel); - return 0; + return 1; } +int iaxc_callback(iaxc_event e) +{ + switch(e.type) { + case IAXC_EVENT_LEVELS: + return levels_callback(e.ev.levels.input, e.ev.levels.output); + case IAXC_EVENT_TEXT: + return status_callback(e.ev.text.message); +// case IAXC_EVENT_STATE: +// return state_callback(e.ev.call); + default: + return 0; // not handled + } +} + + void SendDTMF(char num) { iaxc_send_dtmf(num); @@ -279,4 +296,4 @@ { iaxc_process_calls(); } -} \ No newline at end of file +} |