/* iaxclient.i Copyright (C) 2006 Mikael Magnusson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ %module(directors="1") iaxc %import; %include typemaps.i %include carrays.i %feature("director") Callback; /* iaxc_audio_devices_get typemaps */ %typemap(ctype) iaxc_audio_device **OUTPUT "void *" %typemap(imtype, out="IntPtr") iaxc_audio_device **OUTPUT "out IntPtr" %typemap(cstype) iaxc_audio_device **OUTPUT "out AudioDevices" %typemap(csin) iaxc_audio_device **OUTPUT "out ptr1" %typemap(csout) int iaxc_audio_devices_get { IntPtr ptr1 = IntPtr.Zero; int ret = $imcall;$excode; devs = (ptr1 == IntPtr.Zero) ? null : new AudioDevices(ptr1, $owner);$excode; return ret; } %typemap(in) iaxc_audio_device **OUTPUT %{ $1 = ($1_ltype)$input; %} %apply int *OUTPUT { int *input }; %apply int *OUTPUT { int *output }; %apply int *OUTPUT { int *ring }; %apply int *OUTPUT { int *nDevs }; %apply iaxc_audio_device **OUTPUT { iaxc_audio_device **devs }; /* iaxc_get_netstats typemap */ %apply int *OUTPUT { int *rtt }; /* Undefined */ %ignore iaxc_service_audio(); %ignore iaxc_was_call_answered(); %ignore iaxc_video_mode_set; %ignore iaxc_video_mode_get; %ignore iaxc_video_format_set; /* Ignore */ %ignore iaxc_set_event_callback; %ignore iaxc_get_event_levels; %ignore iaxc_get_event_text; %ignore iaxc_get_event_state; %ignore iaxc_set_event_callpost(void *handle, int id); %ignore iaxc_set_networking(iaxc_sendto_t st, iaxc_recvfrom_t rf); %ignore iaxc_play_sound(struct iaxc_sound *sound, int ring); %ignore iaxc_stop_sound(int id); %ignore iaxc_set_files(FILE *input, FILE *output); %ignore iaxc_sound; %ignore iaxc_ev_video; /* Defined inline in Version below */ %ignore iaxc_version; /* Rename methods */ %rename(AnswerCall) iaxc_answer_call; %rename(AudioDevicesGet) iaxc_audio_devices_get; %rename(AudioDevicesSet) iaxc_audio_devices_set; %rename(BlindTransferCall) iaxc_blind_transfer_call; %rename(Call) iaxc_call; %rename(DumpAllCalls) iaxc_dump_all_calls; %rename(DumpCall) iaxc_dump_call; %rename(FirstFreeCall) iaxc_first_free_call; %rename(FreeEvent) iaxc_free_event; %rename(GetFilters) iaxc_get_filters; %rename(GetNetstats) iaxc_get_netstats; %rename(Initialize) iaxc_initialize; %rename(InputLevelGet) iaxc_input_level_get; %rename(InputLevelSet) iaxc_input_level_set; %rename(MicBoostGet) iaxc_mic_boost_get; %rename(MicBoostSet) iaxc_mic_boost_set; %rename(Millisleep) iaxc_millisleep; %rename(OutputLevelGet) iaxc_output_level_get; %rename(OutputLevelSet) iaxc_output_level_set; %rename(ProcessCalls) iaxc_process_calls; %rename(Quelch) iaxc_quelch; %rename(Register) iaxc_register; %rename(RejectCall) iaxc_reject_call; %rename(RejectCallNumber) iaxc_reject_call_number; %rename(SelectCall) iaxc_select_call; %rename(SelectedCall) iaxc_selected_call; %rename(SendDtmf) iaxc_send_dtmf; %rename(SendText) iaxc_send_text; %rename(SendUrl) iaxc_send_url; %rename(ServiceAudio) iaxc_service_audio; %rename(SetAudioOutput) iaxc_set_audio_output; %rename(SetCallerId) iaxc_set_callerid; %rename(SetFilters) iaxc_set_filters; %rename(SetFormats) iaxc_set_formats; %rename(SetMinOutgoingFrameSize) iaxc_set_min_outgoing_framesize; %rename(SetSilenceThreshold) iaxc_set_silence_threshold; %rename(SetSpeexSettings) iaxc_set_speex_settings; %rename(Shutdown) iaxc_shutdown; %rename(StartProcessingThread) iaxc_start_processing_thread; %rename(StopProcessingThread) iaxc_stop_processing_thread; %rename(Unquelch) iaxc_unquelch; %rename(Unregister) iaxc_unregister; %rename(WasCallAnswered) iaxc_was_call_answered; //%rename(GetEventLevels) iaxc_get_event_levels; //%rename(GetEventState) iaxc_get_event_state; //%rename(GetEventText) iaxc_get_event_text; /* Rename types */ %rename(Event) iaxc_event_struct; %rename(EventUnion) iaxc_event_ev; %rename(EventLevels) iaxc_ev_levels; %rename(EventText) iaxc_ev_text; %rename(EventCallState) iaxc_ev_call_state; %rename(EventNetstats) iaxc_ev_netstats; %rename(EventUrl) iaxc_ev_url; //%rename(EventVideo) iaxc_ev_video; %rename(EventRegistration) iaxc_ev_registration; %rename(AudioDevice) iaxc_audio_device; %rename(Netstat) iaxc_netstat; //%pointer_class(short, shortp); %{ #include #include %} %array_class(iaxc_audio_device,AudioDevices) %include %inline %{ class Callback { public: virtual ~Callback() {} virtual int DoEventCallback(iaxc_event e)=0; }; %} %{ Callback *current_callback; #include int iaxclient_event_callback(iaxc_event e) { int res = -2; if(current_callback) res = current_callback->DoEventCallback(e); return res; } %} %inline %{ void SetCallback(Callback *cb) { current_callback = cb; if (current_callback) { iaxc_set_event_callback(iaxclient_event_callback); } else { iaxc_set_event_callback(NULL); } } const char *Version(void) { static char buf[IAXC_EVENT_BUFSIZ] = ""; return iaxc_version(buf); } %}