]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9924: Removed extra space in source files
authorSergey Safarov <s.safarov@gmail.com>
Fri, 6 Jan 2017 07:10:15 +0000 (02:10 -0500)
committerSergey Safarov <s.safarov@gmail.com>
Fri, 10 Feb 2017 04:59:49 +0000 (23:59 -0500)
455 files changed:
src/fs_encode.c
src/include/g711.h
src/include/private/switch_core_pvt.h
src/include/private/switch_hashtable_private.h
src/include/switch.h
src/include/switch_apr.h
src/include/switch_bitpack.h
src/include/switch_buffer.h
src/include/switch_caller.h
src/include/switch_channel.h
src/include/switch_config.h
src/include/switch_console.h
src/include/switch_core.h
src/include/switch_core_db.h
src/include/switch_core_event_hook.h
src/include/switch_core_media.h
src/include/switch_core_video.h
src/include/switch_cpp.h
src/include/switch_curl.h
src/include/switch_dso.h
src/include/switch_estimators.h
src/include/switch_event.h
src/include/switch_frame.h
src/include/switch_hashtable.h
src/include/switch_ivr.h
src/include/switch_jitterbuffer.h
src/include/switch_json.h
src/include/switch_limit.h
src/include/switch_loadable_module.h
src/include/switch_log.h
src/include/switch_module_interfaces.h
src/include/switch_nat.h
src/include/switch_odbc.h
src/include/switch_pgsql.h
src/include/switch_platform.h
src/include/switch_profile.h
src/include/switch_regex.h
src/include/switch_resample.h
src/include/switch_rtp.h
src/include/switch_scheduler.h
src/include/switch_stun.h
src/include/switch_types.h
src/include/switch_utils.h
src/include/switch_xml.h
src/include/switch_xml_config.h
src/mod/applications/mod_abstraction/mod_abstraction.c
src/mod/applications/mod_av/avcodec.c
src/mod/applications/mod_av/avformat.c
src/mod/applications/mod_avmd/avmd_desa2_tweaked.c
src/mod/applications/mod_avmd/avmd_fast_acosf.c
src/mod/applications/mod_avmd/avmd_goertzel.c
src/mod/applications/mod_avmd/mod_avmd.c
src/mod/applications/mod_bert/mod_bert.c
src/mod/applications/mod_blacklist/mod_blacklist.c
src/mod/applications/mod_callcenter/conf/autoload_configs/callcenter.conf.xml
src/mod/applications/mod_cidlookup/conf/autoload_configs/cidlookup.conf.xml
src/mod/applications/mod_cidlookup/mod_cidlookup.c
src/mod/applications/mod_cluechoo/mod_cluechoo.c
src/mod/applications/mod_cluechoo/sl.h
src/mod/applications/mod_commands/mod_commands.c
src/mod/applications/mod_conference/conf/autoload_configs/conference.conf.xml
src/mod/applications/mod_conference/conference_api.c
src/mod/applications/mod_conference/conference_event.c
src/mod/applications/mod_conference/conference_file.c
src/mod/applications/mod_conference/conference_loop.c
src/mod/applications/mod_conference/conference_member.c
src/mod/applications/mod_conference/conference_record.c
src/mod/applications/mod_conference/conference_video.c
src/mod/applications/mod_conference/mod_conference.c
src/mod/applications/mod_curl/mod_curl.c
src/mod/applications/mod_cv/mod_cv.cpp
src/mod/applications/mod_db/mod_db.c
src/mod/applications/mod_directory/mod_directory.c
src/mod/applications/mod_distributor/conf/dialplan/distributor.xml
src/mod/applications/mod_distributor/mod_distributor.c
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/applications/mod_easyroute/conf/autoload_configs/easyroute.conf.xml
src/mod/applications/mod_easyroute/mod_easyroute.c
src/mod/applications/mod_enum/mod_enum.c
src/mod/applications/mod_esf/mod_esf.c
src/mod/applications/mod_esl/mod_esl.c
src/mod/applications/mod_expr/conio.h
src/mod/applications/mod_expr/mod_expr.c
src/mod/applications/mod_fifo/conf/dialplan/fifo.xml
src/mod/applications/mod_fifo/mod_fifo.c
src/mod/applications/mod_fsk/fsk.c
src/mod/applications/mod_fsk/fsk.h
src/mod/applications/mod_fsk/fsk_callerid.c
src/mod/applications/mod_fsk/fsk_callerid.h
src/mod/applications/mod_fsk/mod_fsk.c
src/mod/applications/mod_fsv/mod_fsv.c
src/mod/applications/mod_hash/mod_hash.c
src/mod/applications/mod_hiredis/hiredis_profile.c
src/mod/applications/mod_hiredis/hiredis_utils.c
src/mod/applications/mod_hiredis/mod_hiredis.c
src/mod/applications/mod_httapi/conf/autoload_configs/httapi.conf.xml
src/mod/applications/mod_httapi/mod_httapi.c
src/mod/applications/mod_http_cache/mod_http_cache.c
src/mod/applications/mod_http_cache/test_aws/main.c
src/mod/applications/mod_ladspa/conf/dialplan/00_ladspa.xml
src/mod/applications/mod_ladspa/mod_ladspa.c
src/mod/applications/mod_ladspa/utils.h
src/mod/applications/mod_lcr/conf/autoload_configs/lcr.conf.xml
src/mod/applications/mod_lcr/conf/dialplan/lcr.xml
src/mod/applications/mod_limit/conf/dialplan/limit.xml
src/mod/applications/mod_limit/mod_limit.c
src/mod/applications/mod_memcache/mod_memcache.c
src/mod/applications/mod_mp4/mod_mp4.cpp
src/mod/applications/mod_mp4/mp4_helper.cpp
src/mod/applications/mod_nibblebill/mod_nibblebill.c
src/mod/applications/mod_oreka/mod_oreka.c
src/mod/applications/mod_rad_auth/mod_rad_auth.c
src/mod/applications/mod_random/mod_random.c
src/mod/applications/mod_redis/credis.c
src/mod/applications/mod_redis/credis.h
src/mod/applications/mod_redis/mod_redis.c
src/mod/applications/mod_rss/mod_rss.c
src/mod/applications/mod_skel/mod_skel.c
src/mod/applications/mod_sms/mod_sms.c
src/mod/applications/mod_sms_flowroute/mod_sms_flowroute.c
src/mod/applications/mod_sms_flowroute/mod_sms_flowroute.h
src/mod/applications/mod_snapshot/mod_snapshot.c
src/mod/applications/mod_snom/conf/dialplan/snom_demo.xml
src/mod/applications/mod_snom/mod_snom.c
src/mod/applications/mod_sonar/mod_sonar.c
src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml
src/mod/applications/mod_spandsp/mod_spandsp.c
src/mod/applications/mod_spandsp/mod_spandsp_codecs.c
src/mod/applications/mod_spandsp/mod_spandsp_dsp.c
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
src/mod/applications/mod_spandsp/mod_spandsp_modem.c
src/mod/applications/mod_spandsp/mod_spandsp_modem.h
src/mod/applications/mod_spandsp/udptl.c
src/mod/applications/mod_spandsp/udptl.h
src/mod/applications/mod_spy/mod_spy.c
src/mod/applications/mod_stress/FFTReal.cpp
src/mod/applications/mod_stress/mod_stress.cpp
src/mod/applications/mod_translate/mod_translate.c
src/mod/applications/mod_valet_parking/mod_valet_parking.c
src/mod/applications/mod_vmd/mod_vmd.c
src/mod/applications/mod_voicemail/conf/autoload_configs/voicemail.conf.xml
src/mod/applications/mod_voicemail/mod_voicemail.c
src/mod/applications/mod_voicemail_ivr/conf/autoload_configs/voicemail_ivr.conf.xml
src/mod/applications/mod_voicemail_ivr/config.c
src/mod/applications/mod_voicemail_ivr/config.h
src/mod/applications/mod_voicemail_ivr/ivr.c
src/mod/applications/mod_voicemail_ivr/ivr.h
src/mod/applications/mod_voicemail_ivr/menu.c
src/mod/applications/mod_voicemail_ivr/menu.h
src/mod/applications/mod_voicemail_ivr/mod_voicemail_ivr.c
src/mod/applications/mod_voicemail_ivr/utils.c
src/mod/applications/mod_voicemail_ivr/utils.h
src/mod/asr_tts/mod_cepstral/conf/cepstral.conf.xml
src/mod/asr_tts/mod_cepstral/mod_cepstral.c
src/mod/asr_tts/mod_flite/mod_flite.c
src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
src/mod/codecs/mod_amr/amr_be.c
src/mod/codecs/mod_amr/amr_be.h
src/mod/codecs/mod_amr/bitshift.c
src/mod/codecs/mod_amr/bitshift.h
src/mod/codecs/mod_amr/mod_amr.c
src/mod/codecs/mod_amrwb/amrwb_be.c
src/mod/codecs/mod_amrwb/amrwb_be.h
src/mod/codecs/mod_amrwb/bitshift.c
src/mod/codecs/mod_amrwb/bitshift.h
src/mod/codecs/mod_amrwb/mod_amrwb.c
src/mod/codecs/mod_b64/mod_b64.c
src/mod/codecs/mod_bv/mod_bv.c
src/mod/codecs/mod_codec2/mod_codec2.c
src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c
src/mod/codecs/mod_g723_1/mod_g723_1.c
src/mod/codecs/mod_g729/mod_g729.c
src/mod/codecs/mod_h26x/mod_h26x.c
src/mod/codecs/mod_ilbc/mod_ilbc.c
src/mod/codecs/mod_isac/bandwidth_estimator.c
src/mod/codecs/mod_isac/complex_fft.c
src/mod/codecs/mod_isac/cross_correlation.c
src/mod/codecs/mod_isac/encode.c
src/mod/codecs/mod_isac/encode_lpc_swb.h
src/mod/codecs/mod_isac/fft.c
src/mod/codecs/mod_isac/mod_isac.c
src/mod/codecs/mod_isac/resample_by_2.c
src/mod/codecs/mod_isac/signal_processing_library.h
src/mod/codecs/mod_isac/spectrum_ar_model_tables.h
src/mod/codecs/mod_mp4v/mod_mp4v.c
src/mod/codecs/mod_openh264/mod_openh264.cpp
src/mod/codecs/mod_opus/mod_opus.c
src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c
src/mod/codecs/mod_silk/mod_silk.c
src/mod/codecs/mod_siren/mod_siren.c
src/mod/codecs/mod_skel_codec/mod_skel_codec.c
src/mod/codecs/mod_theora/mod_theora.c
src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
src/mod/directories/mod_ldap/mod_ldap.c
src/mod/endpoints/mod_alsa/mod_alsa.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_gsmopen/gsmopen.h
src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp
src/mod/endpoints/mod_h323/mod_h323.cpp
src/mod/endpoints/mod_h323/mod_h323.h
src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml
src/mod/endpoints/mod_khomp/mod_khomp.cpp
src/mod/endpoints/mod_khomp/src/applications.cpp
src/mod/endpoints/mod_khomp/src/cli.cpp
src/mod/endpoints/mod_khomp/src/frame.cpp
src/mod/endpoints/mod_khomp/src/globals.cpp
src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp
src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp
src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp
src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp
src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp
src/mod/endpoints/mod_khomp/src/lock.cpp
src/mod/endpoints/mod_khomp/src/logger.cpp
src/mod/endpoints/mod_khomp/src/opt.cpp
src/mod/endpoints/mod_khomp/src/spec.cpp
src/mod/endpoints/mod_khomp/src/utils.cpp
src/mod/endpoints/mod_loopback/mod_loopback.c
src/mod/endpoints/mod_portaudio/conf/autoload_configs/portaudio.conf.xml
src/mod/endpoints/mod_portaudio/mod_portaudio.c
src/mod/endpoints/mod_portaudio/pa_ringbuffer.c
src/mod/endpoints/mod_portaudio/pa_ringbuffer.h
src/mod/endpoints/mod_portaudio/pablio.c
src/mod/endpoints/mod_portaudio/pablio.h
src/mod/endpoints/mod_reference/mod_reference.c
src/mod/endpoints/mod_rtc/mod_rtc.c
src/mod/endpoints/mod_rtmp/libamf/src/amf0.c
src/mod/endpoints/mod_rtmp/libamf/src/hash.c
src/mod/endpoints/mod_rtmp/mod_rtmp.c
src/mod/endpoints/mod_rtmp/rtmp_sig.c
src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml
src/mod/endpoints/mod_skinny/mod_skinny.c
src/mod/endpoints/mod_skinny/mod_skinny.h
src/mod/endpoints/mod_skinny/skinny_api.c
src/mod/endpoints/mod_skinny/skinny_api.h
src/mod/endpoints/mod_skinny/skinny_protocol.c
src/mod/endpoints/mod_skinny/skinny_protocol.h
src/mod/endpoints/mod_skinny/skinny_server.c
src/mod/endpoints/mod_skinny/skinny_server.h
src/mod/endpoints/mod_skinny/skinny_tables.c
src/mod/endpoints/mod_skinny/skinny_tables.h
src/mod/endpoints/mod_skypopen/configs/client.c
src/mod/endpoints/mod_skypopen/mod_skypopen.c
src/mod/endpoints/mod_skypopen/old-stuff/asterisk/chan_skypiax.c
src/mod/endpoints/mod_skypopen/old-stuff/asterisk/skypiax.h
src/mod/endpoints/mod_skypopen/old-stuff/pcm_lib.c
src/mod/endpoints/mod_skypopen/old-stuff/pcm_native.c
src/mod/endpoints/mod_skypopen/oss/main.c
src/mod/endpoints/mod_skypopen/oss/skypopen.h
src/mod/endpoints/mod_skypopen/skypopen_protocol.c
src/mod/endpoints/mod_sofia/conf/sofia.conf.xml
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/rtp.c
src/mod/endpoints/mod_sofia/sip-dig.c
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_media.c
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_reg.c
src/mod/endpoints/mod_unicall/mod_unicall.c
src/mod/endpoints/mod_verto/mcast/mcast.c
src/mod/endpoints/mod_verto/mcast/mcast.h
src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp
src/mod/endpoints/mod_verto/mcast/mcast_cpp.h
src/mod/endpoints/mod_verto/mcast/mcast_wrap.cpp
src/mod/endpoints/mod_verto/mcast/test.c
src/mod/endpoints/mod_verto/mod_verto.c
src/mod/endpoints/mod_verto/mod_verto.h
src/mod/endpoints/mod_verto/ws.c
src/mod/endpoints/mod_verto/ws.h
src/mod/event_handlers/mod_amqp/mod_amqp.h
src/mod/event_handlers/mod_amqp/mod_amqp_command.c
src/mod/event_handlers/mod_amqp/mod_amqp_logging.c
src/mod/event_handlers/mod_amqp/mod_amqp_producer.c
src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_standard.c
src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_win32.c
src/mod/event_handlers/mod_cdr_mongodb/driver/src/gridfs.c
src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c
src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c
src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c
src/mod/event_handlers/mod_erlang_event/conf/autoload_configs/erlang_event.conf.xml
src/mod/event_handlers/mod_erlang_event/ei_helpers.c
src/mod/event_handlers/mod_erlang_event/handle_msg.c
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h
src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
src/mod/event_handlers/mod_event_socket/mod_event_socket.c
src/mod/event_handlers/mod_event_test/mod_event_test.c
src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp
src/mod/event_handlers/mod_format_cdr/conf/autoload_configs/format_cdr.conf.xml
src/mod/event_handlers/mod_format_cdr/mod_format_cdr.c
src/mod/event_handlers/mod_json_cdr/conf/autoload_configs/json_cdr.conf.xml
src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c
src/mod/event_handlers/mod_kazoo/kazoo_node.c
src/mod/event_handlers/mod_odbc_cdr/mod_odbc_cdr.c
src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h
src/mod/event_handlers/mod_rayo/iks_helpers.c
src/mod/event_handlers/mod_rayo/mod_rayo.c
src/mod/event_handlers/mod_rayo/rayo_cpa_component.c
src/mod/event_handlers/mod_rayo/rayo_cpa_detector.c
src/mod/event_handlers/mod_rayo/rayo_input_component.c
src/mod/event_handlers/mod_rayo/sasl.c
src/mod/event_handlers/mod_smpp/mod_smpp.c
src/mod/event_handlers/mod_smpp/mod_smpp.h
src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c
src/mod/event_handlers/mod_smpp/mod_smpp_message.c
src/mod/event_handlers/mod_snmp/mod_snmp.c
src/mod/event_handlers/mod_snmp/subagent.c
src/mod/event_handlers/mod_snmp/subagent.h
src/mod/formats/mod_local_stream/mod_local_stream.c
src/mod/formats/mod_native_file/mod_native_file.c
src/mod/formats/mod_png/mod_png.c
src/mod/formats/mod_shell_stream/mod_shell_stream.c
src/mod/formats/mod_shout/mod_shout.c
src/mod/formats/mod_sndfile/mod_sndfile.c
src/mod/formats/mod_tone_stream/mod_tone_stream.c
src/mod/formats/mod_vlc/mod_vlc.c
src/mod/formats/mod_webm/mod_webm.cpp
src/mod/languages/mod_basic/mod_basic.c
src/mod/languages/mod_basic/my_basic.h
src/mod/languages/mod_java/modjava.c
src/mod/languages/mod_lua/freeswitch_lua.cpp
src/mod/languages/mod_lua/lua/lgc.c
src/mod/languages/mod_lua/mod_lua.cpp
src/mod/languages/mod_managed/freeswitch_managed.cpp
src/mod/languages/mod_managed/freeswitch_managed.h
src/mod/languages/mod_managed/mod_managed.cpp
src/mod/languages/mod_perl/freeswitch_perl.cpp
src/mod/languages/mod_perl/mod_perl.c
src/mod/languages/mod_python/freeswitch_python.cpp
src/mod/languages/mod_python/mod_python.c
src/mod/languages/mod_v8/mod_v8.cpp
src/mod/languages/mod_v8/src/fscoredb.cpp
src/mod/languages/mod_v8/src/fscurl.cpp
src/mod/languages/mod_v8/src/fsdbh.cpp
src/mod/languages/mod_v8/src/fsdtmf.cpp
src/mod/languages/mod_v8/src/fseventhandler.cpp
src/mod/languages/mod_v8/src/fsglobal.cpp
src/mod/languages/mod_v8/src/fsodbc.cpp
src/mod/languages/mod_v8/src/fssession.cpp
src/mod/languages/mod_v8/src/fsxml.cpp
src/mod/languages/mod_v8/src/jsmain.cpp
src/mod/languages/mod_yaml/mod_yaml.c
src/mod/loggers/mod_console/conf/autoload_configs/console.conf.xml
src/mod/loggers/mod_console/mod_console.c
src/mod/loggers/mod_graylog2/mod_graylog2.c
src/mod/loggers/mod_logfile/conf/autoload_configs/logfile.conf.xml
src/mod/loggers/mod_logfile/mod_logfile.c
src/mod/loggers/mod_raven/mod_raven.c
src/mod/loggers/mod_syslog/mod_syslog.c
src/mod/say/mod_say_de/mod_say_de.c
src/mod/say/mod_say_en/mod_say_en.c
src/mod/say/mod_say_es/mod_say_es.c
src/mod/say/mod_say_es_ar/mod_say_es_ar.c
src/mod/say/mod_say_fa/mod_say_fa.c
src/mod/say/mod_say_fr/mod_say_fr.c
src/mod/say/mod_say_he/mod_say_he.c
src/mod/say/mod_say_hr/mod_say_hr.c
src/mod/say/mod_say_hu/mod_say_hu.c
src/mod/say/mod_say_it/mod_say_it.c
src/mod/say/mod_say_nl/mod_say_nl.c
src/mod/say/mod_say_pl/mod_say_pl.c
src/mod/say/mod_say_pt/mod_say_pt.c
src/mod/say/mod_say_ru/mod_say_ru.c
src/mod/say/mod_say_ru/mod_say_ru.h
src/mod/say/mod_say_sv/mod_say_sv.c
src/mod/say/mod_say_th/mod_say_th.c
src/mod/say/mod_say_zh/mod_say_zh.c
src/mod/timers/mod_posix_timer/mod_posix_timer.c
src/mod/timers/mod_posix_timer/test/main.c
src/mod/timers/mod_posix_timer/test/switch.h
src/mod/xml_int/mod_xml_cdr/conf/autoload_configs/xml_cdr.conf.xml
src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c
src/mod/xml_int/mod_xml_radius/00_dialplan_auth.xml
src/mod/xml_int/mod_xml_radius/mod_xml_radius.c
src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
src/mod/xml_int/mod_xml_rpc/ws.c
src/mod/xml_int/mod_xml_rpc/ws.h
src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c
src/switch.c
src/switch_apr.c
src/switch_buffer.c
src/switch_caller.c
src/switch_channel.c
src/switch_config.c
src/switch_console.c
src/switch_core.c
src/switch_core_asr.c
src/switch_core_cert.c
src/switch_core_codec.c
src/switch_core_db.c
src/switch_core_directory.c
src/switch_core_event_hook.c
src/switch_core_file.c
src/switch_core_hash.c
src/switch_core_io.c
src/switch_core_media.c
src/switch_core_media_bug.c
src/switch_core_memory.c
src/switch_core_port_allocator.c
src/switch_core_rwlock.c
src/switch_core_session.c
src/switch_core_speech.c
src/switch_core_sqldb.c
src/switch_core_state_machine.c
src/switch_core_timer.c
src/switch_core_video.c
src/switch_cpp.cpp
src/switch_curl.c
src/switch_dso.c
src/switch_estimators.c
src/switch_event.c
src/switch_hashtable.c
src/switch_ivr.c
src/switch_ivr_async.c
src/switch_ivr_bridge.c
src/switch_ivr_menu.c
src/switch_ivr_originate.c
src/switch_ivr_play_say.c
src/switch_ivr_say.c
src/switch_jitterbuffer.c
src/switch_json.c
src/switch_limit.c
src/switch_loadable_module.c
src/switch_log.c
src/switch_mprintf.c
src/switch_msrp.c
src/switch_nat.c
src/switch_odbc.c
src/switch_pcm.c
src/switch_pgsql.c
src/switch_profile.c
src/switch_regex.c
src/switch_resample.c
src/switch_rtp.c
src/switch_scheduler.c
src/switch_speex.c
src/switch_stun.c
src/switch_swig.c
src/switch_time.c
src/switch_utils.c
src/switch_version.c
src/switch_vpx.c
src/switch_xml.c
src/switch_xml_config.c
src/tone2wav.c

index a6192ac84feae5868540809160d85dc58d5b5b32..235a5d9f116574fc05fa8cdd680b50489f986f49 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Rene <mrene@avgs.ca>
  *
  * fs_encode.c -- Encode a native file
@@ -53,7 +53,7 @@ static void fs_encode_cleanup()
        switch_safe_free(SWITCH_GLOBAL_dirs.log_dir);
 }
 
-int main(int argc, char *argv[]) 
+int main(int argc, char *argv[])
 {
        int r = 1;
        switch_bool_t verbose = SWITCH_FALSE;
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
                                        i++;
                                        /* Load extra modules */
                                        if (strchr(argv[i], ','))  {
-                                               extra_modules_count = switch_split(argv[i], ',', extra_modules);        
+                                               extra_modules_count = switch_split(argv[i], ',', extra_modules);
                                        } else {
                                                extra_modules_count = 1;
                                                extra_modules[0] = argv[i];
@@ -136,24 +136,24 @@ int main(int argc, char *argv[])
                        break;
                }
        }
-       
+
        if (argc - i < 2 || cmd_fail) {
                goto usage;
        }
-       
+
        input = argv[i++];
        output = argv[i++];
        if (zstr(input) || zstr(output) || !(format = strchr(output, '.'))) {
                goto usage;
        }
-       
+
        format++;
-       
+
        if (switch_core_init(SCF_MINIMAL, verbose, &err) != SWITCH_STATUS_SUCCESS) {
                fprintf(stderr, "Cannot init core [%s]\n", err);
                goto end;
        }
-       
+
        switch_loadable_module_init(SWITCH_FALSE);
        switch_loadable_module_load_module("", "CORE_PCM_MODULE", SWITCH_TRUE, &err);
        switch_loadable_module_load_module("", "CORE_SPEEX_MODULE", SWITCH_TRUE, &err);
@@ -165,17 +165,17 @@ int main(int argc, char *argv[])
                        goto end;
                }
        }
-       
+
        if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_spandsp", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
                fprintf(stderr, "Cannot init mod_spandsp [%s]\n", err);
                goto end;
        }
-       
+
        if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_sndfile", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
                fprintf(stderr, "Cannot init mod_sndfile [%s]\n", err);
                goto end;
        }
-       
+
        if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_native_file", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
                fprintf(stderr, "Cannot init mod_native_file [%s]\n", err);
                goto end;
@@ -189,7 +189,7 @@ int main(int argc, char *argv[])
                fprintf(stderr, "Couldn't open %s\n", input);
                goto end;
        }
-       
+
 
        if (verbose) {
                fprintf(stderr, "Opening file %s\n", output);
@@ -219,7 +219,7 @@ int main(int argc, char *argv[])
                        fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", p, rate, ptime);
                        goto end;
                }
-               
+
                if (switch_core_codec_init_with_bitrate(&raw_codec, "L16", NULL, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE|SWITCH_CODEC_FLAG_DECODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
                fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", "L16", rate, ptime);
                goto end;
@@ -231,9 +231,9 @@ int main(int argc, char *argv[])
 
        if (switch_core_file_open(&fh_output, output, channels, codec.implementation->actual_samples_per_second, out_flags, NULL) != SWITCH_STATUS_SUCCESS) {
                fprintf(stderr, "Couldn't open %s\n", output);
-               goto end;       
+               goto end;
        }
-       
+
        if (switch_test_flag(&fh_input, SWITCH_FILE_NATIVE)) {
                in_asis = 1;
        }
@@ -249,9 +249,9 @@ int main(int argc, char *argv[])
        switch_assert(sizeof(buf) >= len * 2);
 
        if (verbose) {
-               fprintf(stderr, "Frame size is %d\n", blocksize);       
+               fprintf(stderr, "Frame size is %d\n", blocksize);
        }
-       
+
        while (switch_core_file_read(&fh_input, buf, &len) == SWITCH_STATUS_SUCCESS) {
                char encode_buf[2048];
                uint32_t encoded_len = sizeof(buf);
@@ -263,13 +263,13 @@ int main(int argc, char *argv[])
                                fprintf(stderr, "Codec encoder error\n");
                                goto end;
                        }
-                       
+
                        len = encoded_len;
                } else {
                        if (!in_asis) {
                                encoded_len = len;
                        } else if (in_asis) {
-                               
+
                                switch_core_codec_decode(&codec,
                                                                                 &raw_codec,
                                                                                 buf,
@@ -289,14 +289,14 @@ int main(int argc, char *argv[])
                        fprintf(stderr, "Write error\n");
                        goto end;
                }
-               
+
                if (len != encoded_len) {
                        printf("Short write: wrote %"SWITCH_SIZE_T_FMT"/%d bytes\n", len, encoded_len);
                }
-               
+
                len = blocksize;
        }
-       
+
        r = 0;
 
 end:
@@ -307,17 +307,17 @@ end:
 
 
        if (fh_input.file_interface) {
-               switch_core_file_close(&fh_input);              
+               switch_core_file_close(&fh_input);
        }
 
        if (fh_output.file_interface) {
-               switch_core_file_close(&fh_output);             
+               switch_core_file_close(&fh_output);
        }
 
        if (pool) {
                switch_core_destroy_memory_pool(&pool);
        }
-       
+
        fs_encode_cleanup();
 
        //switch_core_destroy();
index aac82a15accde486328b118b8d6d665c9e730bc6..224e42f964a3728187f3edf28d3bb515ce881b7b 100644 (file)
@@ -25,7 +25,7 @@ these routines are slow in C, is the lack of direct access to the CPU's "find
 the first 1" instruction. A little in-line assembler fixes that, and the
 conversion routines can be faster than lookup tables, in most real world usage.
 A "find the first 1" instruction is available on most modern CPUs, and is a
-much underused feature. 
+much underused feature.
 
 If an assembly language method of bit searching is not available, these routines
 revert to a method that can be a little slow, so the cache thrashing might not
index d3b9de1e80a2b80e7e7382ad9e7ab443030481ed..83f93390bbacac2ad0e05f3091a86f751e717f7a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -235,11 +235,11 @@ struct switch_media_bug {
        switch_image_t *spy_img[2];
        switch_vid_spy_fmt_t spy_fmt;
        switch_thread_t *video_bug_thread;
-       
+
        switch_buffer_t *text_buffer;
        char *text_framedata;
        uint32_t text_framesize;
-       
+
        struct switch_media_bug *next;
 };
 
index fbd08f11d55b6c7ada8bd582ad11085476e4dda7..c12f11d917d75b348b14d07cb54d7ab97f3b526f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * switch_hashtable_private.h -- Hashtable
@@ -89,23 +89,23 @@ indexFor(unsigned int tablelength, unsigned int hashvalue) {
 /*
  * Copyright (c) 2002, Christopher Clark
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
index e38846d6ebcaff658e219c86fb142d4ab6b6a1f6..89a79f1ee633e52a747a9eb4034e74bd18d6b9c6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch.h -- Main Library Header
  *  - OpenBSD 5.x
  *
  * \section depends Dependencies
- *  Freeswitch makes heavy use of external libraries.  
+ *  Freeswitch makes heavy use of external libraries.
  *
  *  libFreeSWITCH:
  *             - APR (http://apr.apache.org)
  *
  *  mod_b64
  *      - Base64 codec tranfers data base64 encoded (http://www.b64codec.org)
- * 
+ *
  *  mod_bv
  *      - BroadVoice16 (8kHz) and BroadVoice32 (16kHz) (https://www.broadcom.com/support/broadvoice)
  *
  *  Directories
  *     mod_ldap
  *             - openldap (*nix only http://www.openldap.org/)
- * 
+ *
  *  Endpoints
  *     mod_portaudio
  *             - portaudio (http://www.portaudio.com/)
index 07f65063e6760d4d100540a4dc0344a19741d576..2157007046625bbb5122d855c5ff495e1d74783b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Eliot Gable <egable@gmail.com>
  *
@@ -31,7 +31,7 @@
  */
 /*! \file switch_apr.h
     \brief APR includes header
-       
+
        The things powered by APR are renamed into the switch_ namespace to provide a cleaner
        look to things and helps me to document what parts of APR I am using I'd like to take this
        opportunity to thank APR for all the awesome stuff it does and for making my life much easier.
@@ -53,7 +53,7 @@ typedef pthread_t switch_thread_id_t;
 
 SWITCH_DECLARE(switch_thread_id_t) switch_thread_self(void);
 
-/*! \brief Compare two thread ids 
+/*! \brief Compare two thread ids
  *  \param tid1 1st Thread ID to compare
  *  \param tid2 2nd Thread ID to compare
 */
@@ -71,7 +71,7 @@ SWITCH_DECLARE(int) switch_thread_equal(switch_thread_id_t tid1, switch_thread_i
  */
 /**
  * @defgroup switch_memory_pool Memory Pool Functions
- * @ingroup switch_apr 
+ * @ingroup switch_apr
  * @{
  */
 /** The fundamental pool type */
@@ -142,7 +142,7 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_first(switch_memory_pool_
 /**
  * Continue iterating over the entries in a hash table.
  * @param ht The iteration state
- * @return a pointer to the updated iteration state.  NULL if there are no more  
+ * @return a pointer to the updated iteration state.  NULL if there are no more
  *         entries.
  */
 SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_next(switch_hash_index_t *ht);
@@ -171,7 +171,7 @@ SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t *ht);
  * The default hash function.
  * @param key pointer to the key.
  * @param klen the key length.
- * 
+ *
  */
 SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen);
 
@@ -180,7 +180,7 @@ SWITCH_DECLARE(unsigned int) switch_ci_hashfunc_default(const char *char_key, sw
 
  /**
  * @defgroup switch_time Time Routines
- * @ingroup switch_apr 
+ * @ingroup switch_apr
  * @{
  */
 
@@ -261,7 +261,7 @@ SWITCH_DECLARE(switch_status_t) switch_strftime_nocheck(char *s, switch_size_t *
  * format which requires the indicated amount of storage,
  * including the trailing NUL terminator.
  * @param date_str String to write to.
- * @param t the time to convert 
+ * @param t the time to convert
  */
 SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t);
 
@@ -273,7 +273,7 @@ SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t
 SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input);
 
 /**
- * Convert time value from human readable format to a numeric apr_time_t 
+ * Convert time value from human readable format to a numeric apr_time_t
  * e.g. elapsed usec since epoch
  * @param result the resulting imploded time
  * @param input the input exploded time
@@ -297,7 +297,7 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_tz(switch_time_exp_t *result, sw
 /**
  * Sleep for the specified number of micro-seconds.
  * @param t desired amount of time to sleep.
- * @warning May sleep for longer than the specified time. 
+ * @warning May sleep for longer than the specified time.
  */
 SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t);
 SWITCH_DECLARE(void) switch_micro_sleep(switch_interval_time_t t);
@@ -449,7 +449,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock
 
 /**
  * @defgroup switch_thread_cond Condition Variable Routines
- * @ingroup switch_apr 
+ * @ingroup switch_apr
  * @{
  */
 
@@ -496,8 +496,8 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *co
  * @param mutex the mutex that must be locked upon entering this function,
  *        is released while the thread is asleep, and is again acquired before
  *        returning from this function.
- * @param timeout The amount of time in microseconds to wait. This is 
- *        a maximum, not a minimum. If the condition is signaled, we 
+ * @param timeout The amount of time in microseconds to wait. This is
+ *        a maximum, not a minimum. If the condition is signaled, we
  *        will wake up before this time, otherwise the error APR_TIMEUP
  *        is returned.
  */
@@ -589,7 +589,7 @@ SWITCH_DECLARE(switch_status_t) switch_md5_string(char digest_str[SWITCH_MD5_DIG
 /** Opaque structure used for queue API */
         typedef struct apr_queue_t switch_queue_t;
 
-/** 
+/**
  * create a FIFO queue
  * @param queue The new queue
  * @param queue_capacity maximum size of the queue
@@ -677,7 +677,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
 
 /**
  * @defgroup switch_file_io File I/O Handling Functions
- * @ingroup switch_apr 
+ * @ingroup switch_apr
  * @{
  */
 
@@ -703,7 +703,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
 
 
 /**
- * @defgroup switch_file_permissions File Permissions flags 
+ * @defgroup switch_file_permissions File Permissions flags
  * @ingroup switch_file_io
  * @{
  */
@@ -784,7 +784,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
  *         SWITCH_FOPEN_CREATE                         create the file if not there
  *         SWITCH_FOPEN_APPEND                         file ptr is set to end prior to all writes
  *         SWITCH_FOPEN_TRUNCATE                       set length to zero if file exists
- *         SWITCH_FOPEN_BINARY                         not a text file (This flag is ignored on 
+ *         SWITCH_FOPEN_BINARY                         not a text file (This flag is ignored on
  *                                                                                     UNIX because it has no meaning)
  *         SWITCH_FOPEN_BUFFERED                       buffer the data.  Default is non-buffered
  *         SWITCH_FOPEN_EXCL                           return error if APR_CREATE and file exists
@@ -794,7 +794,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
  *         SWITCH_FOPEN_SHARELOCK                      Platform dependent support for higher
  *                                                                                     level locked read/write access to support
  *                                                                                     writes across process/machines
- *         SWITCH_FOPEN_NOCLEANUP                      Do not register a cleanup with the pool 
+ *         SWITCH_FOPEN_NOCLEANUP                      Do not register a cleanup with the pool
  *                                                                                     passed in on the <EM>pool</EM> argument (see below).
  *                                                                                     The apr_os_file_t handle in apr_file_t will not
  *                                                                                     be closed when the pool is destroyed.
@@ -860,7 +860,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *b
  * Write data to the specified file.
  * @param thefile The file descriptor to write to.
  * @param buf The buffer which contains the data.
- * @param nbytes On entry, the number of bytes to write; on exit, the number 
+ * @param nbytes On entry, the number of bytes to write; on exit, the number
  *               of bytes written.
  *
  * @remark apr_file_write will write up to the specified number of
@@ -924,7 +924,7 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir);
 
 /**
  * @defgroup switch_thread_proc Threads and Process Functions
- * @ingroup switch_apr 
+ * @ingroup switch_apr
  * @{
  */
 
@@ -955,7 +955,7 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **
 
 /**
  * Set if newly created threads should be created in detached state.
- * @param attr The threadattr to affect 
+ * @param attr The threadattr to affect
  * @param on Non-zero if detached threads should be created.
  */
 SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on);
@@ -975,7 +975,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre
 
 /**
  * @defgroup switch_network_io Network Routines
- * @ingroup switch_apr 
+ * @ingroup switch_apr
  * @{
  */
 
@@ -1048,12 +1048,12 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock
 
 /**
  * Shutdown either reading, writing, or both sides of a socket.
- * @param sock The socket to close 
+ * @param sock The socket to close
  * @param how How to shutdown the socket.  One of:
  * <PRE>
  *            SWITCH_SHUTDOWN_READ         no longer allow read requests
  *            SWITCH_SHUTDOWN_WRITE        no longer allow write requests
- *            SWITCH_SHUTDOWN_READWRITE    no longer allow read or write requests 
+ *            SWITCH_SHUTDOWN_READWRITE    no longer allow read or write requests
  * </PRE>
  * @see switch_shutdown_how_e
  * @remark This does not actually close the socket descriptor, it just
@@ -1063,13 +1063,13 @@ SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, sw
 
 /**
  * Close a socket.
- * @param sock The socket to close 
+ * @param sock The socket to close
  */
 SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock);
 
 /**
  * Bind the socket to its associated port
- * @param sock The socket to bind 
+ * @param sock The socket to bind
  * @param sa The socket address to bind to
  * @remark This may be where we will find out if there is any other process
  *      using the selected port.
@@ -1078,10 +1078,10 @@ SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch
 
 /**
  * Listen to a bound socket for connections.
- * @param sock The socket to listen on 
+ * @param sock The socket to listen on
  * @param backlog The number of outstanding connections allowed in the sockets
  *                listen queue.  If this value is less than zero, the listen
- *                queue size is set to zero.  
+ *                queue size is set to zero.
  */
 SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog);
 
@@ -1096,9 +1096,9 @@ SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int3
 SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t *sock, switch_memory_pool_t *pool);
 
 /**
- * Issue a connection request to a socket either on the same machine 
+ * Issue a connection request to a socket either on the same machine
  * or a different one.
- * @param sock The socket we wish to use for our side of the connection 
+ * @param sock The socket we wish to use for our side of the connection
  * @param sa The address of the machine we wish to connect to.
  */
 SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa);
@@ -1122,7 +1122,7 @@ SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const sw
  * @param sa The new apr_sockaddr_t.
  * @param hostname The hostname or numeric address string to resolve/parse, or
  *               NULL to build an address that corresponds to 0.0.0.0 or ::
- * @param family The address family to use, or SWITCH_UNSPEC if the system should 
+ * @param family The address family to use, or SWITCH_UNSPEC if the system should
  *               decide.
  * @param port The port number.
  * @param flags Special processing flags:
@@ -1148,12 +1148,12 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, s
 /**
  * Send data over a network.
  * @param sock The socket to send the data over.
- * @param buf The buffer which contains the data to be sent. 
+ * @param buf The buffer which contains the data to be sent.
  * @param len On entry, the number of bytes to send; on exit, the number
  *            of bytes sent.
  * @remark
  * <PRE>
- * This functions acts like a blocking write by default.  To change 
+ * This functions acts like a blocking write by default.  To change
  * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
  * socket option.
  *
@@ -1173,7 +1173,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const
  */
 SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf,
                                                                                                         switch_size_t *len);
-                                                                                                       
+
 SWITCH_DECLARE(switch_status_t) switch_socket_send_nonblock(switch_socket_t *sock, const char *buf, switch_size_t *len);
 
 /**
@@ -1191,12 +1191,12 @@ SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int
 /**
  * Read data from a network.
  * @param sock The socket to read the data from.
- * @param buf The buffer to store the data in. 
+ * @param buf The buffer to store the data in.
  * @param len On entry, the number of bytes to receive; on exit, the number
  *            of bytes received.
  * @remark
  * <PRE>
- * This functions acts like a blocking read by default.  To change 
+ * This functions acts like a blocking read by default.  To change
  * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
  * socket option.
  * The number of bytes actually received is stored in argument 3.
@@ -1214,7 +1214,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *
  * @param sock The socket to set up.
  * @param opt The option we would like to configure.  One of:
  * <PRE>
- *            APR_SO_DEBUG      --  turn on debugging information 
+ *            APR_SO_DEBUG      --  turn on debugging information
  *            APR_SO_KEEPALIVE  --  keep connections active
  *            APR_SO_LINGER     --  lingers on close if data is present
  *            APR_SO_NONBLOCK   --  Turns blocking on/off for socket
@@ -1263,9 +1263,9 @@ SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock,
  * Join a Multicast Group
  * @param sock The socket to join a multicast group
  * @param join The address of the multicast group to join
- * @param iface Address of the interface to use.  If NULL is passed, the 
+ * @param iface Address of the interface to use.  If NULL is passed, the
  *              default multicast interface will be used. (OS Dependent)
- * @param source Source Address to accept transmissions from (non-NULL 
+ * @param source Source Address to accept transmissions from (non-NULL
  *               implies Source-Specific Multicast)
  */
 SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source);
@@ -1331,7 +1331,7 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, sw
 
 /**
  * Setup a pollset object
- * @param pollset  The pointer in which to return the newly created object 
+ * @param pollset  The pointer in which to return the newly created object
  * @param size The maximum number of descriptors that this pollset can hold
  * @param pool The pool from which to allocate the pollset
  * @param flags Optional flags to modify the operation of the pollset.
@@ -1382,16 +1382,16 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_remove(switch_pollset_t *pollset,
 
 /**
  * Poll the sockets in the poll structure
- * @param aprset The poll structure we will be using. 
+ * @param aprset The poll structure we will be using.
  * @param numsock The number of sockets we are polling
  * @param nsds The number of sockets signalled.
- * @param timeout The amount of time in microseconds to wait.  This is 
- *                a maximum, not a minimum.  If a socket is signalled, we 
- *                will wake up before this time.  A negative number means 
+ * @param timeout The amount of time in microseconds to wait.  This is
+ *                a maximum, not a minimum.  If a socket is signalled, we
+ *                will wake up before this time.  A negative number means
  *                wait until a socket is signalled.
- * @remark The number of sockets signalled is returned in the third argument. 
- *         This is a blocking call, and it will not return until either a 
- *         socket has been signalled, or the timeout has expired. 
+ * @remark The number of sockets signalled is returned in the third argument.
+ *         This is a blocking call, and it will not return until either a
+ *         socket has been signalled, or the timeout has expired.
  */
 SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout);
 
@@ -1415,7 +1415,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_poll(switch_pollset_t *pollset, s
 SWITCH_DECLARE(switch_status_t) switch_socket_create_pollset(switch_pollfd_t ** poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool);
 
 SWITCH_DECLARE(switch_interval_time_t) switch_interval_time_from_timeval(struct timeval *tvp);
-                                                                                                                               
+
 
 /*!
   \brief Create a pollfd out of a socket
@@ -1442,14 +1442,14 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, swi
 /**
  * Get the timeout value for a pipe or manipulate the blocking state.
  * @param thepipe The pipe we are getting a timeout for.
- * @param timeout The current timeout value in microseconds. 
+ * @param timeout The current timeout value in microseconds.
  */
 SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thepipe, switch_interval_time_t *timeout);
 
 /**
  * Set the timeout value for a pipe or manipulate the blocking state.
  * @param thepipe The pipe we are setting a timeout on.
- * @param timeout The timeout value in microseconds.  Values < 0 mean wait 
+ * @param timeout The timeout value in microseconds.  Values < 0 mean wait
  *        forever, 0 means do not wait at all.
  */
 SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_set(switch_file_t *thepipe, switch_interval_time_t timeout);
index 612d6b5c50915df76c62dac58ba1c33ce9b2aa5c..5578cd4f337ffb98e480971d04072200a73e21ae 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -56,9 +56,9 @@ static inline char *print_bits(switch_byte_t byte, char *x)
 
 
 /*!
-  \defgroup bp1 Bitpacking 
+  \defgroup bp1 Bitpacking
   \ingroup core1
-  \{ 
+  \{
 */
 
 static const uint8_t SWITCH_BITPACKED_MASKS[] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
@@ -70,7 +70,7 @@ static const uint8_t SWITCH_REVERSE_BITPACKED_MASKS[] = { 255, 254, 252, 248, 24
   \param bitlen the number of bits per packet
   \param buf the buffer to use for storage
   \param buflen the length of the storage buffer
-  \param mode RFC3551 or AAL2 mode (curse you backwards folks) 
+  \param mode RFC3551 or AAL2 mode (curse you backwards folks)
 */
 DoxyDefine(void switch_bitpack_init(switch_bitpack_t *pack, int32_t bitlen, switch_byte_t *buf, uint32_t buflen, switch_bitpack_mode_t mode))
         static inline int8_t switch_bitpack_init(switch_bitpack_t *pack, switch_byte_t bitlen, switch_byte_t *buf, uint32_t buflen,
index e5af0baf0a203e5d779fc024c9fca32a24b088ca..7025308544864b013cf85618741e8504d4578fc6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_buffer.h -- Data Buffering Code
  *
  */
-/** 
+/**
  * @file switch_buffer.h
  * @brief Data Buffering Code
  * @see switch_buffer
@@ -56,7 +56,7 @@ SWITCH_DECLARE(switch_status_t) switch_buffer_create_partition(switch_memory_poo
 SWITCH_DECLARE(switch_status_t) switch_buffer_set_partition_data(switch_buffer_t *buffer, void *data, switch_size_t datalen);
 SWITCH_DECLARE(switch_status_t) switch_buffer_reset_partition_data(switch_buffer_t *buffer);
 
-/*! \brief Allocate a new switch_buffer 
+/*! \brief Allocate a new switch_buffer
  * \param pool Pool to allocate the buffer from
  * \param buffer returned pointer to the new buffer
  * \param max_len length required by the buffer
@@ -64,7 +64,7 @@ SWITCH_DECLARE(switch_status_t) switch_buffer_reset_partition_data(switch_buffer
  */
 SWITCH_DECLARE(switch_status_t) switch_buffer_create(_In_ switch_memory_pool_t *pool, _Out_ switch_buffer_t **buffer, _In_ switch_size_t max_len);
 
-/*! \brief Allocate a new dynamic switch_buffer 
+/*! \brief Allocate a new dynamic switch_buffer
  * \param buffer returned pointer to the new buffer
  * \param blocksize length to realloc by as data is added
  * \param start_len ammount of memory to reserve initially
@@ -79,25 +79,25 @@ SWITCH_DECLARE(void) switch_buffer_lock(_In_ switch_buffer_t *buffer);
 SWITCH_DECLARE(switch_status_t) switch_buffer_trylock(_In_ switch_buffer_t *buffer);
 SWITCH_DECLARE(void) switch_buffer_unlock(_In_ switch_buffer_t *buffer);
 
-/*! \brief Get the length of a switch_buffer_t 
+/*! \brief Get the length of a switch_buffer_t
  * \param buffer any buffer of type switch_buffer_t
  * \return int size of the buffer.
  */
 SWITCH_DECLARE(switch_size_t) switch_buffer_len(_In_ switch_buffer_t *buffer);
 
-/*! \brief Get the freespace of a switch_buffer_t 
+/*! \brief Get the freespace of a switch_buffer_t
  * \param buffer any buffer of type switch_buffer_t
  * \return int freespace in the buffer.
  */
 SWITCH_DECLARE(switch_size_t) switch_buffer_freespace(_In_ switch_buffer_t *buffer);
 
-/*! \brief Get the in use amount of a switch_buffer_t 
+/*! \brief Get the in use amount of a switch_buffer_t
  * \param buffer any buffer of type switch_buffer_t
  * \return int ammount of buffer curently in use
  */
 SWITCH_DECLARE(switch_size_t) switch_buffer_inuse(_In_ switch_buffer_t *buffer);
 
-/*! \brief Read data from a switch_buffer_t up to the ammount of datalen if it is available.  Remove read data from buffer. 
+/*! \brief Read data from a switch_buffer_t up to the ammount of datalen if it is available.  Remove read data from buffer.
  * \param buffer any buffer of type switch_buffer_t
  * \param data pointer to the read data to be returned
  * \param datalen amount of data to be returned
@@ -105,7 +105,7 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_inuse(_In_ switch_buffer_t *buffer);
  */
 SWITCH_DECLARE(switch_size_t) switch_buffer_read(_In_ switch_buffer_t *buffer, _In_ void *data, _In_ switch_size_t datalen);
 
-/*! \brief Read data from a switch_buffer_t up to the ammount of datalen if it is available, without removing read data from buffer. 
+/*! \brief Read data from a switch_buffer_t up to the ammount of datalen if it is available, without removing read data from buffer.
  * \param buffer any buffer of type switch_buffer_t
  * \param data pointer to the read data to be returned
  * \param datalen amount of data to be returned
@@ -115,7 +115,7 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_peek(_In_ switch_buffer_t *buffer, _
 
 SWITCH_DECLARE(switch_size_t) switch_buffer_peek_zerocopy(_In_ switch_buffer_t *buffer, _Out_ const void **ptr);
 
-/*! \brief Read data endlessly from a switch_buffer_t 
+/*! \brief Read data endlessly from a switch_buffer_t
  * \param buffer any buffer of type switch_buffer_t
  * \param data pointer to the read data to be returned
  * \param datalen amount of data to be returned
index 54fbcc062ca2150e7559d356676fe481d213eb2a..3f702fae08451bff693c3e66a0491541db1a7874 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -45,7 +45,7 @@
  *
  *     In addition, this module implements an abstract interface for extensions and applications.
  *     A connected session's channel has one extension object which may have one or more applications
- *     linked into a stack which will be executed in order by the session's state machine when the 
+ *     linked into a stack which will be executed in order by the session's state machine when the
  *     current state is CS_EXECUTE.
  * @{
  */
@@ -217,7 +217,7 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application_printf(_In_ switch_
   \param ani ANI information
   \param aniii ANI II information
   \param rdnis RDNIS
-  \param source the source 
+  \param source the source
   \param context a logical context
   \param destination_number destination number
   \return a new profile object allocated from the session's memory pool
index f720bf2d981036be494653bb6e33c987a17374a2..b348dccc519ea57a11b1202ab86add9a36418090 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_channel.h -- Media Channel Interface
  *
  */
-/** 
+/**
  * @file switch_channel.h
  * @brief Media Channel Interface
  * @see switch_channel
@@ -292,16 +292,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_transfer_variable_prefix(switch_c
 #define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE)
 
 
-SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, 
-                                                                                                                                                const char *varname, const char *val, 
+SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel,
+                                                                                                                                                const char *varname, const char *val,
                                                                                                                                                 const char *export_varname,
                                                                                                                                                 switch_bool_t var_check);
 
-SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel, 
+SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel,
                                                                                                   switch_event_t *var_event, const char *export_varname);
 
 #define switch_channel_export_variable(_channel, _varname, _value, _ev) switch_channel_export_variable_var_check(_channel, _varname, _value, _ev, SWITCH_TRUE)
-SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, 
+SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname,
                                                                                                                                          const char *export_varname, const char *fmt, ...);
 
 SWITCH_DECLARE(void) switch_channel_set_scope_variables(switch_channel_t *channel, switch_event_t **event);
@@ -333,7 +333,7 @@ static inline int switch_channel_var_true(switch_channel_t *channel, const char
 SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_channel_t *channel);
 
 /*!
- * \brief Stop iterating over channel variables. 
+ * \brief Stop iterating over channel variables.
  * \remark Unlocks the profile mutex initially locked in switch_channel_variable_first
  */
 SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel);
@@ -363,7 +363,7 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_caller_extension(
 
 /*!
   \brief Test for presence of given flag on a given channel
-  \param channel channel to test 
+  \param channel channel to test
   \param flag to test
   \return TRUE if flags were present
 */
@@ -447,7 +447,7 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel);
 */
 #define switch_channel_mark_pre_answered(channel) switch_channel_perform_mark_pre_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready_value(switch_channel_t *channel, 
+SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready_value(switch_channel_t *channel,
                                                                                                                                                switch_ring_ready_t rv,
                                                                                                                                                const char *file, const char *func, int line);
 /*!
@@ -464,7 +464,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel
 
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_channel_t *channel, const char *file, const char *func, int line);
 
-SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(switch_channel_t *channel, 
+SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(switch_channel_t *channel,
                                                                                                                                                         switch_ring_ready_t rv,
                                                                                                                                                         const char *file, const char *func, int line);
 
@@ -561,9 +561,9 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
   \return number of digits in the queue
 */
 SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(_In_ switch_channel_t *channel);
-SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_lock(switch_channel_t *channel); 
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_lock(switch_channel_t *channel);
 SWITCH_DECLARE(switch_status_t) switch_channel_try_dtmf_lock(switch_channel_t *channel);
-SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *channel); 
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *channel);
 
 
 /*!
@@ -658,7 +658,7 @@ SWITCH_DECLARE(char *) switch_channel_get_flag_string(switch_channel_t *channel)
 SWITCH_DECLARE(char *) switch_channel_get_cap_string(switch_channel_t *channel);
 SWITCH_DECLARE(int) switch_channel_state_change_pending(switch_channel_t *channel);
 
-SWITCH_DECLARE(void) switch_channel_perform_set_callstate(switch_channel_t *channel, switch_channel_callstate_t callstate, 
+SWITCH_DECLARE(void) switch_channel_perform_set_callstate(switch_channel_t *channel, switch_channel_callstate_t callstate,
                                                                                                                  const char *file, const char *func, int line);
 #define switch_channel_set_callstate(channel, state) switch_channel_perform_set_callstate(channel, state, __FILE__, __SWITCH_FUNC__, __LINE__)
 SWITCH_DECLARE(switch_channel_callstate_t) switch_channel_get_callstate(switch_channel_t *channel);
index c0f5bbfa465f51cb854e6cfb21589cf18cc78efd..f403e15c9f8cb30423596adf739f3a9f293e5547 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * switch_config.h -- Configuration File Parser
  *
  */
-/** 
+/**
  * @file switch_config.h
  * @brief Basic Configuration File Parser
  * @see config
@@ -42,8 +42,8 @@
  * or expanded to tie to external handlers in the future as necessary.
  * <pre>
  *
- * EXAMPLE 
- * 
+ * EXAMPLE
+ *
  * [category1]
  * var1 => val1
  * var2 => val2
index bcf956e2e91704b667b7cc366c80b2250246d010..d853ee4512bb0eab70c2092bfcf80a8d05bd6f3f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index 33dd0d5d3fffec095996940a0156ddf5f5142587..128dec3f1573d4aa13da0d2c631636c444e697f3 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)
  * Joseph Sullivan <jossulli@amazon.com>
@@ -89,7 +89,7 @@ typedef struct device_uuid_node_s {
 } switch_device_node_t;
 
 typedef struct switch_device_stats_s {
-       uint32_t total; 
+       uint32_t total;
        uint32_t total_in;
        uint32_t total_out;
        uint32_t offhook;
@@ -147,7 +147,7 @@ typedef void(*switch_device_state_function_t)(switch_core_session_t *session, sw
 #define MAX_FPLEN 64
 #define MAX_FPSTRLEN 192
 
-typedef struct dtls_fp_s { 
+typedef struct dtls_fp_s {
        uint32_t len;
        uint8_t data[MAX_FPLEN+1];
        char *type;
@@ -251,9 +251,9 @@ static inline char *switch_must_strdup(const char *_s)
 
 
 /*!
-  \defgroup core1 Core Library 
+  \defgroup core1 Core Library
   \ingroup FREESWITCH
-  \{ 
+  \{
 */
 
 ///\defgroup mb1 Media Bugs
@@ -271,8 +271,8 @@ SWITCH_DECLARE(void) switch_core_session_disable_heartbeat(switch_core_session_t
 #define switch_core_session_get_name(_s) switch_channel_get_name(switch_core_session_get_channel(_s))
 
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_pop(switch_core_session_t *orig_session, const char *function, switch_media_bug_t **pop);
-                                                               
-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session, 
+
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session,
                                                                                                                           const char *function, switch_media_bug_exec_cb_t cb, void *user_data);
 SWITCH_DECLARE(uint32_t) switch_core_media_bug_patch_video(switch_core_session_t *orig_session, switch_frame_t *frame);
 SWITCH_DECLARE(uint32_t) switch_core_media_bug_count(switch_core_session_t *orig_session, const char *function);
@@ -408,7 +408,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(_In_ s
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_session_t *session, switch_stream_handle_t *stream);
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch_core_session_t *orig_session, switch_core_session_t *new_session);
 
-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_core_session_t *orig_session, switch_core_session_t *new_session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_core_session_t *orig_session, switch_core_session_t *new_session,
                                                                                                                                                switch_media_bug_callback_t callback, void * (*user_data_dup_func) (switch_core_session_t *, void *));
 
 
@@ -416,7 +416,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_c
   \brief Read a frame from the bug
   \param bug the bug to read from
   \param frame the frame to write the data to
-  \return the amount of data 
+  \return the amount of data
 */
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame, switch_bool_t fill);
 
@@ -482,7 +482,7 @@ SWITCH_DECLARE(int) switch_core_test_flag(int flag);
 ///\defgroup ss Startup/Shutdown
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Initilize the core
   \param console optional FILE stream for output
   \param flags core flags
@@ -491,7 +491,7 @@ SWITCH_DECLARE(int) switch_core_test_flag(int flag);
 */
 SWITCH_DECLARE(switch_status_t) switch_core_init(_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err);
 
-/*! 
+/*!
   \brief Initilize the core and load modules
   \param console optional FILE stream for output
   \param flags core flags
@@ -500,21 +500,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(_In_ switch_core_flag_t flags,
 */
 SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err);
 
-/*! 
+/*!
   \brief Set/Get Session Limit
   \param new_limit new value (if > 0)
   \return the current session limit
 */
 SWITCH_DECLARE(uint32_t) switch_core_session_limit(_In_ uint32_t new_limit);
 
-/*! 
+/*!
   \brief Set/Get Session Rate Limit
   \param new_limit new value (if > 0)
   \return the current session rate limit
 */
 SWITCH_DECLARE(uint32_t) switch_core_sessions_per_second(_In_ uint32_t new_limit);
 
-/*! 
+/*!
   \brief Destroy the core
   \note to be called at application shutdown
 */
@@ -535,7 +535,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_io_rwunlock(switch_core_sess
 SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock(_In_ switch_core_session_t *session, const char *file, const char *func, int line);
 #endif
 
-/*! 
+/*!
   \brief Acquire a read lock on the session
   \param session the session to acquire from
   \return success if it is safe to read from the session
@@ -552,7 +552,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock_hangup(_In
                                                                                                                                                         int line);
 #endif
 
-/*! 
+/*!
   \brief Acquire a read lock on the session
   \param session the session to acquire from
   \return success if it is safe to read from the session
@@ -568,7 +568,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock_hangup(_In_ switch
 SWITCH_DECLARE(void) switch_core_session_perform_write_lock(_In_ switch_core_session_t *session, const char *file, const char *func, int line);
 #endif
 
-/*! 
+/*!
   \brief Acquire a write lock on the session
   \param session the session to acquire from
 */
@@ -582,7 +582,7 @@ SWITCH_DECLARE(void) switch_core_session_write_lock(_In_ switch_core_session_t *
 SWITCH_DECLARE(void) switch_core_session_perform_rwunlock(_In_ switch_core_session_t *session, const char *file, const char *func, int line);
 #endif
 
-/*! 
+/*!
   \brief Unlock a read or write lock on as given session
   \param session the session
 */
@@ -597,7 +597,7 @@ SWITCH_DECLARE(void) switch_core_session_rwunlock(_In_ switch_core_session_t *se
 ///\defgroup sh State Handlers
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Add a global state handler
   \param state_handler a state handler to add
   \return the current index/priority of this handler
@@ -610,7 +610,7 @@ SWITCH_DECLARE(int) switch_core_add_state_handler(_In_ const switch_state_handle
 */
 SWITCH_DECLARE(void) switch_core_remove_state_handler(_In_ const switch_state_handler_table_t *state_handler);
 
-/*! 
+/*!
   \brief Access a state handler
   \param index the desired index to access
   \return the desired state handler table or NULL when it does not exist.
@@ -626,7 +626,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(_Out_ switch
 ///\defgroup memp Memory Pooling/Allocation
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Create a new sub memory pool from the core's master pool
   \return SWITCH_STATUS_SUCCESS on success
 */
@@ -635,7 +635,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(_Out_ switch
 SWITCH_DECLARE(int) switch_core_session_sync_clock(void);
 SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(_Inout_ switch_memory_pool_t **pool,
                                                                                                                                                _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
-/*! 
+/*!
   \brief Returns a subpool back to the main pool
   \return SWITCH_STATUS_SUCCESS on success
 */
@@ -646,13 +646,13 @@ SWITCH_DECLARE(void) switch_core_memory_pool_set_data(switch_memory_pool_t *pool
 SWITCH_DECLARE(void *) switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key);
 
 
-/*! 
+/*!
   \brief Start the session's state machine
   \param session the session on which to start the state machine
 */
 SWITCH_DECLARE(void) switch_core_session_run(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief determine if the session's state machine is running
   \param session the session on which to check
 */
@@ -662,7 +662,7 @@ SWITCH_DECLARE(unsigned int) switch_core_session_started(_In_ switch_core_sessio
 SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(_In_ switch_size_t memory, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
 
 
-/*! 
+/*!
   \brief Allocate memory from the main pool with no intention of returning it
   \param _memory the number of bytes to allocate
   \return a void pointer to the allocated memory
@@ -674,7 +674,7 @@ SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(_In_ switch_size_t me
 SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory, _In_z_ const char *file,
                                                                                                 _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Allocate memory directly from a memory pool
   \param _pool the memory pool to allocate from
   \param _mem the number of bytes to allocate
@@ -686,7 +686,7 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool
         _Ret_ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory, const char *file,
                                                                                                                                        const char *func, int line);
 
-/*! 
+/*!
   \brief Allocate memory from a session's pool
   \param _session the session to request memory from
   \param _memory the amount of memory to allocate
@@ -699,7 +699,7 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool
 
 SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Copy a string using permanent memory allocation
   \param _todup the string to duplicate
   \return a pointer to the newly duplicated string
@@ -710,7 +710,7 @@ SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *t
 SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup, _In_z_ const char *file,
                                                                                                                  _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Copy a string using memory allocation from a session's pool
   \param _session a session to use for allocation
   \param _todup the string to duplicate
@@ -722,7 +722,7 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_sessi
 SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file,
                                                                                                  _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Copy a string using memory allocation from a given pool
   \param _pool the pool to use for allocation
   \param _todup the string to duplicate
@@ -770,7 +770,7 @@ SWITCH_DECLARE(char *) switch_core_sprintf(_In_ switch_memory_pool_t *pool, _In_
 SWITCH_DECLARE(char *) switch_core_vsprintf(switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt, va_list ap);
 #endif
 
-/*! 
+/*!
   \brief Retrieve the memory pool from a session
   \param session the session to retrieve the pool from
   \return the session's pool
@@ -785,7 +785,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e
 ///\defgroup sessm Session Creation / Management
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Allocate and return a new session from the core
   \param endpoint_interface the endpoint interface the session is to be based on
   \param pool the pool to use for the allocation (a new one will be used if NULL)
@@ -794,7 +794,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface,
                                                                                                                                                 _In_ switch_call_direction_t direction,
                                                                                                                                                 switch_originate_flag_t originate_flags,
-                                                                                                                                                _Inout_opt_ switch_memory_pool_t **pool, 
+                                                                                                                                                _Inout_opt_ switch_memory_pool_t **pool,
                                                                                                                                                 _In_opt_z_ const char *use_uuid);
 #define switch_core_session_request(_ep, _d, _f, _p) switch_core_session_request_uuid(_ep, _d, _f, _p, NULL)
 
@@ -803,7 +803,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(_In_ switch_core_se
 SWITCH_DECLARE(void) switch_core_session_perform_destroy(_Inout_ switch_core_session_t **session,
                                                                                                                 _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Destroy a session and return the memory pool to the core
   \param session pointer to a pointer of the session to destroy
   \return
@@ -814,7 +814,7 @@ SWITCH_DECLARE(void) switch_core_session_destroy_state(switch_core_session_t *se
 SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t *session);
 SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *session, switch_bool_t force);
 
-/*! 
+/*!
   \brief Provide the total number of sessions
   \return the total number of allocated sessions
 */
@@ -822,14 +822,14 @@ SWITCH_DECLARE(uint32_t) switch_core_session_count(void);
 
 SWITCH_DECLARE(switch_size_t) switch_core_session_get_id(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Provide the current session_id
   \return the total number of allocated sessions since core startup
 */
 SWITCH_DECLARE(switch_size_t) switch_core_session_id(void);
 SWITCH_DECLARE(switch_size_t) switch_core_session_id_dec(void);
 
-/*! 
+/*!
   \brief Allocate and return a new session from the core based on a given endpoint module name
   \param endpoint_name the name of the endpoint module
   \param pool the pool to use
@@ -838,7 +838,7 @@ SWITCH_DECLARE(switch_size_t) switch_core_session_id_dec(void);
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ const char *endpoint_name,
                                                                                                                                                        _In_ switch_call_direction_t direction, _Inout_ switch_memory_pool_t **pool);
 
-/*! 
+/*!
   \brief Launch the session thread (state machine) on a given session
   \param session the session to activate the state machine on
   \return SWITCH_STATUS_SUCCESS if the thread was launched
@@ -849,21 +849,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(_In_ switch_co
 SWITCH_DECLARE(switch_status_t) switch_thread_pool_launch_thread(switch_thread_data_t **tdp);
 SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve a pointer to the channel object associated with a given session
   \param session the session to retrieve from
   \return a pointer to the channel object
 */
         _Ret_ SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Signal a session's state machine thread that a state change has occured
 */
 SWITCH_DECLARE(switch_mutex_t *) switch_core_session_get_mutex(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_session_wake_session_thread(_In_ switch_core_session_t *session);
 SWITCH_DECLARE(void) switch_core_session_signal_state_change(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve the unique identifier from a session
   \param session the session to retrieve the uuid from
   \return a string representing the uuid
@@ -871,21 +871,21 @@ SWITCH_DECLARE(void) switch_core_session_signal_state_change(_In_ switch_core_se
 SWITCH_DECLARE(char *) switch_core_session_get_uuid(_In_ switch_core_session_t *session);
 
 
-/*! 
+/*!
   \brief Sets the log level for a session
-  \param session the session to set the log level on 
+  \param session the session to set the log level on
   \return SWITCH_STATUS_SUCCESS
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_loglevel(switch_core_session_t *session, switch_log_level_t loglevel);
 
 
-/*! 
+/*!
   \brief Get the log level for a session
-  \param session the session to get the log level from 
+  \param session the session to get the log level from
   \return the log level
 */
 SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_session_t *session);
-                                                                  
+
 SWITCH_DECLARE(switch_jb_t *) switch_core_session_get_jb(switch_core_session_t *session, switch_media_type_t type);
 SWITCH_DECLARE(void) switch_core_session_soft_lock(switch_core_session_t *session, uint32_t sec);
 SWITCH_DECLARE(void) switch_core_session_soft_unlock(switch_core_session_t *session);
@@ -897,7 +897,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_set_terminators(switch_ivr_d
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_codec_slin(switch_core_session_t *session, switch_slin_data_t *data);
 SWITCH_DECLARE(void) switch_core_session_raw_read(switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve the unique identifier from the core
   \return a string representing the uuid
 */
@@ -908,7 +908,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(const
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_force_locate(const char *uuid_str, const char *file, const char *func, int line);
 
 
-/*! 
+/*!
   \brief Locate a session based on it's uuid
   \param uuid_str the unique id of the session you want to find
   \return the session or NULL
@@ -917,7 +917,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_force_locate
 
 #define switch_core_session_locate(uuid_str) switch_core_session_perform_locate(uuid_str, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-/*! 
+/*!
   \brief Locate a session based on it's uuid even if the channel is not ready
   \param uuid_str the unique id of the session you want to find
   \return the session or NULL
@@ -927,7 +927,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_force_locate
 #define switch_core_session_force_locate(uuid_str) switch_core_session_perform_force_locate(uuid_str, __FILE__, __SWITCH_FUNC__, __LINE__)
 
 
-/*! 
+/*!
   \brief Retrieve a global variable from the core
   \param varname the name of the variable
   \return the value of the desired variable
@@ -940,7 +940,7 @@ SWITCH_DECLARE(const char *) switch_core_get_switchname(void);
 
 SWITCH_DECLARE(char *) switch_core_get_domain(switch_bool_t dup);
 
-/*! 
+/*!
   \brief Add a global variable to the core
   \param varname the name of the variable
   \param value the value of the variable
@@ -949,7 +949,7 @@ SWITCH_DECLARE(char *) switch_core_get_domain(switch_bool_t dup);
 SWITCH_DECLARE(void) switch_core_set_variable(_In_z_ const char *varname, _In_opt_z_ const char *value);
 SWITCH_DECLARE(switch_status_t) switch_core_get_variables(switch_event_t **event);
 
-/*! 
+/*!
   \brief Conditionally add a global variable to the core
   \param varname the name of the variable
   \param value the value of the variable
@@ -962,7 +962,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_set_var_conditional(_In_z_ const char
 
 SWITCH_DECLARE(void) switch_core_dump_variables(_In_ switch_stream_handle_t *stream);
 
-/*! 
+/*!
   \brief Hangup all sessions
   \param cause the hangup cause to apply to the hungup channels
 */
@@ -974,10 +974,10 @@ typedef enum {
        SHT_ANSWERED = (1 << 1)
 } switch_hup_type_t;
 
-/*! 
+/*!
   \brief Hangup all sessions which match a specific channel variable
   \param var_name The variable name to look for
-  \param var_val The value to look for 
+  \param var_val The value to look for
   \param cause the hangup cause to apply to the hungup channels
 */
 SWITCH_DECLARE(uint32_t) switch_core_session_hupall_matching_var_ans(_In_ const char *var_name, _In_ const char *var_val, _In_
@@ -995,16 +995,16 @@ SWITCH_DECLARE(uint32_t) switch_core_session_hupall_matching_vars_ans(_In_ switc
                                                                                                                                         switch_call_cause_t cause, switch_hup_type_t type);
 #define switch_core_session_hupall_matching_vars(_vs, _c) switch_core_session_hupall_matching_vars_ans(_vs, _c, SHT_UNANSWERED | SHT_ANSWERED)
 
-/*! 
+/*!
   \brief Hangup all sessions that belong to an endpoint
-  \param endpoint_interface The endpoint interface 
+  \param endpoint_interface The endpoint interface
   \param cause the hangup cause to apply to the hungup channels
 */
 SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause);
 
-/*! 
+/*!
   \brief Get the session's partner (the session its bridged to)
-  \param session The session we're searching with 
+  \param session The session we're searching with
   \param partner [out] The session's partner, or NULL if it wasnt found
   \return SWITCH_STATUS_SUCCESS or SWITCH_STATUS_FALSE if this session isn't bridged
 */
@@ -1013,7 +1013,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_get_partner(switch_c
 
 #define switch_core_session_get_partner(_session, _partner) switch_core_session_perform_get_partner(_session, _partner, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-/*! 
+/*!
   \brief Send a message to another session using it's uuid
   \param uuid_str the unique id of the session you want to send a message to
   \param message the switch_core_session_message_t object to send
@@ -1021,7 +1021,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_get_partner(switch_c
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(_In_z_ const char *uuid_str, _In_ switch_core_session_message_t *message);
 
-/*! 
+/*!
   \brief Queue a message on a session
   \param session the session to queue the message to
   \param message the message to queue
@@ -1035,7 +1035,7 @@ SWITCH_DECLARE(void) switch_core_session_free_message(switch_core_session_messag
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_signal_data(switch_core_session_t *session, void *signal_data);
 SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_signal_data(switch_core_session_t *session, void **signal_data);
 
-/*! 
+/*!
   \brief pass an indication message on a session
   \param session the session to pass the message across
   \param indication the indication message to pass
@@ -1044,7 +1044,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_signal_data(switch_c
 SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session,
                                                                                                                                        _In_ switch_core_session_message_types_t indication);
 
-/*! 
+/*!
   \brief Queue an indication message on a session
   \param session the session to queue the message to
   \param indication the indication message to queue
@@ -1053,7 +1053,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session,
                                                                                                                                         _In_ switch_core_session_message_types_t indication);
 
-/*! 
+/*!
   \brief DE-Queue an message on a given session
   \param session the session to de-queue the message on
   \param message the de-queued message
@@ -1061,14 +1061,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(_In_ switch_core_session_t *session, _Out_ switch_core_session_message_t **message);
 
-/*! 
+/*!
   \brief Flush a message queue on a given session
   \param session the session to de-queue the message on
   \return SWITCH_STATUS_SUCCESS if the message was de-queued
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Queue an event on another session using its uuid
   \param uuid_str the unique id of the session you want to send a message to
   \param event the event to send
@@ -1078,8 +1078,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_event_send(_In_z_ const char
 
 SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(_In_ switch_core_session_t *session);
 
-/*! 
-  \brief Execute an application on a session 
+/*!
+  \brief Execute an application on a session
   \param session the current session
   \param application_interface the interface of the application to execute
   \param arg application arguments
@@ -1090,8 +1090,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_sessio
                                                                                                                 _In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg);
 
 SWITCH_DECLARE(void) switch_core_session_video_reset(switch_core_session_t *session);
-/*! 
-  \brief Execute an application on a session 
+/*!
+  \brief Execute an application on a session
   \param session the current session
   \param app the application's name
   \param arg application arguments
@@ -1105,8 +1105,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(sw
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *app, int32_t *flags);
 
-/*! 
-  \brief Execute an application on a session 
+/*!
+  \brief Execute an application on a session
   \param session the current session
   \param app the application's name
   \param arg application arguments
@@ -1114,7 +1114,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *ap
 */
 #define switch_core_session_execute_application(_a, _b, _c) switch_core_session_execute_application_get_flags(_a, _b, _c, NULL)
 
-/*! 
+/*!
   \brief Run a dialplan and execute an extension
   \param session the current session
   \param exten the interface of the application to execute
@@ -1127,7 +1127,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(_In_ switch_co
                                                                                                                                  _In_z_ const char *exten,
                                                                                                                                  _In_opt_z_ const char *dialplan, _In_opt_z_ const char *context);
 
-/*! 
+/*!
   \brief Send an event to a session translating it to it's native message format
   \param session the session to receive the event
   \param event the event to receive
@@ -1135,7 +1135,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(_In_ switch_co
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(_In_ switch_core_session_t *session, _Inout_ switch_event_t **event);
 
-/*! 
+/*!
   \brief Retrieve private user data from a session
   \param session the session to retrieve from
   \return a pointer to the private data
@@ -1143,7 +1143,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(_In_ switch_co
 SWITCH_DECLARE(void *) switch_core_session_get_private_class(_In_ switch_core_session_t *session, _In_ switch_pvt_class_t index);
 #define switch_core_session_get_private(_s) switch_core_session_get_private_class(_s, SWITCH_PVT_PRIMARY)
 
-/*! 
+/*!
   \brief Add private user data to a session
   \param session the session to add used data to
   \param private_info the used data to add
@@ -1177,7 +1177,7 @@ SWITCH_DECLARE(int) switch_core_session_get_stream_count(_In_ switch_core_sessio
 
 SWITCH_DECLARE(const char *) switch_core_session_get_text_buffer(switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Launch a thread designed to exist within the scope of a given session
   \param session a session to allocate the thread from
   \param func a function to execute in the thread
@@ -1186,13 +1186,13 @@ SWITCH_DECLARE(const char *) switch_core_session_get_text_buffer(switch_core_ses
 SWITCH_DECLARE(void) switch_core_session_launch_thread(_In_ switch_core_session_t *session,
                                                                                                           _In_ void *(*func) (switch_thread_t *, void *), _In_opt_ void *obj);
 
-/*! 
+/*!
   \brief Signal a thread using a thread session to terminate
   \param session the session to indicate to
 */
 SWITCH_DECLARE(void) switch_core_thread_session_end(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Launch a service thread on a session to drop inbound data
   \param session the session the launch thread on
 */
@@ -1200,7 +1200,7 @@ SWITCH_DECLARE(void) switch_core_service_session_av(_In_ switch_core_session_t *
 #define switch_core_service_session(_s) switch_core_service_session_av(_s, SWITCH_TRUE, SWITCH_FALSE)
 
 
-/*! 
+/*!
   \brief Request an outgoing session spawned from an existing session using a desired endpoing module
   \param session the originating session
   \param var_event switch_event_t containing paramaters
@@ -1219,7 +1219,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(_In_opt
                                                                                                                                                 _Inout_ switch_memory_pool_t **pool, _In_ switch_originate_flag_t flags,
                                                                                                                                                 switch_call_cause_t *cancel_cause);
 
-/*! 
+/*!
   \brief Receive a message on a given session
   \param session the session to receive the message from
   \param message the message to recieve
@@ -1231,7 +1231,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(_In_
 #define switch_core_session_receive_message(_session, _message) switch_core_session_perform_receive_message(_session, _message, \
                                                                                                                                                                                                                        __FILE__, __SWITCH_FUNC__, __LINE__)
 
-/*! 
+/*!
   \brief Queue an event on a given session
   \param session the session to queue the message on
   \param event the event to queue
@@ -1240,7 +1240,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(_In_
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(_In_ switch_core_session_t *session, _Inout_ switch_event_t **event);
 
 
-/*! 
+/*!
   \brief Indicate the number of waiting events on a session
   \param session the session to check
   \return the number of events
@@ -1248,11 +1248,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(_In_ switch_core
 SWITCH_DECLARE(uint32_t) switch_core_session_event_count(_In_ switch_core_session_t *session);
 
 /*
-  Number of parsable messages waiting on the session. 
+  Number of parsable messages waiting on the session.
  */
 SWITCH_DECLARE(uint32_t) switch_core_session_messages_waiting(switch_core_session_t *session);
 
-/*! 
+/*!
   \brief DE-Queue an event on a given session
   \param session the session to de-queue the message on
   \param event the de-queued event
@@ -1261,7 +1261,7 @@ SWITCH_DECLARE(uint32_t) switch_core_session_messages_waiting(switch_core_sessio
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event, switch_bool_t force);
 
-/*! 
+/*!
   \brief Queue a private event on a given session
   \param session the session to queue the message on
   \param event the event to queue
@@ -1272,14 +1272,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_private_event(_In_ swi
                                                                                                                                                switch_bool_t priority);
 
 
-/*! 
+/*!
   \brief Indicate the number of waiting private events on a session
   \param session the session to check
   \return the number of events
 */
 SWITCH_DECLARE(uint32_t) switch_core_session_private_event_count(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief DE-Queue a private event on a given session
   \param session the session to de-queue the message on
   \param event the de-queued event
@@ -1296,7 +1296,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(_In_ s
 SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_session_t *session);
 
 
-/*! 
+/*!
   \brief Read a frame from a session
   \param session the session to read from
   \param frame a NULL pointer to a frame to aim at the newly read frame
@@ -1307,7 +1307,7 @@ SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_se
 SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
                                                                                                                           int stream_id);
 
-/*! 
+/*!
   \brief Read a video frame from a session
   \param session the session to read from
   \param frame a NULL pointer to a frame to aim at the newly read frame
@@ -1317,7 +1317,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
                                                                                                                                         int stream_id);
-/*! 
+/*!
   \brief Write a video frame to a session
   \param session the session to write to
   \param frame a pointer to a frame to write
@@ -1328,7 +1328,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch
 SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
                                                                                                                                          int stream_id);
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_write_encoded_video_frame(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_write_encoded_video_frame(switch_core_session_t *session,
                                                                                                                                                switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp);
@@ -1336,14 +1336,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_impl(switch_core_s
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp);
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp);
 
-/*! 
+/*!
   \brief Reset the buffers and resampler on a session
   \param session the session to reset
   \param flush_dtmf flush all queued dtmf events too
 */
 SWITCH_DECLARE(void) switch_core_session_reset(_In_ switch_core_session_t *session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec);
 
-/*! 
+/*!
   \brief Write a frame to a session
   \param session the session to write to
   \param frame the frame to write
@@ -1365,14 +1365,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(_In_ sw
 */
 #define switch_core_session_kill_channel(session, sig) switch_core_session_perform_kill_channel(session, __FILE__, __SWITCH_FUNC__, __LINE__, sig)
 
-/*! 
+/*!
   \brief Send DTMF to a session
   \param session session to send DTMF to
   \param dtmf dtmf to send to the session
   \return SWITCH_STATUS_SUCCESS if the dtmf was written
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(_In_ switch_core_session_t *session, const switch_dtmf_t *dtmf);
-/*! 
+/*!
   \brief Send DTMF to a session
   \param session session to send DTMF to
   \param dtmf_string string to send to the session
@@ -1380,7 +1380,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(_In_ switch_core_s
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core_session_t *session, const char *dtmf_string);
 
-/*! 
+/*!
   \brief RECV DTMF on a session
   \param session session to recv DTMF from
   \param dtmf string to recv from the session
@@ -1394,7 +1394,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(_In_ switch_core_s
 ///\defgroup hashf Hash Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Initialize a hash table
   \param hash a NULL pointer to a hash table to aim at the new hash
   \param pool the pool to use for the new hash
@@ -1405,14 +1405,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(_Out_ switch_hash_t *
 #define switch_core_hash_init_nocase(_hash) switch_core_hash_init_case(_hash, SWITCH_FALSE)
 
 
-/*! 
+/*!
   \brief Destroy an existing hash table
   \param hash the hash to destroy
   \return SWITCH_STATUS_SUCCESS if the hash is destroyed
 */
 SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(_Inout_ switch_hash_t **hash);
 
-/*! 
+/*!
   \brief Insert data into a hash
   \param hash the hash to add data to
   \param key the name of the key to add the data to
@@ -1424,7 +1424,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(_In_ switch_h
 #define switch_core_hash_insert(_h, _k, _d) switch_core_hash_insert_destructor(_h, _k, _d, NULL)
 
 
-/*! 
+/*!
   \brief Insert data into a hash
   \param hash the hash to add data to
   \param key the name of the key to add the data to
@@ -1435,7 +1435,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(_In_ switch_h
 */
 SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data,
                                                                                                                           _In_opt_ switch_mutex_t *mutex);
-/*! 
+/*!
   \brief Retrieve data from a given hash
   \param hash the hash to retrieve from
   \param key the key to retrieve
@@ -1444,7 +1444,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_
 */
 SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_wrlock(switch_hash_t *hash, const char *key, const void *data, switch_thread_rwlock_t *rwlock);
 
-/*! 
+/*!
   \brief Delete data from a hash based on desired key
   \param hash the hash to delete from
   \param key the key from which to delete the data
@@ -1452,7 +1452,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_wrlock(switch_hash_t *ha
 */
 SWITCH_DECLARE(void *) switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_ const char *key);
 
-/*! 
+/*!
   \brief Delete data from a hash based on desired key
   \param hash the hash to delete from
   \param key the key from which to delete the data
@@ -1461,7 +1461,7 @@ SWITCH_DECLARE(void *) switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_
 */
 SWITCH_DECLARE(void *) switch_core_hash_delete_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ switch_mutex_t *mutex);
 
-/*! 
+/*!
   \brief Delete data from a hash based on desired key
   \param hash the hash to delete from
   \param key the key from which to delete the data
@@ -1470,7 +1470,7 @@ SWITCH_DECLARE(void *) switch_core_hash_delete_locked(_In_ switch_hash_t *hash,
 */
 SWITCH_DECLARE(void *) switch_core_hash_delete_wrlock(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ switch_thread_rwlock_t *rwlock);
 
-/*! 
+/*!
   \brief Delete data from a hash based on callback function
   \param hash the hash to delete from
   \param callback the function to call which returns SWITCH_TRUE to delete, SWITCH_FALSE to preserve
@@ -1478,7 +1478,7 @@ SWITCH_DECLARE(void *) switch_core_hash_delete_wrlock(_In_ switch_hash_t *hash,
 */
 SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(_In_ switch_hash_t *hash, _In_ switch_hash_delete_callback_t callback, _In_opt_ void *pData);
 
-/*! 
+/*!
   \brief Retrieve data from a given hash
   \param hash the hash to retrieve from
   \param key the key to retrieve
@@ -1487,7 +1487,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(_In_ switch_hash_t
 SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ const char *key);
 
 
-/*! 
+/*!
   \brief Retrieve data from a given hash
   \param hash the hash to retrieve from
   \param key the key to retrieve
@@ -1496,7 +1496,7 @@ SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ co
 */
 SWITCH_DECLARE(void *) switch_core_hash_find_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
 
-/*! 
+/*!
   \brief Retrieve data from a given hash
   \param hash the hash to retrieve from
   \param key the key to retrieve
@@ -1509,7 +1509,7 @@ SWITCH_DECLARE(void *) switch_core_hash_find_rdlock(_In_ switch_hash_t *hash, _I
  \brief Gets the first element of a hashtable
  \param deprecate_me [deprecated] NULL
  \param hash the hashtable to use
- \return The element, or NULL if it wasn't found 
+ \return The element, or NULL if it wasn't found
 */
 SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_first_iter(_In_ switch_hash_t *hash, switch_hash_index_t *hi);
 #define switch_core_hash_first(_h) switch_core_hash_first_iter(_h, NULL)
@@ -1530,10 +1530,10 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_next(_In_ switch_hash_ind
 
 /*!
  \brief Gets the key and value of the current hash element
- \param hi The current element 
+ \param hi The current element
  \param key [out] the key
  \param klen [out] the key's size
- \param val [out] the value 
+ \param val [out] the value
 */
 SWITCH_DECLARE(void) switch_core_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen)
                                                                          const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
@@ -1551,7 +1551,7 @@ SWITCH_DECLARE(void *) switch_core_inthash_find(switch_inthash_t *hash, uint32_t
 ///\defgroup timer Timer Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Request a timer handle using given time module
   \param timer a timer object to allocate to
   \param timer_name the name of the timer module to use
@@ -1565,14 +1565,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, co
 
 SWITCH_DECLARE(void) switch_time_calibrate_clock(void);
 
-/*! 
+/*!
   \brief Wait for one cycle on an existing timer
   \param timer the timer to wait on
   \return the newest sample count
 */
 SWITCH_DECLARE(switch_status_t) switch_core_timer_next(switch_timer_t *timer);
 
-/*! 
+/*!
   \brief Step the timer one step
   \param timer the timer to wait on
   \return the newest sample count
@@ -1581,7 +1581,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_step(switch_timer_t *timer);
 
 SWITCH_DECLARE(switch_status_t) switch_core_timer_sync(switch_timer_t *timer);
 
-/*! 
+/*!
   \brief Check if the current step has been exceeded
   \param timer the timer to wait on
   \param step increment timer if a tick was detected
@@ -1589,7 +1589,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_sync(switch_timer_t *timer);
 */
 SWITCH_DECLARE(switch_status_t) switch_core_timer_check(switch_timer_t *timer, switch_bool_t step);
 
-/*! 
+/*!
   \brief Destroy an allocated timer
   \param timer timer to destroy
   \return SWITCH_STATUS_SUCCESS after destruction
@@ -1600,7 +1600,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_destroy(switch_timer_t *timer)
 ///\defgroup codecs Codec Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Initialize a codec handle
   \param codec the handle to initilize
   \param codec_name the name of the codec module to use
@@ -1623,16 +1623,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec
                                                                                                                                        int ms,
                                                                                                                                        int channels,
                                                                                                                                        uint32_t bitrate,
-                                                                                                                                       uint32_t flags, 
-                                                                                                                                       const switch_codec_settings_t *codec_settings, 
+                                                                                                                                       uint32_t flags,
+                                                                                                                                       const switch_codec_settings_t *codec_settings,
                                                                                                                                        switch_memory_pool_t *pool);
-                                                               
-SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, 
+
+SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec,
                                                                                                           const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp);
 SWITCH_DECLARE(switch_status_t) switch_core_codec_reset(switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Encode data using a codec handle
   \param codec the codec handle to use
   \param other_codec the codec handle of the last codec used
@@ -1653,7 +1653,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode(switch_codec_t *codec,
                                                                                                                 uint32_t decoded_rate,
                                                                                                                 void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag);
 
-/*! 
+/*!
   \brief Decode data using a codec handle
   \param codec the codec handle to use
   \param other_codec the codec handle of the last codec used
@@ -1694,8 +1694,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode_video(switch_codec_t *c
   \param ret_data a void pointer to a pointer of return data
   \return SWITCH_STATUS_SUCCESS if the command was received
 */
-SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec, 
-                                                                                                                 switch_codec_control_command_t cmd, 
+SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
+                                                                                                                 switch_codec_control_command_t cmd,
                                                                                                                  switch_codec_control_type_t ctype,
                                                                                                                  void *cmd_data,
                                                                                                                  switch_codec_control_type_t atype,
@@ -1713,14 +1713,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
 */
 SWITCH_DECLARE(switch_status_t) switch_core_codec_decode_video(switch_codec_t *codec, switch_frame_t *frame);
 
-/*! 
+/*!
   \brief Destroy an initalized codec handle
   \param codec the codec handle to destroy
   \return SWITCH_STATUS_SUCCESS if the codec was destroyed
 */
 SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Assign the read codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1728,7 +1728,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Assign the original read codec to a given session.  This is the read codec used by an endpoint.
   \param session session to add the codec to
   \param codec the codec to add
@@ -1753,21 +1753,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_c
 SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
 
 
-/*! 
+/*!
   \brief Retrieve the read codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_read_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve the effevtive read codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_read_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Assign the write codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1775,21 +1775,21 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_read_codec(_I
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Retrieve the write codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_write_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve the effevtive write codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_write_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Assign the video_read codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1797,14 +1797,14 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_write_codec(_
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Retrieve the video_read codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_read_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Assign the video_write codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1812,7 +1812,7 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_read_codec(_In_ s
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Retrieve the video_write codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
@@ -1823,14 +1823,14 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_write_codec(_In_
 ///\defgroup db Database Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Open a core db (SQLite) file
   \param filename the path to the db file to open
   \return the db handle
 */
 SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(const char *filename);
 
-/*! 
+/*!
   \brief Execute a sql stmt until it is accepted
   \param db the db handle
   \param sql the sql to execute
@@ -1844,7 +1844,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_db_persistant_execute_trans(switch_c
 
 
 
-/*! 
+/*!
   \brief perform a test query then perform a reactive query if the first one fails
   \param db the db handle
   \param test_sql the test sql
@@ -1865,7 +1865,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
                                                                                                                          _In_ uint32_t channels,
                                                                                                                          _In_ uint32_t rate, _In_ unsigned int flags, _In_opt_ switch_memory_pool_t *pool);
 
-/*! 
+/*!
   \brief Open a media file using file format modules
   \param _fh a file handle to use
   \param _file_path the path to the file
@@ -1879,7 +1879,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
 #define switch_core_file_open(_fh, _file_path, _channels, _rate, _flags, _pool) \
        switch_core_perform_file_open(__FILE__, __SWITCH_FUNC__, __LINE__, _fh, _file_path, _channels, _rate, _flags, _pool)
 
-/*! 
+/*!
   \brief Read media from a file handle
   \param fh the file handle to read from (must be initilized by you memset all 0 for read, fill in channels and rate for write)
   \param data the buffer to read the data to
@@ -1888,7 +1888,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
 */
 SWITCH_DECLARE(switch_status_t) switch_core_file_read(_In_ switch_file_handle_t *fh, void *data, switch_size_t *len);
 
-/*! 
+/*!
   \brief Write media to a file handle
   \param fh the file handle to write to
   \param data the buffer to write
@@ -1897,7 +1897,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(_In_ switch_file_handle_t
 */
 SWITCH_DECLARE(switch_status_t) switch_core_file_write(_In_ switch_file_handle_t *fh, void *data, switch_size_t *len);
 
-/*! 
+/*!
   \brief Write media to a file handle
   \param fh the file handle to write to
   \param data the buffer to write
@@ -1917,7 +1917,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read_video(switch_file_handle_t
 */
 SWITCH_DECLARE(switch_status_t) switch_core_file_seek(_In_ switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence);
 
-/*! 
+/*!
   \brief Set metadata to the desired string
   \param fh the file handle to set data to
   \param col the enum of the col name
@@ -1926,7 +1926,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(_In_ switch_file_handle_t
 */
 SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(_In_ switch_file_handle_t *fh, switch_audio_col_t col, const char *string);
 
-/*! 
+/*!
   \brief get metadata of the desired string
   \param fh the file handle to get data from
   \param col the enum of the col name
@@ -1936,7 +1936,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(_In_ switch_file_han
 SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(_In_ switch_file_handle_t *fh, switch_audio_col_t col, const char **string);
 
 
-/*! 
+/*!
   \brief Close an open file handle
   \param fh the file handle to close
   \return SWITCH_STATUS_SUCCESS if the file handle was closed
@@ -1954,7 +1954,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_file_has_video(switch_file_handle_t *f
 ///\defgroup speech ASR/TTS Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Open a speech handle
   \param sh a speech handle to use
   \param module_name the speech module to use
@@ -1969,10 +1969,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handl
                                                                                                                const char *module_name,
                                                                                                                const char *voice_name,
                                                                                                                _In_ unsigned int rate,
-                                                                                                               _In_ unsigned int interval, 
+                                                                                                               _In_ unsigned int interval,
                                                                                                                _In_ unsigned int channels,
                                                                                                                switch_speech_flag_t *flags, _In_opt_ switch_memory_pool_t *pool);
-/*! 
+/*!
   \brief Feed text to the TTS module
   \param sh the speech handle to feed
   \param text the buffer to write
@@ -1981,13 +1981,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handl
 */
 SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags);
 
-/*! 
+/*!
   \brief Flush TTS audio on a given handle
   \param sh the speech handle
 */
 SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh);
 
-/*! 
+/*!
   \brief Set a text parameter on a TTS handle
   \param sh the speech handle
   \param param the parameter
@@ -1995,7 +1995,7 @@ SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh);
 */
 SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val);
 
-/*! 
+/*!
   \brief Set a numeric parameter on a TTS handle
   \param sh the speech handle
   \param param the parameter
@@ -2003,7 +2003,7 @@ SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *s
 */
 SWITCH_DECLARE(void) switch_core_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val);
 
-/*! 
+/*!
   \brief Set a float parameter on a TTS handle
   \param sh the speech handle
   \param param the parameter
@@ -2011,7 +2011,7 @@ SWITCH_DECLARE(void) switch_core_speech_numeric_param_tts(switch_speech_handle_t
 */
 SWITCH_DECLARE(void) switch_core_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val);
 
-/*! 
+/*!
   \brief Read rendered audio from the TTS module
   \param sh the speech handle to read
   \param data the buffer to read to
@@ -2021,7 +2021,7 @@ SWITCH_DECLARE(void) switch_core_speech_float_param_tts(switch_speech_handle_t *
   \return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful
 */
 SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags);
-/*! 
+/*!
   \brief Close an open speech handle
   \param sh the speech handle to close
   \param flags flags in/out for fine tuning
@@ -2030,7 +2030,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle
 SWITCH_DECLARE(switch_status_t) switch_core_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags);
 
 
-/*! 
+/*!
   \brief Open an asr handle
   \param ah the asr handle to open
   \param module_name the name of the asr module
@@ -2189,7 +2189,7 @@ SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *
 ///\defgroup dir Directory Service Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Open a directory handle
   \param dh a directory handle to use
   \param module_name the directory module to use
@@ -2202,7 +2202,7 @@ SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *
 SWITCH_DECLARE(switch_status_t) switch_core_directory_open(switch_directory_handle_t *dh,
                                                                                                                   char *module_name, char *source, char *dsn, char *passwd, switch_memory_pool_t *pool);
 
-/*! 
+/*!
   \brief Query a directory handle
   \param dh a directory handle to use
   \param base the base to query against
@@ -2211,14 +2211,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_directory_open(switch_directory_hand
 */
 SWITCH_DECLARE(switch_status_t) switch_core_directory_query(switch_directory_handle_t *dh, char *base, char *query);
 
-/*! 
+/*!
   \brief Obtain the next record in a lookup
   \param dh a directory handle to use
   \return SWITCH_STATUS_SUCCESS if another record exists
 */
 SWITCH_DECLARE(switch_status_t) switch_core_directory_next(switch_directory_handle_t *dh);
 
-/*! 
+/*!
   \brief Obtain the next name/value pair in the current record
   \param dh a directory handle to use
   \param var a pointer to pointer of the name to fill in
@@ -2227,7 +2227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_directory_next(switch_directory_hand
 */
 SWITCH_DECLARE(switch_status_t) switch_core_directory_next_pair(switch_directory_handle_t *dh, char **var, char **val);
 
-/*! 
+/*!
   \brief Close an open directory handle
   \param dh a directory handle to close
   \return SWITCH_STATUS_SUCCESS if handle was closed
@@ -2239,14 +2239,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_directory_close(switch_directory_han
 ///\defgroup misc Misc
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Retrieve a FILE stream of a given text channel name
   \param channel text channel enumeration
   \return a FILE stream
 */
 SWITCH_DECLARE(FILE *) switch_core_data_channel(switch_text_channel_t channel);
 
-/*! 
+/*!
   \brief Determines if the core is ready to take calls
   \return SWITCH_TRUE or SWITCH_FALSE
 */
@@ -2254,25 +2254,25 @@ SWITCH_DECLARE(switch_bool_t) switch_core_ready(void);
 
 SWITCH_DECLARE(switch_bool_t) switch_core_running(void);
 
-/*! 
+/*!
   \brief Determines if the core is ready to take inbound calls
   \return SWITCH_TRUE or SWITCH_FALSE
 */
 SWITCH_DECLARE(switch_bool_t) switch_core_ready_inbound(void);
 
-/*! 
+/*!
   \brief Determines if the core is ready to place outbound calls
   \return SWITCH_TRUE or SWITCH_FALSE
 */
 SWITCH_DECLARE(switch_bool_t) switch_core_ready_outbound(void);
 
-/*! 
+/*!
   \brief return core flags
   \return core flags
 */
 SWITCH_DECLARE(switch_core_flag_t) switch_core_flags(void);
 
-/*! 
+/*!
   \brief Execute a management operation.
   \param relative_oid the relative oid of the operation.
   \param action the action to perform.
@@ -2282,14 +2282,14 @@ SWITCH_DECLARE(switch_core_flag_t) switch_core_flags(void);
 */
 SWITCH_DECLARE(switch_status_t) switch_core_management_exec(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen);
 
-/*! 
+/*!
   \brief Switch on the privilege awareness for the process and request required privileges
   \return 0 on success
 */
-                                                               
+
 SWITCH_DECLARE(int32_t) switch_core_set_process_privileges(void);
 
-/*! 
+/*!
   \brief Set the maximum priority the process can obtain
   \return 0 on success
 */
@@ -2299,7 +2299,7 @@ SWITCH_DECLARE(int32_t) set_auto_priority(void);
 SWITCH_DECLARE(int32_t) set_realtime_priority(void);
 SWITCH_DECLARE(int32_t) set_low_priority(void);
 
-/*! 
+/*!
   \brief Change user and/or group of the running process
   \param user name of the user to switch to (or NULL)
   \param group name of the group to switch to (or NULL)
@@ -2312,7 +2312,7 @@ SWITCH_DECLARE(int32_t) set_low_priority(void);
 */
 SWITCH_DECLARE(int32_t) change_user_group(const char *user, const char *group);
 
-/*! 
+/*!
   \brief Run endlessly until the system is shutdown
   \param bg divert console to the background
 */
@@ -2352,7 +2352,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
 SWITCH_DECLARE(FILE *) switch_core_get_console(void);
 
 #ifndef SWIG
-/*! 
+/*!
   \brief Launch a thread
 */
 SWITCH_DECLARE(switch_thread_t *) switch_core_launch_thread(void *(SWITCH_THREAD_FUNC * func) (switch_thread_t *, void *),
@@ -2372,14 +2372,14 @@ SWITCH_DECLARE(void) switch_core_set_globals(void);
 */
 SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, switch_core_session_t *b);
 /*!
-  \brief Checks if a session is using a specific endpoint 
+  \brief Checks if a session is using a specific endpoint
   \param session the session
   \param endpoint_interface interface of the endpoint to check
   \return TRUE or FALSE
 */
 SWITCH_DECLARE(uint8_t) switch_core_session_check_interface(switch_core_session_t *session, const switch_endpoint_interface_t *endpoint_interface);
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_callback(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_callback(switch_core_session_t *session,
                                                                                                                                                        switch_core_video_thread_callback_func_t func, void *user_data);
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_video_read_callback(switch_core_session_t *session, switch_frame_t *frame);
@@ -2391,7 +2391,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, cons
 
 SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_create_module_interface(switch_memory_pool_t *pool, const char *name);
 SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_module_interface_t *mod, switch_module_interface_name_t iname);
-/*! 
+/*!
  \brief Get the current epoch time in microseconds
  \return the current epoch time in microseconds
 */
@@ -2404,10 +2404,10 @@ SWITCH_DECLARE(void) switch_core_memory_reclaim_all(void);
 SWITCH_DECLARE(void) switch_core_setrlimits(void);
 SWITCH_DECLARE(switch_time_t) switch_time_ref(void);
 SWITCH_DECLARE(void) switch_time_sync(void);
-/*! 
+/*!
  \brief Get the current epoch time
- \param [out] (optional) The current epoch time 
- \return The current epoch time 
+ \param [out] (optional) The current epoch time
+ \return The current epoch time
 */
 SWITCH_DECLARE(time_t) switch_epoch_time_now(time_t *t);
 SWITCH_DECLARE(const char *) switch_lookup_timezone(const char *tz_name);
@@ -2519,19 +2519,19 @@ static inline const char *switch_cache_db_type_name(switch_cache_db_handle_type_
 
 SWITCH_DECLARE(switch_cache_db_handle_type_t) switch_cache_db_get_type(switch_cache_db_handle_t *dbh);
 
-/*! 
+/*!
  \brief Returns the handle to the pool, immediately available for other
                threads to use.
  \param [in] The handle
 */
 SWITCH_DECLARE(void) switch_cache_db_dismiss_db_handle(switch_cache_db_handle_t ** dbh);
-/*! 
- \brief Returns the handle to the pool, handle is NOT available to 
+/*!
+ \brief Returns the handle to the pool, handle is NOT available to
                other threads until the allocating thread actually terminates.
  \param [in] The handle
 */
 SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t ** dbh);
-/*! 
+/*!
  \brief Gets a new cached handle from the pool, potentially creating a new connection.
                The connection is bound to the thread until it (the thread) terminates unless
                you dismiss rather than release.
@@ -2545,18 +2545,18 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
                                                                                                                           const char *file, const char *func, int line);
 #define switch_cache_db_get_db_handle(_a, _b, _c) _switch_cache_db_get_db_handle(_a, _b, _c, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_db_handle_t **dbh, const char *dsn, 
+SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_db_handle_t **dbh, const char *dsn,
                                                                                                                                   const char *file, const char *func, int line);
 #define switch_cache_db_get_db_handle_dsn(_a, _b) _switch_cache_db_get_db_handle_dsn(_a, _b, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-/*! 
+/*!
  \brief Executes the create schema sql
  \param [in] dbh The handle
  \param [in] sql - sql to run
  \param [out] err - Error if it exists
 */
 SWITCH_DECLARE(switch_status_t) switch_cache_db_create_schema(switch_cache_db_handle_t *dbh, char *sql, char **err);
-/*! 
+/*!
  \brief Executes the sql and returns the result as a string
  \param [in] dbh The handle
  \param [in] sql - sql to run
@@ -2565,14 +2565,14 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_create_schema(switch_cache_db_ha
  \param [out] err - Error if it exists
 */
 SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t *dbh, char *sql, char *str, size_t len, char **err);
-/*! 
+/*!
  \brief Executes the sql
  \param [in] dbh The handle
  \param [in] sql - sql to run
  \param [out] err - Error if it exists
 */
 SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_handle_t *dbh, char *sql, char **err);
-/*! 
+/*!
  \brief Executes the sql and uses callback for row-by-row processing
  \param [in] dbh The handle
  \param [in] sql - sql to run
@@ -2583,7 +2583,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_hand
 SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cache_db_handle_t *dbh, const char *sql,
                                                                                                                                         switch_core_db_callback_func_t callback, void *pdata, char **err);
 
-/*! 
+/*!
  \brief Executes the sql and uses callback for row-by-row processing
  \param [in] dbh The handle
  \param [in] sql - sql to run
@@ -2611,7 +2611,7 @@ SWITCH_DECLARE(int) switch_cache_db_affected_rows(switch_cache_db_handle_t *dbh)
 */
 SWITCH_DECLARE(int) switch_cache_db_load_extension(switch_cache_db_handle_t *dbh, const char *extension);
 
-/*! 
+/*!
  \brief Provides some feedback as to the status of the db connection pool
  \param [in] stream stream for status
 */
@@ -2656,7 +2656,7 @@ SWITCH_DECLARE(uint32_t) switch_default_rate(const char *name, uint32_t number);
  \param [in] metadata - generic metadata supplied by module
  \param [out] err - Error if it exists
 */
-SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires, 
+SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires,
                                                                                                                         const char *network_ip, const char *network_port, const char *network_proto,
                                                                                                                         const char *metadata);
 /*!
@@ -2716,7 +2716,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
 SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push(switch_sql_queue_manager_t *qm, const char *sql, uint32_t pos, switch_bool_t dup);
 SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_destroy(switch_sql_queue_manager_t **qmp);
 SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_init_name(const char *name,
-                                                                                                                                  switch_sql_queue_manager_t **qmp, 
+                                                                                                                                  switch_sql_queue_manager_t **qmp,
                                                                                                                                   uint32_t numq, const char *dsn, uint32_t max_trans,
                                                                                                                                   const char *pre_trans_execute,
                                                                                                                                   const char *post_trans_execute,
@@ -2745,7 +2745,7 @@ SWITCH_DECLARE(void) switch_sql_queue_manager_execute_sql_event_callback_err(swi
                                                                                                                                                         switch_core_db_event_callback_func_t callback,
                                                                                                                                                         switch_core_db_err_callback_func_t err_callback,
                                                                                                                                                         void *pdata);
-                                                       
+
 SWITCH_DECLARE(pid_t) switch_fork(void);
 
 SWITCH_DECLARE(int) switch_core_gen_certs(const char *prefix);
index 28f23e6480da1a0a374394144cfddec1cb203719..a2d0fd20f72cda005347a333b7610c23dfcf8d48 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  *
@@ -43,7 +43,7 @@ SWITCH_BEGIN_EXTERN_C
  */
 /**
  * @defgroup switch_core_db Database Routines
- * @ingroup switch_sqlite_top 
+ * @ingroup switch_sqlite_top
  * @{
  */
 /**
@@ -60,7 +60,7 @@ typedef int (*switch_core_db_err_callback_func_t) (void *pArg, const char *errms
 ** These are special value for the destructor that is passed in as the
 ** final argument to routines like switch_core_db_result_blob().  If the destructor
 ** argument is SWITCH_CORE_DB_STATIC, it means that the content pointer is constant
-** and will never change.  It does not need to be destroyed.  The 
+** and will never change.  It does not need to be destroyed.  The
 ** SWITCH_CORE_DB_TRANSIENT value means that the content will likely change in
 ** the near future and that the db should make its own private copy of
 ** the content before returning.
@@ -107,7 +107,7 @@ SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t *
  * in a single column of the current result row of a query.  In every
  * case the first parameter is a pointer to the SQL statement that is being
  * executed (the switch_core_db_stmt_t* that was returned from switch_core_db_prepare()) and
- * the second argument is the index of the column for which information 
+ * the second argument is the index of the column for which information
  * should be returned.  iCol is zero-indexed.  The left-most column as an
  * index of 0.
  *
@@ -200,7 +200,7 @@ SWITCH_DECLARE(const char *) switch_core_db_errmsg(switch_core_db_t *db);
  *
  * The return value is is SWITCH_CORE_DB_OK if there are no errors and
  * some other return code if there is an error.  The particular
- * return value depends on the type of error. 
+ * return value depends on the type of error.
  *
  * If the query could not be executed because a database file is
  * locked or busy, then this function returns SWITCH_CORE_DB_BUSY.  (This
@@ -214,7 +214,7 @@ SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, s
  * SQL statement obtained by a previous call to switch_core_db_prepare().
  * If the statement was executed successfully, or
  * not executed at all, then SWITCH_CORE_DB_OK is returned. If execution of the
- * statement failed then an error code is returned. 
+ * statement failed then an error code is returned.
  *
  * This routine can be called at any point during the execution of the
  * virtual machine.  If the virtual machine has not completed execution
@@ -249,12 +249,12 @@ SWITCH_DECLARE(int) switch_core_db_finalize(switch_core_db_stmt_t *pStmt);
  */
 SWITCH_DECLARE(int) switch_core_db_prepare(switch_core_db_t *db, const char *zSql, int nBytes, switch_core_db_stmt_t **ppStmt, const char **pzTail);
 
-/** 
+/**
  * After an SQL query has been compiled with a call to either
  * switch_core_db_prepare(), then this function must be
  * called one or more times to execute the statement.
  *
- * The return value will be either SWITCH_CORE_DB_BUSY, SWITCH_CORE_DB_DONE, 
+ * The return value will be either SWITCH_CORE_DB_BUSY, SWITCH_CORE_DB_DONE,
  * SWITCH_CORE_DB_ROW, SWITCH_CORE_DB_ERROR, or SWITCH_CORE_DB_MISUSE.
  *
  * SWITCH_CORE_DB_BUSY means that the database engine attempted to open
@@ -265,12 +265,12 @@ SWITCH_DECLARE(int) switch_core_db_prepare(switch_core_db_t *db, const char *zSq
  * successfully.  switch_core_db_step() should not be called again on this virtual
  * machine.
  *
- * If the SQL statement being executed returns any data, then 
+ * If the SQL statement being executed returns any data, then
  * SWITCH_CORE_DB_ROW is returned each time a new row of data is ready
  * for processing by the caller. The values may be accessed using
  * the switch_core_db_column_*() functions described below. switch_core_db_step()
  * is called again to retrieve the next row of data.
- * 
+ *
  * SWITCH_CORE_DB_ERROR means that a run-time error (such as a constraint
  * violation) has occurred.  switch_core_db_step() should not be called again on
  * the VM. More information may be found by calling switch_core_db_errmsg().
@@ -303,7 +303,7 @@ SWITCH_DECLARE(int) switch_core_db_reset(switch_core_db_stmt_t *pStmt);
  * In every case, the first parameter is a pointer to the sqlite3_stmt
  * structure returned from switch_core_db_prepare().  The second parameter is the
  * index of the parameter.  The first parameter as an index of 1.  For
- * named parameters (":AAA" or "$VVV") you can use 
+ * named parameters (":AAA" or "$VVV") you can use
  * switch_core_db_bind_parameter_index() to get the correct index value given
  * the parameters name.  If the same named parameter occurs more than
  * once, it is assigned the same index each time.
@@ -325,7 +325,7 @@ SWITCH_DECLARE(int) switch_core_db_bind_int(switch_core_db_stmt_t *pStmt, int i,
  * In every case, the first parameter is a pointer to the sqlite3_stmt
  * structure returned from switch_core_db_prepare().  The second parameter is the
  * index of the parameter.  The first parameter as an index of 1.  For
- * named parameters (":AAA" or "$VVV") you can use 
+ * named parameters (":AAA" or "$VVV") you can use
  * switch_core_db_bind_parameter_index() to get the correct index value given
  * the parameters name.  If the same named parameter occurs more than
  * once, it is assigned the same index each time.
@@ -347,7 +347,7 @@ SWITCH_DECLARE(int) switch_core_db_bind_int64(switch_core_db_stmt_t *pStmt, int
  * In every case, the first parameter is a pointer to the sqlite3_stmt
  * structure returned from switch_core_db_prepare().  The second parameter is the
  * index of the parameter.  The first parameter as an index of 1.  For
- * named parameters (":AAA" or "$VVV") you can use 
+ * named parameters (":AAA" or "$VVV") you can use
  * switch_core_db_bind_parameter_index() to get the correct index value given
  * the parameters name.  If the same named parameter occurs more than
  * once, it is assigned the same index each time.
@@ -377,7 +377,7 @@ SWITCH_DECLARE(int) switch_core_db_bind_text(switch_core_db_stmt_t *pStmt, int i
  * In every case, the first parameter is a pointer to the sqlite3_stmt
  * structure returned from switch_core_db_prepare().  The second parameter is the
  * index of the parameter.  The first parameter as an index of 1.  For
- * named parameters (":AAA" or "$VVV") you can use 
+ * named parameters (":AAA" or "$VVV") you can use
  * sqlite3_bind_parameter_index() to get the correct index value given
  * the parameters name.  If the same named parameter occurs more than
  * once, it is assigned the same index each time.
@@ -404,7 +404,7 @@ SWITCH_DECLARE(int64_t) switch_core_db_last_insert_rowid(switch_core_db_t *db);
  * Instead of invoking a user-supplied callback for each row of the
  * result, this routine remembers each row of the result in memory
  * obtained from malloc(), then returns all of the result after the
- * query has finished. 
+ * query has finished.
  *
  * As an example, suppose the query result where this table:
  *
@@ -431,11 +431,11 @@ SWITCH_DECLARE(int64_t) switch_core_db_last_insert_rowid(switch_core_db_t *db);
  * set to 2.  In general, the number of values inserted into azResult
  * will be ((*nrow) + 1)*(*ncolumn).
  *
- * After the calling function has finished using the result, it should 
- * pass the result data pointer to switch_core_db_free_table() in order to 
- * release the memory that was malloc-ed.  Because of the way the 
- * malloc() happens, the calling function must not try to call 
- * free() directly.  Only switch_core_db_free_table() is able to release 
+ * After the calling function has finished using the result, it should
+ * pass the result data pointer to switch_core_db_free_table() in order to
+ * release the memory that was malloc-ed.  Because of the way the
+ * malloc() happens, the calling function must not try to call
+ * free() directly.  Only switch_core_db_free_table() is able to release
  * the memory properly and safely.
  *
  * The return value of this routine is the same as from switch_core_db_exec().
@@ -542,7 +542,7 @@ SWITCH_DECLARE(int) switch_core_db_load_extension(switch_core_db_t *db, const ch
  *      INSERT INTO table1 VALUES('It's a happy day!');
  *
  * This second example is an SQL syntax error.  As a general rule you
- * should always use %q instead of %s when inserting text into a string 
+ * should always use %q instead of %s when inserting text into a string
  * literal.
  */
 
index f991955bd42346f761dd5312c3a3d5a7af61d090..2e847aaf8d0d5dd34c2b644009dd692c6812a46f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_core_event_hook.h Core Event Hooks
index d794918cb371ac0832e64673c34f63a2759a6fa7..cc053fe9b2feea770b3da243ee3b4a8a51d33745 100644 (file)
@@ -1,5 +1,5 @@
 
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -23,7 +23,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_core_media.c -- Core Media
@@ -134,7 +134,7 @@ typedef struct switch_core_media_params_s {
        char *rtpip;
        char *rtpip4;
        char *rtpip6;
-       
+
 
        char *remote_ip;
        int remote_port;
@@ -185,7 +185,7 @@ static inline const char *switch_media_type2str(switch_media_type_t type)
                return "video";
        default:
                return "!ERR";
-               
+
        }
 }
 
@@ -201,7 +201,7 @@ SWITCH_DECLARE(int32_t) switch_media_handle_test_media_flag(switch_media_handle_
 SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[]);
 SWITCH_DECLARE(void) switch_core_session_check_outgoing_crypto(switch_core_session_t *session);
 SWITCH_DECLARE(const char *) switch_core_session_local_crypto_key(switch_core_session_t *session, switch_media_type_t type);
-SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_session_t *session, 
+SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_session_t *session,
                                                                                                                          const char *varname,
                                                                                                                          switch_media_type_t type, const char *crypto, int crypto_tag, switch_sdp_type_t sdp_type);
 
@@ -224,7 +224,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
 SWITCH_DECLARE(void) switch_core_media_check_video_codecs(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session_t *session, switch_frame_t **frame,
                                                                                                                         switch_io_flag_t flags, int stream_id, switch_media_type_t type);
-SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_session_t *session,
                                                                                                                          switch_frame_t *frame, switch_io_flag_t flags, int stream_id, switch_media_type_t type);
 SWITCH_DECLARE(int) switch_core_media_check_nat(switch_media_handle_t *smh, const char *network_ip);
 
@@ -237,9 +237,9 @@ SWITCH_DECLARE(void) switch_core_media_parse_media_flags(switch_core_session_t *
 SWITCH_DECLARE(void) switch_core_media_deactivate_rtp(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_media_ext_address_lookup(switch_core_session_t *session, char **ip, switch_port_t *port, const char *sourceip);
-SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_core_session_t *session,
                                                                                                                                           switch_core_session_t *other_session, switch_t38_options_t *t38_options);
-SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *session, switch_sdp_type_t sdp_type, 
+SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *session, switch_sdp_type_t sdp_type,
                                                                                                         const char *ip, switch_port_t port, const char *sr, int force);
 SWITCH_DECLARE(void)switch_core_media_set_local_sdp(switch_core_session_t *session, const char *sdp_str, switch_bool_t dup);
 SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session);
@@ -295,14 +295,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core
                                                                                                                                         switch_payload_t *recv_ptP,
                                                                                                                                         char **fmtpP);
 
-SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_session_t *session, 
+SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_session_t *session,
                                                                                                                                  switch_media_type_t type,
-                                                                                                                                 const char *name, 
-                                                                                                                                 const char *modname, 
+                                                                                                                                 const char *name,
+                                                                                                                                 const char *modname,
                                                                                                                                  const char *fmtp,
                                                                                                                                  switch_sdp_type_t sdp_type,
-                                                                                                                                 uint32_t pt, 
-                                                                                                                                 uint32_t rate, 
+                                                                                                                                 uint32_t pt,
+                                                                                                                                 uint32_t rate,
                                                                                                                                  uint32_t ptime,
                                                                                                                                  uint32_t channels,
                                                                                                                                  uint8_t negotiated);
@@ -315,10 +315,10 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp, const char
 SWITCH_DECLARE(char *) switch_core_media_process_sdp_filter(const char *sdp, const char *cmd_buf, switch_core_session_t *session);
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_session_t *session,
                                                                                                                                switch_media_type_t mtype,
                                                                                                                                switch_io_type_t iotype,
-                                                                                                                               switch_codec_control_command_t cmd, 
+                                                                                                                               switch_codec_control_command_t cmd,
                                                                                                                                switch_codec_control_type_t ctype,
                                                                                                                                void *cmd_data,
                                                                                                                                switch_codec_control_type_t atype,
@@ -326,7 +326,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
                                                                                                                                switch_codec_control_type_t *rtype,
                                                                                                                                void **ret_data);
 
-SWITCH_DECLARE(switch_bool_t) switch_core_media_codec_get_cap(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_bool_t) switch_core_media_codec_get_cap(switch_core_session_t *session,
                                                                                                                                switch_media_type_t mtype,
                                                                                                                                switch_codec_flag_t flag);
 
@@ -346,7 +346,7 @@ SWITCH_DECLARE(int) switch_core_media_check_engine_function(switch_core_session_
 SWITCH_DECLARE(void) switch_core_session_video_reinit(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_media_read_lock_unlock(switch_core_session_t *session, switch_media_type_t type, switch_bool_t lock);
 
-#define switch_core_media_read_lock(_s, _t) switch_core_media_read_lock_unlock(_s, _t, SWITCH_TRUE) 
+#define switch_core_media_read_lock(_s, _t) switch_core_media_read_lock_unlock(_s, _t, SWITCH_TRUE)
 #define switch_core_media_read_unlock(_s, _t) switch_core_media_read_lock_unlock(_s, _t, SWITCH_FALSE)
 
 SWITCH_DECLARE(void) switch_core_session_stop_media(switch_core_session_t *session);
@@ -363,7 +363,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_reset_jb(switch_core_session_t
 SWITCH_DECLARE(switch_status_t) switch_core_session_wait_for_video_input_params(switch_core_session_t *session, uint32_t timeout_ms);
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_text_read_callback(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_text_read_callback(switch_core_session_t *session,
                                                                                                                                                   switch_core_text_thread_callback_func_t func, void *user_data);
 SWITCH_DECLARE(switch_status_t) switch_core_session_text_read_callback(switch_core_session_t *session, switch_frame_t *frame);
 SWITCH_DECLARE(switch_status_t) switch_core_session_read_text_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
@@ -373,7 +373,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core
                                                                                                                                         int stream_id);
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_text_factory_create(switch_rtp_text_factory_t **tfP, switch_memory_pool_t *pool);
-SWITCH_DECLARE(switch_status_t) switch_rtp_text_factory_destroy(switch_rtp_text_factory_t **tfP);                                                                                                                      
+SWITCH_DECLARE(switch_status_t) switch_rtp_text_factory_destroy(switch_rtp_text_factory_t **tfP);
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_print(switch_core_session_t *session, const char *data);
 SWITCH_DECLARE(switch_status_t) switch_core_session_printf(switch_core_session_t *session, const char *fmt, ...);
index babe865f4e6fcae813d3f56775b0e0937288f26e..e7f98a8a7bb60f8504edf3a2dc08f45dabb148e4 100644 (file)
@@ -103,7 +103,7 @@ typedef enum {
        SRM_180 = 180,  // Rotate 180 degrees.
        SRM_270 = 270,  // Rotate 270 degrees clockwise.
 } switch_image_rotation_mode_t;
-       
+
 
 /*!\brief Open a descriptor, allocating storage for the underlying image
 *
@@ -318,7 +318,7 @@ SWITCH_DECLARE(void) switch_img_txt_handle_destroy(switch_img_txt_handle_t **han
 SWITCH_DECLARE(uint32_t) switch_img_txt_handle_render(switch_img_txt_handle_t *handle, switch_image_t *img,
                                                                                                          int x, int y, const char *text,
                                                                                                          const char *font_family, const char *font_color, const char *bgcolor, uint16_t font_size, double angle);
-                                                
+
 
 SWITCH_DECLARE(void) switch_img_patch_hole(switch_image_t *IMG, switch_image_t *img, int x, int y, switch_image_rect_t *rect);
 
index ce068aed229fedec6df1a8c926230ae25a1b87de..1e050b28467e5a721e0c5e55892ad3d0f080b19c 100644 (file)
@@ -96,7 +96,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                                                                                        const char *confirm_key,
                                                                                        const char *tts_engine,
                                                                                        const char *tts_voice,
-                                                                                       int confirm_attempts, int inter_timeout, int digit_len, 
+                                                                                       int confirm_attempts, int inter_timeout, int digit_len,
                                                                                        int timeout, int max_failures, int max_timeouts);
                 virtual SWITCH_DECLARE_CONSTRUCTOR ~ IVRMenu();
                 SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
@@ -123,7 +123,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                 void *threadState;             // pointer to the language specific thread state
                 // eg, PyThreadState *threadState
                 void *extra;                   // currently used to store a switch_file_handle_t
-                char *funcargs;                // extra string that will be passed to callback function 
+                char *funcargs;                // extra string that will be passed to callback function
         } input_callback_state_t;
 
         typedef enum {
@@ -211,7 +211,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                 // instead set them here first
                 char *xml_cdr_text;
                 void store_file_handle(switch_file_handle_t *fh);
-                void *on_hangup;               // language specific callback function, cast as void * 
+                void *on_hangup;               // language specific callback function, cast as void *
                 switch_file_handle_t *fhp;
                 char dtmf_buf[512];
 
@@ -251,9 +251,9 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                 SWITCH_DECLARE(const char *) getState();
 
        /** \brief Record to a file
-        * \param file_name 
+        * \param file_name
         * \param <[max_len]> maximum length of the recording in seconds
-        * \param <[silence_threshold]> energy level audio must fall below 
+        * \param <[silence_threshold]> energy level audio must fall below
         *        to be considered silence (500 is a good starting point).
         * \param <[silence_secs]> seconds of silence to interrupt the record.
         */
@@ -266,8 +266,8 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 
        /** \brief Originate a call to a destination
         *
-        * \param a_leg_session - the session where the call is originating from 
-        *                        and also the session in which _this_ session was 
+        * \param a_leg_session - the session where the call is originating from
+        *                        and also the session in which _this_ session was
         *                        created
         * \param dest - a string representing destination, eg, sofia/mydomain.com/foo\@bar.com
         * \param timeout - time to wait for call to be answered
@@ -280,10 +280,10 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                 SWITCH_DECLARE(virtual void) destroy(void);
 
        /** \brief set a DTMF callback function
-        * 
+        *
         * The DTMF callback function will be set and persist
         * for the life of the session, and be called when a dtmf
-        * is pressed by user during streamfile(), collectDigits(), and 
+        * is pressed by user during streamfile(), collectDigits(), and
         * certain other methods are executing.
         *
         */
@@ -300,9 +300,9 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                 SWITCH_DECLARE(int) collectDigits(int abs_timeout);
                 SWITCH_DECLARE(int) collectDigits(int digit_timeout, int abs_timeout);
 
-       /** 
+       /**
         * Collect up to maxdigits digits worth of digits
-        * and store them in dtmf_buf.  In the case of mod_python, the 
+        * and store them in dtmf_buf.  In the case of mod_python, the
         * dtmf_buf parameter is configured to act as a _return_ value,
         * (see mod_python.i).  This does NOT call any callbacks upon
         * receiving dtmf digits.  For that, use collectDigits.
@@ -313,14 +313,14 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                 SWITCH_DECLARE(int) transfer(char *extension, char *dialplan = NULL, char *context = NULL);
 
 
-                SWITCH_DECLARE(char *) read(int min_digits, int max_digits, 
+                SWITCH_DECLARE(char *) read(int min_digits, int max_digits,
                                                                         const char *prompt_audio_file, int timeout, const char *valid_terminators, int digit_timeout = 0);
 
        /** \brief Play a file into channel and collect dtmfs
-        * 
+        *
         * See API docs in switch_ivr.h: switch_play_and_get_digits(..)
         *
-        * NOTE: this does not call any dtmf callbacks set by 
+        * NOTE: this does not call any dtmf callbacks set by
         *       setDTMFCallback(..) as it uses its own internal callback
         *       handler.
         */
@@ -334,7 +334,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
        /** \brief Play a file that resides on disk into the channel
         *
         * \param file - the path to the .wav/.mp3 to be played
-        * \param starting_sample_count - the index of the sample to 
+        * \param starting_sample_count - the index of the sample to
         *                                start playing from
         * \return an int status code indicating success or failure
         *
@@ -374,7 +374,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                 virtual bool begin_allow_threads() = 0;
                 virtual bool end_allow_threads() = 0;
 
-       /** \brief Get the uuid of this session 
+       /** \brief Get the uuid of this session
         * \return the uuid of this session
         */
                 const char *get_uuid() const {
@@ -407,7 +407,7 @@ SWITCH_DECLARE(void) console_clean_log(char *msg);
 SWITCH_DECLARE(void) switch_msleep(unsigned ms);
 
 /** \brief bridge the audio of session_b into session_a
- * 
+ *
  * NOTE: the stuff regarding the dtmf callback might be completely
  *       wrong and has not been reviewed or tested
  */
index e968d2d8dddd62406c82dbf65d6a8f711449ef09..587252786576c28b5ac11fc905bdea8fa20884c6 100644 (file)
@@ -54,7 +54,7 @@ SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_even
 #define switch_curl_easy_setopt curl_easy_setopt
 
 SWITCH_END_EXTERN_C
-                                                                                                                               
+
 #endif
 
 
index 1e89bcd4a55e38fdd47cbbdc0d9189095569df6c..e969f22eee8b42e4fdd2e7fa8410d3e4ea888796 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Cross Platform dso/dll load abstraction
  * Copyright(C) 2008 Michael Jerris
  *
@@ -13,7 +13,7 @@
  * code prove defective in any respect, you (not the initial developer or any other contributor)
  * assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
  * constitutes an essential part of this license. No use of any covered code is authorized hereunder
- * except under this disclaimer. 
+ * except under this disclaimer.
  *
  */
 
index a8c92c3f0265acde8ad0a7df4bad7411503d4c09..26d321cd30661178423e158dcbe58d5339a798e8 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Dragos Oancea <droancea@yahoo.com>
  *
  * switch_estimators.h -- Estimators for Packet Loss, Jitter, RTT , etc
@@ -32,8 +32,8 @@
 
 #ifndef SWITCH_ESTIMATORS_H
 #define SWITCH_ESTIMATORS_H
+
+
 #include <switch.h>
 
 
@@ -41,27 +41,27 @@ SWITCH_BEGIN_EXTERN_C
 
 struct kalman_estimator_s {
        /* initial values for the Kalman filter  */
-       float val_estimate_last ; 
-       float P_last ; 
+       float val_estimate_last ;
+       float P_last ;
        /* the noise in the system:
-       The amount of noise in your measurements and the state-transitions 
-       (e.g. the standard deviation of the signal noise, and how 'wrong' your simplified model 
+       The amount of noise in your measurements and the state-transitions
+       (e.g. the standard deviation of the signal noise, and how 'wrong' your simplified model
        of the state-transitions are) => These are Q and R matrices */
        float Q ; /* the process noise covariance matrix  */
        float R ; /* the measurement noise covariance matrix */
        float K; /*  P_temp * H^T * (H* P_temp * H^T + R)^-1  */
        float P; /*  the Kalman gain (calculated) */
        float val_estimate; /*  x_temp_est + K * (z_measured - H * x_temp_est) */
-       float val_measured; /* the 'noisy' value we measured */ 
-}; 
+       float val_measured; /* the 'noisy' value we measured */
+};
 
 struct cusum_kalman_detector_s {
        /* initial values for the CUSUM Kalman filter  */
        float val_estimate_last;
-       float val_desired_last; 
+       float val_desired_last;
        float P_last;
        float K_last;
-       float delta; 
+       float delta;
        float measurement_noise_e;
        float variance_Re;
        float measurement_noise_v;
@@ -73,14 +73,14 @@ struct cusum_kalman_detector_s {
        /* for calculating variance */
        float last_average;
        float last_q;
-       float N; /*how many samples we have so far (eg: how many RTCP we received, granted that we can calculate RTT for each one of them)*/  
+       float N; /*how many samples we have so far (eg: how many RTCP we received, granted that we can calculate RTT for each one of them)*/
 };
 
 typedef struct kalman_estimator_s kalman_estimator_t;
 typedef struct cusum_kalman_detector_s cusum_kalman_detector_t;
 
 SWITCH_DECLARE(void) switch_kalman_init(kalman_estimator_t *est, float Q, float R);
-SWITCH_DECLARE(switch_bool_t) switch_kalman_cusum_init(cusum_kalman_detector_t *detect_change, float epsilon,float h); 
+SWITCH_DECLARE(switch_bool_t) switch_kalman_cusum_init(cusum_kalman_detector_t *detect_change, float epsilon,float h);
 SWITCH_DECLARE(switch_bool_t) switch_kalman_estimate(kalman_estimator_t * est, float measurement, int system_model);
 SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_detector_t * detector, float measurement, float rtt_avg);
 SWITCH_DECLARE(switch_bool_t) switch_kalman_is_slow_link(kalman_estimator_t * est_loss, kalman_estimator_t * est_rtt);
index fc713fafffb87887c2025b6e309473313ebe2f84..2c6eb483889ee692fc0a80d3f7768ce1c6ca2c16 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  */
 /*! \file switch_event.h
     \brief Event System
-       
+
        The event system uses a backend thread and an APR threadsafe FIFO queue to accept event objects from various threads
        and allow the backend to take control and deliver the events to registered callbacks.
 
        The typical usage would be to bind to one or all of the events and use a callback function to react in various ways
        (see the more_xmpp_event_handler or mod_event_test modules for examples).
 
-       Builtin events are fired by the core at various points in the execution of the application and custom events can be 
+       Builtin events are fired by the core at various points in the execution of the application and custom events can be
        reserved and registered so events from an external module can be rendered and handled by an another even handler module.
 
        If the work time to process an event in a callback is anticipated to grow beyond a very small amount of time it is recommended
-       that you implement your own handler thread and FIFO queue so you can accept the events in the callback and queue them 
-       into your own thread rather than tie up the delivery agent.  It is in the opinion of the author that such a necessity 
-       should be judged on a per-use basis and therefore it does not fall within the scope of this system to provide that 
+       that you implement your own handler thread and FIFO queue so you can accept the events in the callback and queue them
+       into your own thread rather than tie up the delivery agent.  It is in the opinion of the author that such a necessity
+       should be judged on a per-use basis and therefore it does not fall within the scope of this system to provide that
        functionality at a core level.
 
 */
@@ -52,7 +52,7 @@
 /*!
   \defgroup events Eventing Engine
   \ingroup core1
-  \{ 
+  \{
 */
 
 #ifndef SWITCH_EVENT_H
@@ -304,7 +304,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_reserve_subclass_detailed(const cha
 SWITCH_DECLARE(switch_status_t) switch_event_free_subclass_detailed(const char *owner, const char *subclass_name);
 
 /*!
-  \brief Render a string representation of an event suitable for printing or network transport 
+  \brief Render a string representation of an event suitable for printing or network transport
   \param event the event to render
   \param str a string pointer to point at the allocated data
   \param encode url encode the headers
@@ -430,7 +430,7 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max);
 SWITCH_DECLARE(switch_status_t) switch_event_channel_broadcast(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id);
 SWITCH_DECLARE(uint32_t) switch_event_channel_unbind(const char *event_channel, switch_event_channel_func_t func);
 SWITCH_DECLARE(switch_status_t) switch_event_channel_bind(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t *id);
-                                                                                                                 
+
 
 typedef void (*switch_live_array_command_handler_t)(switch_live_array_t *la, const char *cmd, const char *sessid, cJSON *jla, void *user_data);
 
index 67be1e689f5390896a87e3a14e780023f95370e5..54898eff3afff5ee9f47576abb81b5798fc9395a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index 80bc6ba5dc16d2e1e2467aade437df1d873b3b9c..8d1bc53b90e8c0b5cd07131fe8c6dfa58d118927 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * switch_hashtable.h -- Hashtable
@@ -39,7 +39,7 @@ typedef struct switch_hashtable_iterator switch_hashtable_iterator_t;
  *      v = (struct some_value *)   malloc(sizeof(struct some_value));
  *
  *      (initialise k and v to suitable values)
- * 
+ *
  *      if (! hashtable_insert(h,k,v) )
  *      {     exit(-1);               }
  *
@@ -53,7 +53,7 @@ typedef struct switch_hashtable_iterator switch_hashtable_iterator_t;
 
 /* Macros may be used to define type-safe(r) hashtable access functions, with
  * methods specialized to take known key and value types as parameters.
- * 
+ *
  * Example:
  *
  * Insert this at the start of your file:
@@ -83,7 +83,7 @@ typedef struct switch_hashtable_iterator switch_hashtable_iterator_t;
 
 /*****************************************************************************
  * create_hashtable
-   
+
  * @name                    create_hashtable
  * @param   minsize         minimum initial size of hashtable
  * @param   hashfunction    function for hashing keys
@@ -98,7 +98,7 @@ switch_create_hashtable(switch_hashtable_t **hp, unsigned int minsize,
 
 /*****************************************************************************
  * hashtable_insert
-   
+
  * @name        hashtable_insert
  * @param   h   the hashtable to insert into
  * @param   k   the key - hashtable claims ownership and will free on removal
@@ -135,7 +135,7 @@ switch_hashtable_insert_destructor(switch_hashtable_t *h, void *k, void *v, hash
 
 /*****************************************************************************
  * hashtable_search
-   
+
  * @name        hashtable_search
  * @param   h   the hashtable to search
  * @param   k   the key to search for  - does not claim ownership
@@ -153,7 +153,7 @@ switch_hashtable_search(switch_hashtable_t *h, void *k);
 
 /*****************************************************************************
  * hashtable_remove
-   
+
  * @name        hashtable_remove
  * @param   h   the hashtable to remove the item from
  * @param   k   the key to search for  - does not claim ownership
@@ -172,7 +172,7 @@ switch_hashtable_remove(switch_hashtable_t *h, void *k);
 
 /*****************************************************************************
  * hashtable_count
-   
+
  * @name        hashtable_count
  * @param   h   the hashtable
  * @return      the number of items stored in the hashtable
@@ -183,7 +183,7 @@ switch_hashtable_count(switch_hashtable_t *h);
 
 /*****************************************************************************
  * hashtable_destroy
-   
+
  * @name        hashtable_destroy
  * @param   h   the hashtable
  * @param       free_values     whether to call 'free' on the remaining values
@@ -226,7 +226,7 @@ static inline uint32_t switch_hash_default(void *ky)
        unsigned char *str = (unsigned char *) ky;
        uint32_t hash = 0;
     int c;
-       
+
        while ((c = *str)) {
                str++;
         hash = c + (hash << 6) + (hash << 16) - hash;
@@ -240,7 +240,7 @@ static inline uint32_t switch_hash_default_ci(void *ky)
        unsigned char *str = (unsigned char *) ky;
        uint32_t hash = 0;
     int c;
-       
+
        while ((c = switch_tolower(*str))) {
                str++;
         hash = c + (hash << 6) + (hash << 16) - hash;
@@ -261,23 +261,23 @@ static inline uint32_t switch_hash_default_ci(void *ky)
 /*
  * Copyright (c) 2002, Christopher Clark
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
index be3560e6851f46842c24ea89ed4065f732c6412a..39f02339c81fe8025255467590e695f92664f365 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  * Bret McDanel <trixter AT 0xdecafbad dot com>
@@ -31,7 +31,7 @@
  * switch_ivr.h -- IVR Library
  *
  */
-/** 
+/**
  * @file switch_ivr.h
  * @brief IVR Library
  * @see switch_ivr
@@ -75,7 +75,7 @@ typedef struct switch_unicast_conninfo switch_unicast_conninfo_t;
 /**
  * @defgroup switch_ivr IVR Library
  * @ingroup core1
- *     A group of core functions to do IVR related functions designed to be 
+ *     A group of core functions to do IVR related functions designed to be
  *     building blocks for a higher level IVR interface.
  * @{
  */
@@ -179,8 +179,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
   \param args arguements to pass for callbacks etc
   \return SWITCH_STATUS_SUCCESS if all is well
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_session_t *session, 
-                                                                                                                                 const char *file, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_session_t *session,
+                                                                                                                                 const char *file,
                                                                                                                                  const char *mod_name,
                                                                                                                                  const char *grammar,
                                                                                                                                  char **result,
@@ -585,7 +585,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, const char *
   \param originator_uuid the uuid of the originator
   \param originatee_uuid the uuid of the originator
   \remark Any custom state handlers on both channels will be deleted
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uuid, const char *originatee_uuid);
 
@@ -670,11 +670,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const cha
 SWITCH_DECLARE(void) switch_ivr_broadcast_in_thread(switch_core_session_t *session, const char *app, int flags);
 
 /*!
-  \brief Transfer variables from one session to another 
+  \brief Transfer variables from one session to another
   \param sessa the original session
   \param sessb the new session
   \param var the name of the variable to transfer (NULL for all)
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_variable(switch_core_session_t *sessa, switch_core_session_t *sessb, char *var);
 
@@ -689,14 +689,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_variable(switch_core_session
   \brief Create a digit stream parser object
   \param pool the pool to use for the new hash
   \param parser a pointer to the object pointer
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t ** parser);
 
 /*!
   \brief Destroy a digit stream parser object
   \param parser a pointer to the parser object
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_destroy(switch_ivr_digit_stream_parser_t *parser);
 
@@ -720,7 +720,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit
   \param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
   \param digits a string of digits to associate with an action
   \param data consumer data attached to this digit string
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t *parser, char *digits, void *data);
 
@@ -728,7 +728,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_
   \brief Delete a string to action mapping
   \param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
   \param digits the digit string to be removed from the map
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_ivr_digit_stream_parser_t *parser, char *digits);
 
@@ -744,7 +744,7 @@ SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stre
 /*!
   \brief Reset the collected digit stream to nothing
   \param stream a pointer to the parser stream object created by switch_ivr_digit_stream_new
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t *stream);
 
@@ -752,7 +752,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_s
   \brief Set a digit string terminator
   \param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
   \param digit the terminator digit
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(switch_ivr_digit_stream_parser_t *parser, char digit);
 
@@ -766,7 +766,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
  * @defgroup switch_ivr_menu IVR Menu Library
  * @ingroup switch_ivr
  *     IVR menu functions
- *     
+ *
  * @{
  */
 
@@ -918,9 +918,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
                                                                                                uint32_t max_digits,
                                                                                                const char *prompt_audio_file,
                                                                                                const char *var_name,
-                                                                                               char *digit_buffer, 
-                                                                                               switch_size_t digit_buffer_length, 
-                                                                                               uint32_t timeout, 
+                                                                                               char *digit_buffer,
+                                                                                               switch_size_t digit_buffer_length,
+                                                                                               uint32_t timeout,
                                                                                                const char *valid_terminators,
                                                                                                uint32_t digit_timeout);
 
@@ -977,7 +977,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_last_ping(switch_ivr_dmachin
 SWITCH_DECLARE(const char *) switch_ivr_dmachine_get_name(switch_ivr_dmachine_t *dmachine);
 SWITCH_DECLARE(void) switch_ivr_dmachine_set_match_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t match_callback);
 SWITCH_DECLARE(void) switch_ivr_dmachine_set_nonmatch_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t nonmatch_callback);
-SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p,
                                                                                                                   const char *name,
                                                                                                                   switch_memory_pool_t *pool,
                                                                                                                   uint32_t digit_timeout, uint32_t input_timeout,
@@ -987,10 +987,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t
 
 SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachine);
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine,
                                                                                                                 const char *realm,
-                                                                                                                const char *digits, 
-                             switch_byte_t is_priority, 
+                                                                                                                const char *digits,
+                             switch_byte_t is_priority,
                                                                                                                 int32_t key,
                                                                                                                 switch_ivr_dmachine_callback_t callback,
                                                                                                                 void *user_data);
@@ -1019,7 +1019,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_mask(switch_core_sessi
 
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_stop_video_write_overlay_session(switch_core_session_t *session);
-SWITCH_DECLARE(switch_status_t) switch_ivr_video_write_overlay_session(switch_core_session_t *session, const char *img_path, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_video_write_overlay_session(switch_core_session_t *session, const char *img_path,
                                                                                                                                           switch_img_position_t pos, uint8_t alpha);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_capture_text(switch_core_session_t *session, switch_bool_t on);
index e55bcbec28572b77c5185fab49d8bce6a9e0c0ee..5e53967b8b9cb1a1af20b2325ca3c78167db8758 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_jitterbuffer.h -- Audio/Video Jitter Buffer
index e1d7f1e51b2371d3db9eade1f12339098d9f9d4b..af9412e4d7a2066c8a8dfd2f94b92d7d360122a4 100644 (file)
@@ -1,16 +1,16 @@
 /*
   Copyright (c) 2009 Dave Gamble
+
   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software and associated documentation files (the "Software"), to deal
   in the Software without restriction, including without limitation the rights
   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   copies of the Software, and to permit persons to whom the Software is
   furnished to do so, subject to the following conditions:
+
   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.
+
   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -36,7 +36,7 @@ extern "C"
 #define cJSON_String 4
 #define cJSON_Array 5
 #define cJSON_Object 6
-       
+
 #define cJSON_IsReference 256
 
 /* The cJSON structure: */
@@ -81,7 +81,7 @@ SWITCH_DECLARE(const char *)cJSON_GetObjectCstr(const cJSON *object, const char
 
 /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
 SWITCH_DECLARE(const char *)cJSON_GetErrorPtr(void);
-       
+
 /* These calls create a cJSON item of the appropriate type. */
 SWITCH_DECLARE(cJSON *)cJSON_CreateNull(void);
 SWITCH_DECLARE(cJSON *)cJSON_CreateTrue(void);
@@ -110,7 +110,7 @@ SWITCH_DECLARE(cJSON *)cJSON_DetachItemFromArray(cJSON *array,int which);
 SWITCH_DECLARE(void)   cJSON_DeleteItemFromArray(cJSON *array,int which);
 SWITCH_DECLARE(cJSON *)cJSON_DetachItemFromObject(cJSON *object,const char *string);
 SWITCH_DECLARE(void)   cJSON_DeleteItemFromObject(cJSON *object,const char *string);
-       
+
 /* Update array items. */
 SWITCH_DECLARE(void) cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
 SWITCH_DECLARE(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
index 7999c85a02e5fe441a885db4bfbc7605c1cfe0a3..27caa4d587cb0f89a677338e87e3ce41f817f1d9 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Rupa Schomaker <rupa@rupa.com>
  *
  * switch_limit.h - Limit generic implementations
  *
  */
 
+
  /*!
   \defgroup limit1 LIMIT code
   \ingroup core1
@@ -40,7 +40,7 @@
 
 SWITCH_BEGIN_EXTERN_C
 
-/*! 
+/*!
   \brief Initilize the LIMIT Core System
   \param pool the memory pool to use for long term allocations
   \note Generally called by the core_init
@@ -48,7 +48,7 @@ SWITCH_BEGIN_EXTERN_C
 SWITCH_DECLARE(void) switch_limit_init(switch_memory_pool_t *pool);
 
 /*!
-  \brief Increment resource.  
+  \brief Increment resource.
   \param backend to use
   \param realm
   \param resource
@@ -59,7 +59,7 @@ SWITCH_DECLARE(void) switch_limit_init(switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_limit_incr(const char *backend, switch_core_session_t *session, const char *realm, const char *resource, const int max, const int interval);
 
 /*!
-  \brief Release resource.  
+  \brief Release resource.
   \param backend to use
   \param realm
   \param resource
index 04cf75d3b7a1d49980dfdfa717d31a0f52e13b82..9299857f68c675dde860c8c427efcd51dc74b8b1 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -33,7 +33,7 @@
     \brief Loadable Module Routines
 
        This module is the gateway between external modules and the core of the application.
-       it contains all the access points to the various pluggable interfaces including the codecs 
+       it contains all the access points to the various pluggable interfaces including the codecs
        and API modules.
 
 */
@@ -49,7 +49,7 @@ SWITCH_BEGIN_EXTERN_C
 /*!
   \defgroup mods Loadable Module Functions
   \ingroup core1
-  \{ 
+  \{
 */
 /*! \brief The abstraction of a loadable module */
        struct switch_loadable_module_interface {
index 62a9e42f154bdabd8bc7f899e9f6c29d98346cfd..f0df9d831535fa2db369d1127844ae188518d475 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -70,21 +70,21 @@ SWITCH_BEGIN_EXTERN_C
 typedef switch_status_t (*switch_log_function_t) (const switch_log_node_t *node, switch_log_level_t level);
 
 
-/*! 
+/*!
   \brief Initilize the logging engine
   \param pool the memory pool to use
   \note to be called at application startup by the core
 */
 SWITCH_DECLARE(switch_status_t) switch_log_init(_In_ switch_memory_pool_t *pool, _In_ switch_bool_t colorize);
 
-/*! 
+/*!
   \brief Shut down the logging engine
   \note to be called at application termination by the core
 */
 SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void);
 
 #ifndef SWIG
-/*! 
+/*!
   \brief Write log data to the logging engine
   \param channel the log channel to write to
   \param file the current file
@@ -101,7 +101,7 @@ SWITCH_DECLARE(void) switch_log_printf(_In_ switch_text_channel_t channel, _In_z
                                                                           _In_z_ const char *func, _In_ int line,
                                                                           _In_opt_z_ const char *userdata, _In_ switch_log_level_t level,
                                                                           _In_z_ _Printf_format_string_ const char *fmt, ...) PRINTF_FUNCTION(7, 8);
-/*!                                                            
+/*!
   \brief Write log data to the logging engine
   \param channel the log channel to write to
   \param file the current file
@@ -119,21 +119,21 @@ SWITCH_DECLARE(void) switch_log_vprintf(_In_ switch_text_channel_t channel, _In_
                                                                                _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, const char *fmt, va_list ap);
 
 #endif
-/*! 
+/*!
   \brief Shut down  the logging engine
   \note to be called at application termination by the core
 */
 SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(_In_ switch_log_function_t function, _In_ switch_log_level_t level, _In_ switch_bool_t is_console);
 SWITCH_DECLARE(switch_status_t) switch_log_unbind_logger(_In_ switch_log_function_t function);
 
-/*! 
+/*!
   \brief Return the name of the specified log level
   \param level the level
   \return the name of the log level
 */
         _Ret_z_ SWITCH_DECLARE(const char *) switch_log_level2str(_In_ switch_log_level_t level);
 
-/*! 
+/*!
   \brief Return the level number of the specified log level name
   \param str the name of the level
   \return the log level
index 0997bbeb0548a2c75f496cec95d96e02859b98d1..79758ccf33296a58f7f2fa8261508116e0bb4540 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)
  *
@@ -33,7 +33,7 @@
 /*! \file switch_module_interfaces.h
   \brief Module Interface Definitions
 
-  This module holds the definition of data abstractions used to implement various pluggable 
+  This module holds the definition of data abstractions used to implement various pluggable
   interfaces and pluggable event handlers.
 
 */
@@ -44,7 +44,7 @@
 #include "switch_resample.h"
 
 SWITCH_BEGIN_EXTERN_C
-/*! \brief A table of functions to execute at various states 
+/*! \brief A table of functions to execute at various states
  */
        typedef enum {
        SWITCH_SHN_ON_INIT,
@@ -106,7 +106,7 @@ struct switch_stream_handle {
 struct switch_io_event_hooks;
 struct switch_say_file_handle;
 
-typedef switch_call_cause_t (*switch_io_outgoing_channel_t)    
+typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
        (switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t,
         switch_call_cause_t *);
 typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
@@ -560,7 +560,7 @@ struct switch_chat_interface {
        const char *interface_name;
        /*! function to open the directory interface */
        switch_status_t (*chat_send) (switch_event_t *message_event);
-                                                                 
+
        switch_thread_rwlock_t *rwlock;
        int refs;
        switch_mutex_t *reflock;
index fbf7ee2090f2e197682df2c45c5c09f7b2011f15..e9dd324e6799435e373aa84b60fa21f151195e74 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Brian K. West <brian@freeswitch.org>
  *
@@ -51,16 +51,16 @@ typedef enum {
 
 SWITCH_DECLARE(const char *) switch_nat_get_type(void);
 
-/*! 
+/*!
   \brief Initilize the NAT Traversal System
   \param pool the memory pool to use for long term allocations
   \note Generally called by the core_init
 */
 SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool, switch_bool_t mapping);
 
-/*! 
+/*!
   \brief Initilize the rest of the NAT Traversal System
-  \note nat_init is called prior to some other modules being loaded.  
+  \note nat_init is called prior to some other modules being loaded.
         This method allows us to init the rest of the NAT system.
 */
 SWITCH_DECLARE(void) switch_nat_late_init(void);
@@ -95,7 +95,7 @@ SWITCH_DECLARE(void) switch_nat_set_mapping(switch_bool_t mapping);
  \brief Maps a port through the NAT Traversal System
  \param port Internal port to map
  \param proto Protocol
- \param external_port [out] Mapped external port 
+ \param external_port [out] Mapped external port
  \param sticky make the mapping permanent
 */
 SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port,
index 94f18061561ed33c746db24410b5578307b2f602..84e049a1ac3dd7a951c34b36f27b34dc02811c2e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_odbc.h -- ODBC
index e09bcab74386e230f3c9371680257c0d6183b9ec..6ded45bedfadb8a039f270934b1bbfe3995f85c7 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Eliot Gable <egable@gmail.com>
  *
@@ -37,7 +37,7 @@
 
 #define DEFAULT_PGSQL_RETRIES 120
 
-SWITCH_BEGIN_EXTERN_C 
+SWITCH_BEGIN_EXTERN_C
 
 struct switch_pgsql_handle;
 struct switch_pgsql_result;
@@ -57,7 +57,7 @@ typedef enum {
 
 /*!
   \brief Create a new handle for the PGSQL connection.
-  \param dsn The DSN of the database to connect to. See documentation for PQconnectdb() at 
+  \param dsn The DSN of the database to connect to. See documentation for PQconnectdb() at
              http://www.postgresql.org/docs/9.0/static/libpq-connect.html. The DSN *MUST* be
                         prefixed with 'pgsql;' to use the switch_cache_db* functionality. However, the DSN
                         passed to this function directly *MUST NOT* be prefixed with 'pgsql;'.
@@ -82,7 +82,7 @@ SWITCH_DECLARE(switch_pgsql_status_t ) switch_pgsql_handle_disconnect(switch_pgs
                                                                           ) /* Emacs formatting issue */
 #endif
 /*!
-  \brief Connect to the database specified by the DSN passed to the switch_pgsql_handle_new() call which 
+  \brief Connect to the database specified by the DSN passed to the switch_pgsql_handle_new() call which
          initialized this handle.
   \param The database handle to connect to the database.
   \return Returns SWITCH_PGSQL_SUCCESS or SWITCH_PGSQL_FAIL.
index 244afc1f21556db13e6d59230c1818c44f6daa4c..4769a108a98da13591c0ff327fbb7f88a101e000 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_platform.h -- Platform Specific Header
@@ -51,10 +51,10 @@ SWITCH_BEGIN_EXTERN_C
 #define __SWITCH_FUNC__ (const char *)__func__
 #endif
 #ifdef _MSC_VER
-/* disable the following warnings 
- * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored. 
+/* disable the following warnings
+ * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
  * C4200: Non standard extension C zero sized array
- * C4204: nonstandard extension used : non-constant aggregate initializer 
+ * C4204: nonstandard extension used : non-constant aggregate initializer
  * C4706: assignment within conditional expression
  * C4819: The file contains a character that cannot be represented in the current code page
  * C4132: 'object' : const object should be initialized (fires innapropriately for prototyped forward declaration of cost var)
@@ -317,7 +317,7 @@ SWITCH_END_EXTERN_C
 #define NOIME
 #endif
 #include <windows.h>
-/* 
+/*
  * Add a _very_few_ declarations missing from the restricted set of headers
  * (If this list becomes extensive, re-enable the required headers above!)
  * winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
index 6c0a90fcf1bc7474438670faf1a31be484f2e630..e345b605d58cb74dfc0c39eb6d961664f9de9996 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2009, Sangoma Technologies
  * Moises Silva <moy@sangoma.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 struct profile_timer;
 typedef struct profile_timer switch_profile_timer_t;
 
-/*! 
+/*!
  * \brief create a new profile timer
  * \return profile timer structure previously created with new_profile_timer, NULL on error
  */
 SWITCH_DECLARE(switch_profile_timer_t *) switch_new_profile_timer(void);
 
-/*! 
+/*!
  * \brief provides the percentage of idle system time
  * \param p profile timer structure previously created with new_profile_timer
  * \param pointer to store the percentage of idle time
@@ -52,7 +52,7 @@ SWITCH_DECLARE(switch_profile_timer_t *) switch_new_profile_timer(void);
 SWITCH_DECLARE(switch_bool_t) switch_get_system_idle_time(switch_profile_timer_t *p, double *idle_percentage);
 
 
-/*! 
+/*!
  * \brief Deletes profile timer
  */
 SWITCH_DECLARE(void) switch_delete_profile_timer(switch_profile_timer_t **p);
index 9f3f1d00c6efadd0d3d605d6cacfad29eee70a96..22147c180960601402069070450f9f273102cf28 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Michael Jerris <mike@jerris.com>
  *
  * switch_regex.h -- pcre wrapper and extensions Header
@@ -70,7 +70,7 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match(const char *target, const cha
 */
 SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int *partial_match);
 
-SWITCH_DECLARE(void) switch_capture_regex(switch_regex_t *re, int match_count, const char *field_data, 
+SWITCH_DECLARE(void) switch_capture_regex(switch_regex_t *re, int match_count, const char *field_data,
                                                                                  int *ovector, const char *var, switch_cap_callback_t callback, void *user_data);
 
 SWITCH_DECLARE_NONSTD(void) switch_regex_set_var_callback(const char *var, const char *val, void *user_data);
index 4dd0e2c5e3f6b14240df66e577e65b634176854d..04f38f37ee222229eb2796193255563dbc4b0b81 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -34,9 +34,9 @@
 
        This module implements a generic interface for doing audio resampling it currently uses libresample but can be ported to
        any resample library with a little effort.  I decided against making this interface pluggable because there are not many
-       options in terms of resample libraries so it seemed like a waste but I did opt to frontend the interface in case a better 
+       options in terms of resample libraries so it seemed like a waste but I did opt to frontend the interface in case a better
        way comes along some day. =D
-       
+
 */
 #define switch_normalize_volume(x) if (x > 4) x = 4; if (x < -4) x = -4;
 #define switch_normalize_volume_granular(x) if (x > 13) x = 13; if (x < -13) x = -13;
@@ -49,7 +49,7 @@ SWITCH_BEGIN_EXTERN_C
 /*!
   \defgroup resamp Audio Resample Functions
   \ingroup core1
-  \{ 
+  \{
 */
 /*! \brief An audio resampling handle */
        typedef struct {
index 885ee2ac12639c40b6e72a725f56ca9bec820df9..3ae8bd586aa4d872719787758f3bf2aa05e423e5 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  */
-/** 
+/**
  * @file switch_rtp.h
  * @brief RTP
- * 
+ *
  */
 
 #ifndef SWITCH_RTP_H
@@ -162,7 +162,7 @@ typedef enum { /* FMT Values for PSFB Payload Types http://www.iana.org/assignme
        _RTCP_PSFB_TSTR  = 5, /* TSTR: Temporal-Spatial Trade-off Request RFC5104 */
        _RTCP_PSFB_TSTN  = 6, /* TSTN: Temporal-Spatial Trade-off Notification RFC5104 */
        _RTCP_PSFB_VBCM  = 7, /* VBCM: Video Back Channel Message RFC5104 */
-       _RTCP_PSFB_PSLEI = 8, /* PSLEI: Payload-Specific Third-Party Loss Early Indication RFC6642*/ 
+       _RTCP_PSFB_PSLEI = 8, /* PSLEI: Payload-Specific Third-Party Loss Early Indication RFC6642*/
        _RTCP_PSFB_AFB   = 15 /* AFB Application layer FB */
 } rtcp_psfb_t;
 
@@ -180,7 +180,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
 
 
 SWITCH_DECLARE(void) switch_rtp_get_random(void *buf, uint32_t len);
-/*! 
+/*!
   \brief Initilize the RTP System
   \param pool the memory pool to use for long term allocations
   \note Generally called by the core_init
@@ -205,7 +205,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_ssrc(switch_rtp_t *rtp_ses
 */
 SWITCH_DECLARE(switch_port_t) switch_rtp_set_end_port(switch_port_t port);
 
-/*! 
+/*!
   \brief Request a new port to be used for media
   \param ip the ip to request a port from
   \return the new port to use
@@ -216,7 +216,7 @@ SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port)
 SWITCH_DECLARE(switch_status_t) switch_rtp_set_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval);
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval);
-/*! 
+/*!
   \brief create a new RTP session handle
   \param new_rtp_session a poiter to aim at the new session
   \param payload the IANA payload number
@@ -260,7 +260,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
                                                                                          switch_rtp_flag_t flags[], char *timer_name, const char **err, switch_memory_pool_t *pool);
 
 
-/*! 
+/*!
   \brief Assign a remote address to the RTP session
   \param rtp_session an RTP session to assign the remote address to
   \param host the ip or fqhn of the remote address
@@ -279,7 +279,7 @@ SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session
 SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session);
 SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Assign a local address to the RTP session
   \param rtp_session an RTP session to assign the local address to
   \param host the ip or fqhn of the local address
@@ -290,7 +290,7 @@ SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session);
 */
 SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, const char **err);
 
-/*! 
+/*!
   \brief Kill the socket on an existing RTP session
   \param rtp_session an RTP session to kill the socket of
 */
@@ -299,14 +299,14 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session);
 SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session);
 SWITCH_DECLARE(void) switch_rtp_flush(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Test if an RTP session is ready
   \param rtp_session an RTP session to test
   \return a true value if it's ready
 */
 SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Destroy an RTP session
   \param rtp_session an RTP session to destroy
 */
@@ -314,15 +314,15 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session);
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_sync_stats(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Acvite ICE on an RTP session
   \return SWITCH_STATUS_SUCCESS
 */
-SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin, 
+SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin,
                                                                                                                const char *password, const char *rpassword, ice_proto_t proto,
                                                                                                                switch_core_media_ice_type_t type, ice_t *ice_params);
 
-/*! 
+/*!
   \brief Activate sending RTCP Sender Reports (SR's)
   \param send_rate interval in milliseconds to send at
   \return SWITCH_STATUS_SUCCESS
@@ -335,13 +335,13 @@ SWITCH_DECLARE(switch_timer_t *) switch_rtp_get_media_timer(switch_rtp_t *rtp_se
 SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *rtp_session, uint32_t frames, uint32_t max_frames);
 SWITCH_DECLARE(switch_status_t) switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len);
 
-/*! 
+/*!
   \brief Acvite a jitter buffer on an RTP session
   \param rtp_session the rtp session
   \param queue_frames the number of frames to delay
   \return SWITCH_STATUS_SUCCESS
 */
-SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, 
+SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session,
                                                                                                                                  uint32_t queue_frames,
                                                                                                                                  uint32_t max_queue_frames,
                                                                                                                                  uint32_t samples_per_packet, uint32_t samples_per_second);
@@ -379,28 +379,28 @@ SWITCH_DECLARE(uint32_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_
 */
 SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flag);
 
-/*! 
+/*!
   \brief Retrieve the socket from an existing RTP session
   \param rtp_session the RTP session to retrieve the socket from
   \return the socket from the RTP session
 */
 SWITCH_DECLARE(switch_socket_t *) switch_rtp_get_rtp_socket(switch_rtp_t *rtp_session);
 SWITCH_DECLARE(void) switch_rtp_ping(switch_rtp_t *rtp_session);
-/*! 
+/*!
   \brief Get the default samples per interval for a given RTP session
   \param rtp_session the RTP session to get the samples per interval from
   \return the default samples per interval of the RTP session
 */
 SWITCH_DECLARE(uint32_t) switch_rtp_get_default_samples_per_interval(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Set the default payload number for a given RTP session
   \param rtp_session the RTP session to set the payload number on
-  \param payload the new default payload number 
+  \param payload the new default payload number
 */
 SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp_t *rtp_session, switch_payload_t payload);
 
-/*! 
+/*!
   \brief Get the default payload number for a given RTP session
   \param rtp_session the RTP session to get the payload number from
   \return the default payload of the RTP session
@@ -408,15 +408,15 @@ SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp_t *rtp_session, s
 SWITCH_DECLARE(uint32_t) switch_rtp_get_default_payload(switch_rtp_t *rtp_session);
 
 
-/*! 
+/*!
   \brief Set a callback function to execute when an invalid RTP packet is encountered
   \param rtp_session the RTP session
   \param on_invalid the function to set
-  \return 
+  \return
 */
 SWITCH_DECLARE(void) switch_rtp_set_invalid_handler(switch_rtp_t *rtp_session, switch_rtp_invalid_handler_t on_invalid);
 
-/*! 
+/*!
   \brief Read data from a given RTP session
   \param rtp_session the RTP session to read from
   \param data the data to read
@@ -429,7 +429,7 @@ SWITCH_DECLARE(void) switch_rtp_set_invalid_handler(switch_rtp_t *rtp_session, s
 SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen,
                                                                                                switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags);
 
-/*! 
+/*!
   \brief Queue RFC2833 DTMF data into an RTP Session
   \param rtp_session the rtp session to use
   \param dtmf the dtmf digits to queue
@@ -437,7 +437,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void
 */
 SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf);
 
-/*! 
+/*!
   \brief Queue RFC2833 DTMF data into an RTP Session
   \param rtp_session the rtp session to use
   \param dtmf the dtmf digits to queue
@@ -460,7 +460,7 @@ SWITCH_DECLARE(switch_size_t) switch_rtp_has_dtmf(switch_rtp_t *rtp_session);
 */
 SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, switch_dtmf_t *dtmf);
 
-/*! 
+/*!
   \brief Read data from a given RTP session without copying
   \param rtp_session the RTP session to read from
   \param data a pointer to point directly to the RTP read buffer
@@ -474,7 +474,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_sessi
                                                                                                                 void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags,
                                                                                                                 switch_io_flag_t io_flags);
 
-/*! 
+/*!
   \brief Read data from a given RTP session without copying
   \param rtp_session the RTP session to read from
   \param frame a frame to populate with information
@@ -484,7 +484,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_sessi
 SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame_t *frame, switch_io_flag_t io_flags);
 
 
-/*! 
+/*!
   \brief Read RTCP data from a given RTP session without copying
   \param rtp_session the RTP session to read from
   \param frame an RTCP frame to populate with information
@@ -512,7 +512,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session,
 */
 SWITCH_DECLARE(switch_status_t) switch_rtp_disable_vad(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Write data to a given RTP session
   \param rtp_session the RTP session to write to
   \param frame the frame to write
@@ -520,7 +520,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_disable_vad(switch_rtp_t *rtp_session
 */
 SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_frame_t *frame);
 
-/*! 
+/*!
   \brief Write data with a specified payload and sequence number to a given RTP session
   \param rtp_session the RTP session to write to
   \param data data to write
@@ -536,21 +536,21 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session, void *data, switch_size_t *bytes, switch_bool_t process_encryption);
 
-/*! 
+/*!
   \brief Retrieve the SSRC from a given RTP session
   \param rtp_session the RTP session to retrieve from
   \return the SSRC
 */
 SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Associate an arbitrary data pointer with and RTP session
   \param rtp_session the RTP session to assign the pointer to
   \param private_data the private data to assign
 */
 SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *private_data);
 
-/*! 
+/*!
   \brief Set the payload type to consider RFC2833 DTMF
   \param rtp_session the RTP session to modify
   \param te the payload type
@@ -558,14 +558,14 @@ SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *pri
 SWITCH_DECLARE(void) switch_rtp_set_telephony_event(switch_rtp_t *rtp_session, switch_payload_t te);
 SWITCH_DECLARE(void) switch_rtp_set_telephony_recv_event(switch_rtp_t *rtp_session, switch_payload_t te);
 
-/*! 
+/*!
   \brief Set the payload type for comfort noise
   \param rtp_session the RTP session to modify
   \param pt the payload type
 */
 SWITCH_DECLARE(void) switch_rtp_set_cng_pt(switch_rtp_t *rtp_session, switch_payload_t pt);
 
-/*! 
+/*!
   \brief Retrieve the private data from a given RTP session
   \param rtp_session the RTP session to retrieve the data from
   \return the pointer to the private data
index dc23e9f87ed02a3e6fdc29151bb2ce1a3945306e..14403917ca773d876d1bee4525e63398091f1442 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -59,7 +59,7 @@ SWITCH_BEGIN_EXTERN_C
   \param group a group id tag to link multiple tasks to a single entity.
   \param cmd_id an arbitrary index number be used in the callback.
   \param cmd_arg user data to be passed to the callback.
-  \param flags flags to alter behaviour 
+  \param flags flags to alter behaviour
   \return the id of the task
 */
 SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime,
index 59cbdd3215a93f94ecb88a3260ee6c9b325c2455..f05a6e11dfe30a7d4d732ebf24e3e8c43ecebe2b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -80,7 +80,7 @@ typedef enum {
        SWITCH_STUN_ATTR_SOURCE_ADDRESS2 = 0x0012,      /* Address */
        SWITCH_STUN_ATTR_DATA = 0x0013, /* ByteString */
        SWITCH_STUN_ATTR_OPTIONS = 0x8001,      /* UInt32 */
-       SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS = 0x0020,   /* Address */  
+       SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS = 0x0020,   /* Address */
 
        /* ice crap */
 
index b2b28e91d8878475b492ca926b627af9050bd5fa..0ebcef406ee78a215abd906a672999d46395139e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad dot com>
  * Joseph Sullivan <jossulli@amazon.com>
@@ -644,7 +644,7 @@ typedef struct {
        switch_size_t flush_packet_count;
        switch_size_t largest_jb_size;
        /* Jitter */
-       int64_t last_proc_time;         
+       int64_t last_proc_time;
        int64_t jitter_n;
        int64_t jitter_add;
        int64_t jitter_addsq;
@@ -660,7 +660,7 @@ typedef struct {
        double mean_interval;
        int loss[LOST_BURST_CAPTURE];
        int last_loss;
-       int recved;     
+       int recved;
        int last_processed_seq;
        switch_size_t flaws;
        switch_size_t last_flaw;
@@ -688,7 +688,7 @@ typedef struct {
        uint16_t cycle;               /* Packet loss calculation, sequence number cycle of the current RTCP report interval */
        uint32_t bad_seq;             /* Bad SEQ found, used to detect reset on the other side */
        uint16_t base_seq;            /* Packet loss calculation, first sequence number received */
-       uint32_t cum_lost;            /* Packet loss calculation, cumulative number of packet lost */ 
+       uint32_t cum_lost;            /* Packet loss calculation, cumulative number of packet lost */
        uint32_t last_recv_lsr_local; /* RTT calculation, When receiving an SR we save our local timestamp in fraction of 65536 seconds */
        uint32_t last_recv_lsr_peer;  /* RTT calculation, When receiving an SR we extract the middle 32bits of the remote NTP timestamp to include it in the next SR LSR */
        uint32_t init;
@@ -725,7 +725,7 @@ typedef enum {
        SWITCH_RTP_FLAG_DATAWAIT          - Do not return from reads unless there is data even when non blocking
        SWITCH_RTP_FLAG_BUGGY_2833    - Emulate the bug in cisco equipment to allow interop
        SWITCH_RTP_FLAG_PASS_RFC2833  - Pass 2833 (ignore it)
-       SWITCH_RTP_FLAG_AUTO_CNG      - Generate outbound CNG frames when idle    
+       SWITCH_RTP_FLAG_AUTO_CNG      - Generate outbound CNG frames when idle
 </pre>
  */
 typedef enum {
@@ -804,10 +804,10 @@ typedef enum {
                   final_duration - initial_timestamp = total_samples
 
                   However, if the duration value exceeds the space allocated (16 bits), The sender should increment
-                  the timestamp one unit and reset the duration to 0. 
+                  the timestamp one unit and reset the duration to 0.
 
                   Always sending a duration of 0 with a new timestamp should be tolerated but is rarely intentional
-                  and is mistakenly done by many devices.  
+                  and is mistakenly done by many devices.
                   The issue is that the Sonus expects everyone to do it this way instead of tolerating either way.
                   Sonus will actually ignore every packet with the same timestamp before concluding if it's DTMF.
 
@@ -825,19 +825,19 @@ typedef enum {
 
         */
 
-       
+
        RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3),
 
        /*
          Our friends at Sonus get real mad when the timestamps are not in perfect sequence even during periods of silence.
          With this flag, we will only increment the timestamp when write packets even if they are eons apart.
-         
+
         */
 
        RTP_BUG_START_SEQ_AT_ZERO = (1 << 4),
 
        /*
-         Our friends at Sonus also get real mad if the sequence number does not start at 0.  
+         Our friends at Sonus also get real mad if the sequence number does not start at 0.
          Typically, we set this to a random starting value for your saftey.
          This is a security risk you take upon yourself when you enable this flag.
         */
@@ -849,9 +849,9 @@ typedef enum {
          Our friends at Sonus are on a roll, They also get easily dumbfounded by marker bits.
          This flag will never send any. Sheesh....
         */
-       
+
        RTP_BUG_IGNORE_DTMF_DURATION = (1 << 6),
-       
+
        /*
          Guess Who? ... Yep, Sonus (and who know's who else) likes to interweave DTMF with the audio stream making it take
          2X as long as it should and sending an incorrect duration making the DTMF very delayed.
@@ -890,12 +890,12 @@ typedef enum {
         */
 
        RTP_BUG_FLUSH_JB_ON_DTMF = (1 << 10),
-       
+
        /* FLUSH JITTERBUFFER When getting RFC2833 to reduce bleed through */
 
        RTP_BUG_ACCEPT_ANY_PAYLOAD = (1 << 11),
 
-       /* 
+       /*
          Make FS accept any payload type instead of dropping and returning CNG frame. Workaround while FS only supports a single payload per rtp session.
          This can be used by endpoint modules to detect payload changes and act appropriately (ex: sofia could send a reINVITE with single codec).
          This should probably be a flag, but flag enum is already full!
@@ -1032,7 +1032,7 @@ typedef uint32_t switch_ivr_option_t;
        SWITCH_MESSAGE_REDIRECT_AUDIO     - Indication to redirect audio to another location if possible
        SWITCH_MESSAGE_TRANSMIT_TEXT      - A text message
        SWITCH_MESSAGE_INDICATE_ANSWER    - indicate answer
-       SWITCH_MESSAGE_INDICATE_PROGRESS  - indicate progress 
+       SWITCH_MESSAGE_INDICATE_PROGRESS  - indicate progress
        SWITCH_MESSAGE_INDICATE_BRIDGE    - indicate a bridge starting
        SWITCH_MESSAGE_INDICATE_UNBRIDGE  - indicate a bridge ending
        SWITCH_MESSAGE_INDICATE_TRANSFER  - indicate a transfer is taking place
@@ -1339,7 +1339,7 @@ typedef enum {
 <pre>
 CF_ANSWERED                    - Channel is answered
 CF_OUTBOUND                    - Channel is an outbound channel
-CF_EARLY_MEDIA         - Channel is ready for audio before answer 
+CF_EARLY_MEDIA         - Channel is ready for audio before answer
 CF_ORIGINATOR          - Channel is an originator
 CF_TRANSFER                    - Channel is being transfered
 CF_ACCEPT_CNG          - Channel will accept CNG frames
@@ -1679,7 +1679,7 @@ typedef uint32_t switch_codec_flag_t;
 SWITCH_SPEECH_FLAG_HASTEXT =           (1 <<  0) - Interface is has text to read.
 SWITCH_SPEECH_FLAG_PEEK =                      (1 <<  1) - Read data but do not erase it.
 SWITCH_SPEECH_FLAG_FREE_POOL =         (1 <<  2) - Free interface's pool on destruction.
-SWITCH_SPEECH_FLAG_BLOCKING =       (1 <<  3) - Indicate that a blocking call is desired 
+SWITCH_SPEECH_FLAG_BLOCKING =       (1 <<  3) - Indicate that a blocking call is desired
 SWITCH_SPEECH_FLAG_PAUSE =                     (1 <<  4) - Pause toggle for playback
 </pre>
 */
@@ -1780,8 +1780,8 @@ SMBF_STEREO - Record in stereo
 SMBF_ANSWER_REQ - Don't record until the channel is answered
 SMBF_BRIDGE_REQ - Don't record until the channel is bridged
 SMBF_THREAD_LOCK - Only let the same thread who created the bug remove it.
-SMBF_PRUNE - 
-SMBF_NO_PAUSE - 
+SMBF_PRUNE -
+SMBF_NO_PAUSE -
 SMBF_STEREO_SWAP - Record in stereo: Write Stream - left channel, Read Stream - right channel
 </pre>
 */
@@ -1925,7 +1925,7 @@ typedef uint32_t switch_io_flag_t;
     SWITCH_EVENT_BACKGROUND_JOB                - Background Job
     SWITCH_EVENT_DETECTED_SPEECH       - Detected Speech
     SWITCH_EVENT_DETECTED_TONE      - Detected Tone
-    SWITCH_EVENT_PRIVATE_COMMAND       - A private command event 
+    SWITCH_EVENT_PRIVATE_COMMAND       - A private command event
     SWITCH_EVENT_HEARTBEAT                     - Machine is alive
     SWITCH_EVENT_TRAP                          - Error Trap
     SWITCH_EVENT_ADD_SCHEDULE          - Something has been scheduled
@@ -2325,15 +2325,15 @@ typedef enum {
        SWITCH_IO_WRITE
 } switch_io_type_t;
 
-typedef switch_status_t (*switch_core_codec_control_func_t) (switch_codec_t *codec, 
-                                                                                                                                  switch_codec_control_command_t cmd, 
+typedef switch_status_t (*switch_core_codec_control_func_t) (switch_codec_t *codec,
+                                                                                                                                  switch_codec_control_command_t cmd,
                                                                                                                                   switch_codec_control_type_t ctype,
                                                                                                                                   void *cmd_data,
                                                                                                                                   switch_codec_control_type_t atype,
                                                                                                                                   void *cmd_arg,
                                                                                                                                   switch_codec_control_type_t *rtype,
                                                                                                                                   void **ret_data);
-                                                                                                                                  
+
 
 typedef switch_status_t (*switch_core_codec_init_func_t) (switch_codec_t *, switch_codec_flag_t, const switch_codec_settings_t *codec_settings);
 typedef switch_status_t (*switch_core_codec_fmtp_parse_func_t) (const char *fmtp, switch_codec_fmtp_t *codec_fmtp);
@@ -2444,7 +2444,7 @@ typedef switch_status_t (*switch_say_callback_t) (switch_core_session_t *session
 typedef switch_status_t (*switch_say_string_callback_t) (switch_core_session_t *session,
                                                                                                                 char *tosay,
                                                                                                                 switch_say_args_t *say_args, char **rstr);
-                                                                                                                
+
 struct switch_say_file_handle;
 typedef struct switch_say_file_handle switch_say_file_handle_t;
 
index f54d1d1d2b054e14096ea84df8a80acf6c61becb..057e0c58b408a87221f4684ce236e9045dec9f1a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Seven Du <dujinfang@gmail.com>
  *
@@ -42,7 +42,7 @@
 #include <switch.h>
 #include <math.h>
 
-SWITCH_BEGIN_EXTERN_C 
+SWITCH_BEGIN_EXTERN_C
 
 #define SWITCH_URL_UNSAFE "\r\n #%&+:;<=>?@[\\]^`{|}\""
 
@@ -72,18 +72,18 @@ static inline uint32_t switch_round_to_step(uint32_t num, uint32_t step)
        uint32_t x;
 
        if (!num) return 0;
-       
+
        r = (num % step);
        x = num - r;
-       
+
        if (r > step / 2) {
                x += step;
        }
-       
+
        return x;
 }
 
-/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii 
+/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii
    http://www.azillionmonkeys.com/qed/asmexample.html
 */
 static inline uint32_t switch_toupper(uint32_t eax)
@@ -94,7 +94,7 @@ ebx = (0x7f7f7f7ful & ebx) + 0x1a1a1a1aul;
  return eax - ebx;
 }
 
-/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii 
+/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii
    http://www.azillionmonkeys.com/qed/asmexample.html
 */
 static inline uint32_t switch_tolower(uint32_t eax)
@@ -108,7 +108,7 @@ static inline uint32_t switch_tolower(uint32_t eax)
 
 #ifdef FS_64BIT
 
-/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii 
+/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii
    http://www.azillionmonkeys.com/qed/asmexample.html
 */
 static inline uint64_t switch_toupper64(uint64_t eax)
@@ -119,7 +119,7 @@ uint64_t ebx = (0x7f7f7f7f7f7f7f7full & eax) + 0x0505050505050505ull;
  return eax - ebx;
 }
 
-/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii 
+/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii
    http://www.azillionmonkeys.com/qed/asmexample.html
 */
 static inline uint64_t switch_tolower64(uint64_t eax)
@@ -186,7 +186,7 @@ static inline void switch_tolower_max(char *s)
 
 }
 
-#else 
+#else
 
 static inline void switch_toupper_max(char *s)
 {
@@ -213,7 +213,7 @@ static inline void switch_toupper_max(char *s)
                c++;
                l--;
        }
-       
+
 }
 
 static inline void switch_tolower_max(char *s)
@@ -241,7 +241,7 @@ static inline void switch_tolower_max(char *s)
                c++;
                l--;
        }
-       
+
 }
 #endif
 
@@ -314,7 +314,7 @@ static inline switch_bool_t switch_is_moh(const char *s)
 #define zset(_a, _b) if (!zstr(_b)) _a = _b
 
 
-/* find a character (find) in a string (in) and return a pointer to that point in the string where the character was found 
+/* find a character (find) in a string (in) and return a pointer to that point in the string where the character was found
    using the array (allowed) as allowed non-matching characters, when (allowed) is NULL, behaviour should be identical to strchr()
  */
 static inline char *switch_strchr_strict(const char *in, char find, const char *allowed)
@@ -343,12 +343,12 @@ static inline char *switch_strchr_strict(const char *in, char find, const char *
                                        acceptable = 1;
                                        break;
                                }
-                       
+
                                a++;
                        }
 
                }
-               
+
                if (!acceptable) return NULL;
 
                p++;
@@ -410,7 +410,7 @@ static inline char *switch_print_bits(const unsigned char *byte, char *buf, swit
                k++;
                byte++;
        }
-       
+
        if (buf[j-1] == ' ') j--;
        buf[j++] = '\0';
        return buf;
@@ -491,7 +491,7 @@ SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param,
 /*!
   \brief Evaluate the truthfullness of a string expression
   \param expr a string expression
-  \return true or false 
+  \return true or false
 */
 static inline int switch_true(const char *expr)
 {
@@ -523,7 +523,7 @@ static inline switch_byte_t switch_true_byte(const char *expr)
 /*!
   \brief Evaluate the falsefullness of a string expression
   \param expr a string expression
-  \return true or false 
+  \return true or false
 */
 static inline int switch_false(const char *expr)
 {
@@ -725,7 +725,7 @@ static inline char *switch_sanitize_number(char *number)
 
        while ((q = strrchr(p, '@')))
                *q = '\0';
-       
+
        for (i = 0; i < (int) strlen(warp); i++) {
                while (p && (q = strchr(p, warp[i])))
                        p = q + 1;
@@ -1048,7 +1048,7 @@ static inline int32_t switch_calc_bitrate(int w, int h, int quality, double fps)
        /* KUSH GAUGE*/
 
        if (!fps) fps = 15;
-       
+
        r = (int32_t)((double)(w * h * fps * (quality ? quality : 1)) * 0.07) / 1000;
 
        if (!quality) r /= 2;
@@ -1065,7 +1065,7 @@ static inline int32_t switch_parse_bandwidth_string(const char *bwv)
 
        if (!strcasecmp(bwv, "auto")) {
                return -1;
-       }       
+       }
 
        if ((bw = (float) atof(bwv))) {
                if (bw < 0) return 0;
@@ -1087,7 +1087,7 @@ static inline int switch_needs_url_encode(const char *s)
        const char hex[] = "0123456789ABCDEF";
        const char *p, *e = end_of_p(s);
 
-       
+
        for(p = s; p && *p; p++) {
                if (*p == '%' && e-p > 1) {
                        if (strchr(hex, *(p+1)) && strchr(hex, *(p+2))) {
@@ -1129,7 +1129,7 @@ static inline void switch_separate_file_params(const char *file, char **file_por
 
        *file_portion = NULL;
        *params_portion = NULL;
-       
+
        while (*file == '{') {
                e = switch_find_end_paren(file, '{', '}');
                file = e + 1;
@@ -1144,7 +1144,7 @@ static inline void switch_separate_file_params(const char *file, char **file_por
        } else {
                *file_portion = (char *)space;
        }
-       
+
        return;
 }
 
index 23596aedc6299553a48fbbd42109c9cd952dd4d5..e8e2a2bf925ed34ffa2f821b8a3745e696787918 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -101,7 +101,7 @@ struct switch_xml {
        uint32_t refs;
 };
 
-/*! 
+/*!
  * \brief Parses a string into a switch_xml_t, ensuring the memory will be freed with switch_xml_free
  * \param s The string to parse
  * \param dup true if you want the string to be strdup()'d automatically
@@ -109,8 +109,8 @@ struct switch_xml {
  */
 SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str_dynamic(_In_z_ char *s, _In_ switch_bool_t dup);
 
-/*! 
- * \brief Parses a string into a switch_xml_t 
+/*!
+ * \brief Parses a string into a switch_xml_t
  * \param s The string to parse
  * \return the switch_xml_t or NULL if an error occured
  */
@@ -200,7 +200,7 @@ SWITCH_DECLARE(const char *) switch_xml_attr_soft(_In_ switch_xml_t xml, _In_z_
 
 ///\brief Traverses the switch_xml structure to retrieve a specific subtag. Takes a
 ///\ variable length list of tag names and indexes. The argument list must be
-///\ terminated by either an index of -1 or an empty string tag name. Example: 
+///\ terminated by either an index of -1 or an empty string tag name. Example:
 ///\ title = switch_xml_get(library, "shelf", 0, "book", 2, "title", -1);
 ///\ This retrieves the title of the 3rd book on the 1st shelf of library.
 ///\ Returns NULL if not found.
index eea4dfe0a9146a454acc59ab54273f3b41e8c6a4..57a2cb455b2dcc1fa09cb9a1e2ed666445ab227c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Rene <mathieu.rene@gmail.com>
  *
  *
@@ -96,7 +96,7 @@ typedef switch_status_t (*switch_xml_config_callback_t) (switch_xml_config_item_
                                                                                                                 switch_bool_t changed);
 
 /*!
- * \brief A configuration instruction read by switch_xml_config_parse 
+ * \brief A configuration instruction read by switch_xml_config_parse
 */
 struct switch_xml_config_item {
        const char *key;                        /*< The key of the element, or NULL to indicate the end of the list */
@@ -122,29 +122,29 @@ SWITCH_DECLARE(void) switch_config_perform_set_item(switch_xml_config_item_t *it
                                                                                                        const void *defaultvalue, void *data, switch_xml_config_callback_t function, const char *syntax,
                                                                                                        const char *helptext);
 
-/*! 
+/*!
  * \brief Gets the int representation of an enum
  * \param enum_options the switch_xml_config_enum_item_t array for this enum
- * \param value string value to search 
+ * \param value string value to search
  */
 SWITCH_DECLARE(switch_status_t) switch_xml_config_enum_str2int(switch_xml_config_enum_item_t *enum_options, const char *value, int *out);
 
-/*! 
+/*!
  * \brief Gets the string representation of an enum
  * \param enum_options the switch_xml_config_enum_item_t array for this enum
- * \param value int value to search 
+ * \param value int value to search
  */
 SWITCH_DECLARE(const char *) switch_xml_config_enum_int2str(switch_xml_config_enum_item_t *enum_options, int value);
 
 /*!
- * \brief Prints out an item's documentation on the console 
+ * \brief Prints out an item's documentation on the console
  * \param level loglevel to use
  * \param item item which the doc should be printed
  */
 SWITCH_DECLARE(void) switch_xml_config_item_print_doc(int level, switch_xml_config_item_t *item);
 
-/*! 
- * \brief Parses all the xml elements, following a ruleset defined by an array of switch_xml_config_item_t 
+/*!
+ * \brief Parses all the xml elements, following a ruleset defined by an array of switch_xml_config_item_t
  * \param xml The first element of the list to parse
  * \param reload true to skip all non-reloadable options
  * \param instructions instrutions on how to parse the elements
@@ -156,12 +156,12 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse(switch_xml_t xml, switch
  * \brief Parses a module's settings
  * \param reload true to skip all non-reloadable options
  * \param file the configuration file to look for
- * \param instructions the instructions 
+ * \param instructions the instructions
  */
 SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_module_settings(const char *file, switch_bool_t reload, switch_xml_config_item_t *instructions);
 
-/*! 
- * \brief Parses all of an event's elements, following a ruleset defined by an array of switch_xml_config_item_t 
+/*!
+ * \brief Parses all of an event's elements, following a ruleset defined by an array of switch_xml_config_item_t
  * \param event The event structure containing the key and values to parse
  * \param reload true to skip all non-reloadable options
  * \param instructions instrutions on how to parse the elements
@@ -171,10 +171,10 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *ev
                                                                                                                          switch_xml_config_item_t *instructions);
 
 /*!
- * \brief Parses a list of xml elements into an event  
+ * \brief Parses a list of xml elements into an event
  * \param xml First element of the xml list to parse
  * \param keyname Name of the key attribute
- * \param keyvalue Name of the value attribute 
+ * \param keyvalue Name of the value attribute
  * \param event [out] event (if *event is NOT NULL, the headers will be appended to the existing event)
  */
 SWITCH_DECLARE(switch_size_t) switch_event_import_xml(switch_xml_t xml, const char *keyname, const char *valuename, switch_event_t **event);
index a232848fe440d8b4e91ed418de082e80c5044bfe..bb24ca4c75b3da5aeb320f69af95f5deedf9d401 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
@@ -38,7 +38,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_abstraction_load);
 
 const char *global_cf = "abstraction.conf";
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_abstraction, mod_abstraction_load, mod_abstraction_shutdown, NULL);
@@ -86,12 +86,12 @@ SWITCH_STANDARD_API(api_abstraction_function)
                        }
                        switch_api_execute(destination, api_args, session, stream);
 
-                       switch_safe_free(substituted);  
+                       switch_safe_free(substituted);
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No match for API %s  (%s != %s)\n", api_name, parse, cmd);
                }
                switch_regex_safe_free(re);
-       
+
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "API %s doesn't exist inside the xml structure.  You might have forgot to reload the module after editing it\n", api_name);
        }
index 4716d829c0a72d3918386e2b1f4ab1106f5771c9..3d24279202193018732fe971c22063b3d5231015 100644 (file)
@@ -821,7 +821,7 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_
 static switch_status_t open_encoder(h264_codec_context_t *context, uint32_t width, uint32_t height)
 {
        int sane = 0;
-       
+
        if (!context->encoder) {
                if (context->av_codec_id == AV_CODEC_ID_H264) {
                        if (context->codec_settings.video.try_hardware_encoder && (context->encoder = avcodec_find_encoder_by_name("nvenc_h264"))) {
@@ -889,7 +889,7 @@ static switch_status_t open_encoder(h264_codec_context_t *context, uint32_t widt
        }
 
        context->bandwidth *= 3;
-       
+
        //context->encoder_ctx->bit_rate = context->bandwidth * 1024;
        context->encoder_ctx->width = context->codec_settings.video.width;
        context->encoder_ctx->height = context->codec_settings.video.height;
@@ -1286,7 +1286,7 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t
                        if (got_picture && decoded_len > 0) {
                                int width = picture->width;
                                int height = picture->height;
-                               
+
                                if (!context->img || (context->img->d_w != width || context->img->d_h != height)) {
                                        switch_img_free(&context->img);
                                        context->img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, height, 1);
index 8e2f72041dd89394f4c4ee0a0c9ca7a9dc0be107..4d87a5073882d4c513684ff023de53c25b15593a 100644 (file)
@@ -303,7 +303,7 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec
        }
        mst->st->id = fc->nb_streams - 1;
        c = mst->st->codec;
-       
+
        //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "id:%d den:%d num:%d\n", mst->st->id, mst->st->time_base.den, mst->st->time_base.num);
 
        if (threads > 4) {
@@ -340,7 +340,7 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec
                        } else {
                                mm->fps = fps;
                        }
-                       
+
                        if (mm->vw && mm->vh) {
                                mst->width = mm->vw;
                                mst->height = mm->vh;
@@ -392,7 +392,7 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec
                                c->level = 52;
                                break;
                        }
-                       
+
                        switch (mm->vencspd) {
                        case SWITCH_VIDEO_ENCODE_SPEED_SLOW:
                                av_opt_set(c->priv_data, "preset", "veryslow", 0);
@@ -657,7 +657,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
                                goto top;
                        }
                } else {
-               
+
                        size = switch_queue_size(eh->video_queue);
 
                        if (size > 5 && !eh->finalize) {
@@ -672,12 +672,12 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
                                }
                        }
                }
-               
+
                //switch_mutex_lock(eh->mutex);
 
                eh->in_callback = 1;
-               
-               av_init_packet(&pkt);           
+
+               av_init_packet(&pkt);
 
                if (eh->video_st->frame) {
                        ret = av_frame_make_writable(eh->video_st->frame);
@@ -688,7 +688,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
                }
 
                fill_avframe(eh->video_st->frame, img);
-               
+
                if (eh->finalize) {
                        if (delta_i && !delta_avg) {
                                delta_avg = (int)(double)(delta_sum / delta_i);
@@ -714,13 +714,13 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
                        if (delta_tmp != last_ts) {
                                delta_sum += delta_tmp;
                                delta_i++;
-                               
+
                                if (delta_i >= 60) {
                                        delta_avg = (int)(double)(delta_sum / delta_i);
                                        delta_i = 0;
                                        delta_sum = delta_avg;
                                }
-                               
+
                                eh->video_st->frame->pts = eh->timer->samplecount;
                        }
                }
@@ -977,12 +977,12 @@ SWITCH_STANDARD_APP(record_av_function)
                int offset = DFT_RECORD_OFFSET;
                int fps = codec.implementation->actual_samples_per_second / samples;
                int lead_frames = (offset * fps) / 1000;
-               
+
                for (int x = 0; x < lead_frames; x++) {
                        switch_buffer_write(buffer, buf, datalen);
-               }               
+               }
        }
-               
+
        while (switch_channel_ready(channel)) {
 
                status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_SINGLE_READ, 0);
@@ -1585,16 +1585,16 @@ again:
                                                *pts = vframe->pkt_pts;
                                                avframe2img(vframe, img);
                                                img->user_priv = pts;
-                                               
+
 #ifdef ALT_WAY
                                                diff = sleep - (switch_time_now() - context->last_vid_push);
-                                               
+
                                                if (diff > 0 && diff <= sleep) {
                                                        switch_core_timer_next(&context->video_timer);
                                                } else {
                                                        switch_core_timer_sync(&context->video_timer);
                                                }
-#endif                 
+#endif
 
                                                context->vid_ready = 1;
                                                switch_queue_push(context->eh.video_queue, img);
@@ -1686,7 +1686,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
        switch_status_t status = SWITCH_STATUS_SUCCESS;
 
        switch_set_string(file, path);
-       
+
        if ((ext = strrchr((char *)path, '.')) == 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n");
                return SWITCH_STATUS_GENERR;
@@ -1923,7 +1923,7 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s
 
                switch_buffer_write(context->audio_buffer, data, datalen);
        }
-       
+
        bytes = context->audio_st.frame->nb_samples * 2 * context->audio_st.st->codec->channels;
 
 
@@ -1937,15 +1937,15 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s
                        switch_buffer_write(context->audio_buffer, buf, bytes - inuse);
                }
        }
-       
-       
+
+
        while ((inuse = switch_buffer_inuse(context->audio_buffer)) >= bytes) {
                AVPacket pkt = { 0 };
                int got_packet = 0;
                int ret;
 
                av_init_packet(&pkt);
-               
+
                if (context->audio_st.resample_ctx) { // need resample
                        int out_samples = avresample_get_out_samples(context->audio_st.resample_ctx, context->audio_st.frame->nb_samples);
                        av_frame_make_writable(context->audio_st.frame);
@@ -1955,7 +1955,7 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s
                        ret = avresample_convert(context->audio_st.resample_ctx,
                                                                         context->audio_st.tmp_frame->data, 0, out_samples,
                                                                         (uint8_t **)context->audio_st.frame->data, 0, context->audio_st.frame->nb_samples);
-                       
+
                        if (ret < 0) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error while converting %d samples, error text: %s\n",
                                        context->audio_st.frame->nb_samples, get_error_text(ret));
@@ -1964,7 +1964,7 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s
 
                        context->audio_st.tmp_frame->pts = context->audio_st.next_pts;
                        context->audio_st.next_pts += context->audio_st.frame->nb_samples;
-                       ret = avcodec_encode_audio2(context->audio_st.st->codec, &pkt, context->audio_st.tmp_frame, &got_packet);               
+                       ret = avcodec_encode_audio2(context->audio_st.st->codec, &pkt, context->audio_st.tmp_frame, &got_packet);
                } else {
                        av_frame_make_writable(context->audio_st.frame);
                        switch_buffer_read(context->audio_buffer, context->audio_st.frame->data[0], bytes);
@@ -2010,9 +2010,9 @@ static switch_status_t av_file_command(switch_file_handle_t *handle, switch_file
 
        switch(command) {
        case SCFC_FLUSH_AUDIO:
-               switch_mutex_lock(context->mutex);              
+               switch_mutex_lock(context->mutex);
                switch_buffer_zero(context->audio_buffer);
-               switch_mutex_unlock(context->mutex);            
+               switch_mutex_unlock(context->mutex);
                break;
        case SCFC_PAUSE_READ:
                if (context->read_paused) {
@@ -2131,7 +2131,7 @@ static switch_status_t av_file_read(switch_file_handle_t *handle, void *data, si
 
        if (size == 0) {
                size_t blank = (handle->samplerate / 20) * 2 * handle->real_channels;
-               
+
                if (need > blank) {
                        need = blank;
                }
@@ -2165,7 +2165,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
        if ((flags & SVR_FLUSH)) {
                flush_video_queue(context->eh.video_queue, 1);
        }
-       
+
        if ((flags & SVR_BLOCK)) {
                status = switch_queue_pop(context->eh.video_queue, &pop);
        } else {
@@ -2185,7 +2185,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
 
        return (flags & SVR_FLUSH) ? SWITCH_STATUS_BREAK : status;
 }
-#else 
+#else
 
 static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags)
 {
@@ -2343,7 +2343,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
                        //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "picture is too late, off: %" SWITCH_INT64_T_FMT " max delta: %" SWITCH_INT64_T_FMT " queue size:%u fps:%u/%0.2f\n", (int64_t)(now - mst->next_pts), max_delta, switch_queue_size(context->eh.video_queue), context->read_fps, handle->mm.fps);
                        switch_img_free(&img);
                        //max_delta = AV_TIME_BASE;
-               
+
                        if (switch_queue_size(context->eh.video_queue) > 0) {
                                // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WTF again\n");
                                goto again;
@@ -2351,7 +2351,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
                                mst->next_pts = 0;
                                context->video_start_time = 0;
                                return SWITCH_STATUS_BREAK;
-                       } 
+                       }
                }
 
                if ((flags & SVR_BLOCK) || do_fl) {
@@ -2369,7 +2369,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
                                return SWITCH_STATUS_BREAK;
                        }
                }
-               
+
        } else {
                return SWITCH_STATUS_BREAK;
        }
index 41ee16adf51ac2e181808f45a9525dc913bdf493..a6dab2be287f352c04a9e1e651f1e8cc83fb0c9b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Contributor(s):
  *
  * Piotr Gregor     <piotrgregor@rsyncme.org>
index 9c6d4ba37bbccfd043e5e3b7d4e1696f1b747803..b0d8655d6e4bc241f5bfdcfcc7eec98947085697 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Contributor(s):
  *
  * Eric des Courtis <eric.des.courtis@benbria.com>
@@ -43,7 +43,7 @@ typedef union {
     float f;
 } float_conv_t;
 
-/* 
+/*
  * Manipulate these parameters to change
  * mapping's resolution. The sine tone
  * of 1600Hz is detected even with 20
@@ -241,7 +241,7 @@ dump_table_summary(void)
     i_1 = index_from_float(1.0);
     di = (i_1 - i_0)/100;
     if (di == 0)  di = 1;
+
     for (; i < ACOS_TABLE_LENGTH; i += di )
     {
         f = float_from_index(i);
index 3c58ffbe51ab45a990132dea7d16f18d3a8dc4ef..5f05c00b220a09e5909f9fcd60c2faf5e631d5b9 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Contributor(s):
  *
  * Eric des Courtis <eric.des.courtis@benbria.com>
index 04be96589f939f11c904c07fcdaebef05ec71bd2..17da3183a9a7538b2e70628260c6b2778f4edce7 100644 (file)
@@ -82,7 +82,7 @@
 #define AVMD_MIN_FREQUENCY (440.0)
 /*! Minimum frequency as digital normalized frequency */
 #define AVMD_MIN_FREQUENCY_R(r) ((2.0 * M_PI * AVMD_MIN_FREQUENCY) / (r))
-/*! 
+/*!
  * Maximum beep frequency in Hertz
  * Note: The maximum frequency the DESA-2 algorithm can uniquely
  * identify is 0.25 of the sampling rate. All the frequencies
@@ -733,7 +733,7 @@ static void avmd_fire_event(enum avmd_event type, switch_core_session_t *fs_s, d
                 switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-offset", "ERROR (TRUNCATED)");
             }
             switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-offset", buf);
-            
+
             res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%u", idx);
             if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) {
                 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res);
@@ -1137,7 +1137,7 @@ static switch_status_t avmd_parse_cmd_data_one_entry(char *candidate, struct avm
     }
 
     /* this may be option parameter if valid */
-    key = candidate_parsed[0];      /* option name */      
+    key = candidate_parsed[0];      /* option name */
     if (zstr(key)) { /* empty key */
         return SWITCH_STATUS_NOT_INITALIZED;
     }
@@ -1399,7 +1399,7 @@ SWITCH_STANDARD_APP(avmd_start_app) {
         switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to add media bug!\n");
         goto end_unlock;
     }
-    
+
     switch_mutex_lock(avmd_globals.mutex);
     ++avmd_globals.session_n;
     switch_mutex_unlock(avmd_globals.mutex);
index 70badc13545c31099f570191c6283fb8784c0b8f..39756b06e9372a72457f37c48635408d0c87cc2a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -230,7 +230,7 @@ SWITCH_STANDARD_APP(bert_test_function)
 
                /* Proceed to read and process the received frame ...
                 * Note that switch_core_session_read_frame is a blocking operation, we could do reathing in another thread like the playback() app
-                * does using switch_core_service_session() but OTOH that would lead to more load/cpu usage, extra threads being launched per call leg 
+                * does using switch_core_service_session() but OTOH that would lead to more load/cpu usage, extra threads being launched per call leg
                 * and most likely reduce the overall capacity of the test system */
                status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
                if (!SWITCH_READ_ACCEPTABLE(status)) {
@@ -381,23 +381,23 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_bert_load)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", BERT_EVENT_TIMEOUT);
                return SWITCH_STATUS_TERM;
        }
-       
+
 
        if (switch_event_reserve_subclass(BERT_EVENT_LOST_SYNC) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", BERT_EVENT_LOST_SYNC);
                return SWITCH_STATUS_TERM;
        }
-       
-       
+
+
        if (switch_event_reserve_subclass(BERT_EVENT_IN_SYNC) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", BERT_EVENT_IN_SYNC);
                return SWITCH_STATUS_TERM;
        }
-       
-       
+
+
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-       SWITCH_ADD_APP(app_interface, "bert_test", "Start BERT Test", "Start BERT Test", bert_test_function, "", SAF_NONE); 
+       SWITCH_ADD_APP(app_interface, "bert_test", "Start BERT Test", "Start BERT Test", bert_test_function, "", SAF_NONE);
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -406,7 +406,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_bert_shutdown)
        switch_event_free_subclass(BERT_EVENT_TIMEOUT);
        switch_event_free_subclass(BERT_EVENT_LOST_SYNC);
        switch_event_free_subclass(BERT_EVENT_IN_SYNC);
-       
+
        return SWITCH_STATUS_UNLOAD;
 }
 
index 4a8c022c4736b5a593d648b13e48bcae1b6b1728..ce5d5a5c03977826cf4ee3923c2159a7c9aa8bfe 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Rene <mrene@avgs.ca>
  * Raymond Chandler <intralanman@freeswitch.org>
  *
@@ -53,19 +53,19 @@ static struct {
        switch_memory_pool_t *pool;
 } globals;
 
-blacklist_t *blacklist_create(const char *name) 
+blacklist_t *blacklist_create(const char *name)
 {
        switch_memory_pool_t *pool = NULL;
        blacklist_t *bl = NULL;
-       
+
        switch_core_new_memory_pool(&pool);
        bl = switch_core_alloc(pool, sizeof(*bl));
        switch_assert(bl);
        bl->pool = pool;
-       
+
        switch_core_hash_init(&bl->list);
        switch_mutex_init(&bl->list_mutex, SWITCH_MUTEX_NESTED, pool);
-       
+
        return bl;
 }
 
@@ -117,14 +117,14 @@ static switch_status_t do_config(switch_bool_t reload)
        /* Load up blacklists */
        switch_xml_t xml, cfg, lists, list;
        switch_hash_index_t *hi = NULL;
-       
+
        if (!(xml = switch_xml_open_cfg("mod_blacklist.conf", &cfg, NULL))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load configuration section\n");
                return SWITCH_STATUS_FALSE;
        }
-       
+
        switch_mutex_lock(globals.lists_mutex);
-       
+
        /* Destroy any active lists */
        while ((hi = switch_core_hash_first_iter( globals.lists, hi))) {
                const void *key;
@@ -133,7 +133,7 @@ static switch_status_t do_config(switch_bool_t reload)
                blacklist_free((blacklist_t*)val);
                switch_core_hash_delete(globals.lists, (const char*)key);
        }
-       
+
        if ((lists = switch_xml_child(cfg, "lists"))) {
                for (list = switch_xml_child(lists, "list"); list; list = list->next) {
                        const char *name = switch_xml_attr_soft(list, "name");
@@ -151,9 +151,9 @@ static switch_status_t do_config(switch_bool_t reload)
                        load_list(name, filename);
                }
        }
-       
+
        switch_mutex_unlock(globals.lists_mutex);
-       
+
        if (xml) {
                switch_xml_free(xml);
                xml = NULL;
@@ -175,33 +175,33 @@ SWITCH_STANDARD_API(blacklist_api_function)
        char *data;
        int argc;
        char *argv[3];
-       
+
        data = strdup(cmd);
        trim(data);
        if (!(argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid usage\n");
                goto done;
        }
-       
+
        if (!strcasecmp(argv[0], "check")) {
                blacklist_t *bl = NULL;
                switch_bool_t result;
-               
+
                if (argc < 2 || zstr(argv[1]) || zstr(argv[2])) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Wrong syntax");
                        goto done;
                }
-               
+
                switch_mutex_lock(globals.lists_mutex);
                bl = switch_core_hash_find(globals.lists, argv[1]);
                switch_mutex_unlock(globals.lists_mutex);
-               
+
                if (!bl) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown blacklist [%s]\n", argv[1]);
                        stream->write_function(stream, "false");
                        goto done;
                }
-               
+
                switch_mutex_lock(bl->list_mutex);
                result = (switch_bool_t)(intptr_t)switch_core_hash_find(bl->list, argv[2]);
                stream->write_function(stream, "%s", result ? "true" : "false");
@@ -212,17 +212,17 @@ SWITCH_STANDARD_API(blacklist_api_function)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Wrong syntax");
                        goto done;
                }
-               
+
                switch_mutex_lock(globals.lists_mutex);
                bl = switch_core_hash_find(globals.lists, argv[1]);
                switch_mutex_unlock(globals.lists_mutex);
-               
+
                if (!bl) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown blacklist [%s]\n", argv[1]);
                        stream->write_function(stream, "-ERR Unknown blacklist\n");
                        goto done;
                }
-               
+
                switch_mutex_lock(bl->list_mutex);
                switch_core_hash_insert(bl->list, argv[2], (void*)SWITCH_TRUE);
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added [%s] to list [%s]\n", argv[2], argv[1]);
@@ -234,17 +234,17 @@ SWITCH_STANDARD_API(blacklist_api_function)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Wrong syntax");
                        goto done;
                }
-               
+
                switch_mutex_lock(globals.lists_mutex);
                bl = switch_core_hash_find(globals.lists, argv[1]);
                switch_mutex_unlock(globals.lists_mutex);
-               
+
                if (!bl) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown blacklist [%s]\n", argv[1]);
                        stream->write_function(stream, "-ERR Unknown blacklist\n");
                        goto done;
                }
-               
+
                switch_mutex_lock(bl->list_mutex);
                switch_core_hash_delete(bl->list, argv[2]);
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Removed [%s] from list [%s]\n", argv[2], argv[1]);
@@ -278,7 +278,7 @@ SWITCH_STANDARD_API(blacklist_api_function)
                }
 
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Saving %s to %s\n", argv[1], filename);
-               
+
                switch_mutex_lock(globals.lists_mutex);
                if (switch_file_open(&fd, filename, SWITCH_FOPEN_WRITE | SWITCH_FOPEN_TRUNCATE | SWITCH_FOPEN_CREATE, SWITCH_FPROT_OS_DEFAULT, globals.pool)
                        == SWITCH_STATUS_SUCCESS) {
@@ -287,7 +287,7 @@ SWITCH_STANDARD_API(blacklist_api_function)
                                switch_file_printf(fd, "%s\n", (char *)var);
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "adding %s to the dump file\n", (char *)var);
                        }
-                       stream->write_function(stream, "+OK\n");                        
+                       stream->write_function(stream, "+OK\n");
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "couldn't open %s for writing\n", filename);
                }
@@ -300,7 +300,7 @@ SWITCH_STANDARD_API(blacklist_api_function)
        } else if (!zstr(argv[0])) {
                stream->write_function(stream, "-ERR: No such command: %s (see 'blacklist help')\n", argv[0]);
        }
-       
+
 done:
        switch_safe_free(data);
        return SWITCH_STATUS_SUCCESS;
@@ -313,7 +313,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_blacklist_load)
        //switch_application_interface_t *app_interface;
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       
+
        memset(&globals, 0, sizeof(globals));
        globals.pool = pool;
 
index 4db9ce55e6692f28817cf806828b99f802653cb0..326a33fe9b4ab57bae98e2338d48f736323317f9 100644 (file)
@@ -36,4 +36,4 @@
     <!-- <tier agent="1000@default" queue="support@default" level="1" position="1"/> -->
   </tiers>
 
-</configuration> 
+</configuration>
index 40cb7b94103b53436eb7b47bac46fcb615a2e413..80dad9f9454763c47995a91c9de72cc2216129bd 100644 (file)
 
     <!-- comment out sql to not setup a database (directory) lookup -->
     <param name="sql" value="
-     SELECT name||' ('||type||')' AS name 
+     SELECT name||' ('||type||')' AS name
       FROM phonebook p JOIN numbers n ON p.id = n.phonebook_id
-      WHERE n.number='${caller_id_number}' 
+      WHERE n.number='${caller_id_number}'
       LIMIT 1
       "/>
-    <!-- comment out citystate-sql to not setup a database (city/state) 
+    <!-- comment out citystate-sql to not setup a database (city/state)
          lookup -->
     <param name="citystate-sql" value="
      SELECT ratecenter||' '||state as name
index e0df48b792157c45dfc3779c0e90c355355cf1a1..5b90e8a095a34f7e5849d5e1b28b3e370e8eb83c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Rupa Schomaker <rupa@rupa.com>
  *
  * mod_cidlookup.c -- API for querying cid->name services and local data
@@ -39,7 +39,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cidlookup_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_cidlookup_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_cidlookup_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_cidlookup, mod_cidlookup_load, mod_cidlookup_shutdown, NULL);
@@ -90,7 +90,7 @@ static switch_cache_db_handle_t *cidlookup_get_db_handle(void)
 {
        switch_cache_db_handle_t *dbh = NULL;
        char *dsn;
-       
+
        if (!zstr(globals.odbc_dsn)) {
                dsn = globals.odbc_dsn;
        } else {
@@ -100,7 +100,7 @@ static switch_cache_db_handle_t *cidlookup_get_db_handle(void)
        if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) {
                dbh = NULL;
        }
-       
+
        return dbh;
 }
 
@@ -383,7 +383,7 @@ static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, cha
        switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
        switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
        /*
-          TIMEOUT_MS is introduced in 7.16.2, we have 7.16.0 in tree 
+          TIMEOUT_MS is introduced in 7.16.2, we have 7.16.0 in tree
         */
 #ifdef CURLOPT_TIMEOUT_MS
        if (timeout > 0) {
@@ -452,12 +452,12 @@ static cid_data_t *do_whitepages_lookup(switch_memory_pool_t *pool, switch_event
 
        query = switch_event_expand_headers(event, "http://api.whitepages.com/reverse_phone/1.0/?phone=${whitepages-cid};api_key=${whitepages-api-key}");
        do_lookup_url(pool, event, &xml_s, query, NULL, NULL, 0);
-       
+
        if (zstr(xml_s)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No XML returned for number %s\n", num);
                goto done;
        }
-       
+
        xml = switch_xml_parse_str_dup(xml_s);
 
        if (!xml) {
@@ -706,7 +706,7 @@ SWITCH_STANDARD_APP(cidlookup_app_function)
                if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
                        const char *uuid = switch_channel_get_partner_uuid(channel);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV");
-                       
+
                        if (uuid) {
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
                        }
index 36395d242714a836c29dd78ca4b2d3f38f8a96d5..31c62ff9563e50ef82a2a4acf7c7c1711b4d24a7 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  *
@@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cluechoo_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_cluechoo_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_cluechoo_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_cluechoo, mod_cluechoo_load, mod_cluechoo_shutdown, NULL);
@@ -102,7 +102,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cluechoo_shutdown)
 
 /*========================================
  *    sl.c:
- *     Copyright 1993,1998 Toyoda Masashi 
+ *     Copyright 1993,1998 Toyoda Masashi
  *             (toyoda@is.titech.ac.jp)
  *     Last Modified: 1998/ 7/22
  *========================================
index 6bf90212c18e0d521da65078fd56759ebbe4f544..5a919cfa45af57873ee19617680e54f8672bff98 100644 (file)
@@ -1,6 +1,6 @@
 /*========================================
  *    sl.h: Text data of SL version 3.01
- *     Copyright 1993 Toyoda Masashi 
+ *     Copyright 1993 Toyoda Masashi
  *             (toyoda@is.titech.ac.jp)
  *     Last Modified: 1992/12/23
  *========================================
index ae8bc8465bef7a3684729f644a96f05712fcc00c..29febefc531c65100dc2c98e405bf4e99c13f6ae 100644 (file)
@@ -445,7 +445,7 @@ SWITCH_STANDARD_API(list_users_function)
                        }
                }
        }
-       
+
        if (_domain) {
                tag_name = "domain";
                key_name = "name";
@@ -3147,7 +3147,7 @@ SWITCH_STANDARD_API(uuid_drop_dtmf)
        if (argv[0]) {
                uuid = argv[0];
        }
-       
+
        if (argv[1]) {
                action = argv[1];
        }
@@ -3191,15 +3191,15 @@ SWITCH_STANDARD_API(uuid_drop_dtmf)
                                        switch_channel_set_variable(channel, "drop_dtmf", "false");
                                }
                        }
-                       
+
                        is_on = switch_channel_test_flag(channel, CF_DROP_DTMF);
                        file = switch_channel_get_variable_dup(channel, "drop_dtmf_masking_file", SWITCH_FALSE, -1);
                        digits = switch_channel_get_variable_dup(channel, "drop_dtmf_masking_digits", SWITCH_FALSE, -1);
 
-                       stream->write_function(stream, "+OK %s is %s DTMF. mask_file: %s mask_digits: %s\n", uuid, is_on ? "dropping" : "not dropping", 
+                       stream->write_function(stream, "+OK %s is %s DTMF. mask_file: %s mask_digits: %s\n", uuid, is_on ? "dropping" : "not dropping",
                                                                   file ? file : "NONE",
                                                                   digits ? digits : "NONE");
-                                                                  
+
                        switch_core_session_rwunlock(tsession);
                } else {
                        stream->write_function(stream, "-ERR No such channel %s!\n", uuid);
@@ -3308,7 +3308,7 @@ SWITCH_STANDARD_API(uuid_set_media_stats)
 static void jsonify_stats(cJSON *json, const char *name, switch_rtp_stats_t *stats)
 {
        cJSON *jstats = cJSON_CreateObject();
-       cJSON_AddItemToObject(json, name, jstats);      
+       cJSON_AddItemToObject(json, name, jstats);
 
        stats->inbound.std_deviation = sqrt(stats->inbound.variance);
 
@@ -3345,7 +3345,7 @@ static void jsonify_stats(cJSON *json, const char *name, switch_rtp_stats_t *sta
 
        add_stat(stats->rtcp.packet_count, "rtcp_packet_count");
        add_stat(stats->rtcp.octet_count, "rtcp_octet_count");
-       
+
 }
 
 static switch_bool_t true_enough(cJSON *json)
@@ -3367,37 +3367,37 @@ SWITCH_STANDARD_JSON_API(json_stats_function)
        switch_core_session_t *tsession;
 
        reply = cJSON_CreateObject();
-       *json_reply = reply;    
+       *json_reply = reply;
 
        if (zstr(uuid)) {
                cJSON_AddItemToObject(reply, "response", cJSON_CreateString("INVALID INPUT"));
                goto end;
        }
 
-       
+
        if ((tsession = switch_core_session_locate(uuid))) {
                cJSON *jevent;
                switch_rtp_stats_t *audio_stats = NULL, *video_stats = NULL;
 
                switch_core_media_set_stats(tsession);
-               
+
                audio_stats = switch_core_media_get_stats(tsession, SWITCH_MEDIA_TYPE_AUDIO, switch_core_session_get_pool(tsession));
                video_stats = switch_core_media_get_stats(tsession, SWITCH_MEDIA_TYPE_VIDEO, switch_core_session_get_pool(tsession));
-               
+
                if (audio_stats) {
                        jsonify_stats(reply, "audio", audio_stats);
                }
-               
+
                if (video_stats) {
                        jsonify_stats(reply, "video", video_stats);
                }
-               
+
                if (true_enough(cdata) && switch_ivr_generate_json_cdr(tsession, &jevent, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
                        cJSON_AddItemToObject(reply, "channelData", jevent);
                }
 
                switch_core_session_rwunlock(tsession);
-               
+
                status = SWITCH_STATUS_SUCCESS;
        } else {
                cJSON_AddItemToObject(reply, "response", cJSON_CreateString("Session does not exist"));
@@ -4225,7 +4225,7 @@ SWITCH_STANDARD_API(uuid_video_bitrate_function)
                        msg.message_id = SWITCH_MESSAGE_INDICATE_BITRATE_REQ;
                        msg.numeric_arg = kps * 1024;
                        msg.from = __FILE__;
-                       
+
                        switch_core_session_receive_message(lsession, &msg);
                        switch_core_session_video_reinit(lsession);
                        switch_channel_video_sync(switch_core_session_get_channel(lsession));
@@ -4276,7 +4276,7 @@ SWITCH_STANDARD_API(uuid_codec_debug_function)
                        msg.numeric_arg = level;
                        msg.numeric_reply = type;
                        msg.from = __FILE__;
-                       
+
                        switch_core_session_receive_message(lsession, &msg);
                        status = SWITCH_STATUS_SUCCESS;
                        switch_core_session_rwunlock(lsession);
@@ -4321,7 +4321,7 @@ SWITCH_STANDARD_API(uuid_codec_param_function)
                        msg.string_array_arg[2] = argv[3];
                        msg.string_array_arg[3] = argv[4];
                        msg.from = __FILE__;
-                       
+
                        switch_core_session_receive_message(lsession, &msg);
                        status = SWITCH_STATUS_SUCCESS;
                        switch_core_session_rwunlock(lsession);
@@ -5918,7 +5918,7 @@ SWITCH_STANDARD_API(uuid_getvar_function)
                                                char *ptr = NULL;
                                                int idx = -1;
                                                char *vname = strdup(var_name);
-                                               
+
                                                if ((ptr = strchr(vname, '[')) && strchr(ptr, ']')) {
                                                        *ptr++ = '\0';
                                                        idx = atoi(ptr);
@@ -5927,11 +5927,11 @@ SWITCH_STANDARD_API(uuid_getvar_function)
 
                                                free(vname);
                                        }
-                                       
+
                                        if (!var_value) {
                                                var_value = switch_channel_get_variable(channel, var_name);
                                        }
-                                               
+
                                        if (var_value != NULL) {
                                                stream->write_function(stream, "%s", var_value);
                                        } else {
@@ -6389,7 +6389,7 @@ SWITCH_STANDARD_API(quote_shell_arg_function)
 }
 
 #define GETCPUTIME_SYNTAX "[reset]"
-SWITCH_STANDARD_API(getcputime_function) 
+SWITCH_STANDARD_API(getcputime_function)
 {
        static int64_t reset_ums = 0, reset_kms = 0; // Last reset times in ms
        switch_cputime t = { 0 };
@@ -6885,14 +6885,14 @@ SWITCH_STANDARD_JSON_API(json_channel_data_function)
 
 
        reply = cJSON_CreateObject();
-       *json_reply = reply;    
+       *json_reply = reply;
 
        if (zstr(uuid)) {
                cJSON_AddItemToObject(reply, "response", cJSON_CreateString("INVALID INPUT"));
                goto end;
        }
 
-       
+
        if ((tsession = switch_core_session_locate(uuid))) {
                cJSON *jevent;
 
@@ -6901,7 +6901,7 @@ SWITCH_STANDARD_JSON_API(json_channel_data_function)
                }
 
                switch_core_session_rwunlock(tsession);
-               
+
                status = SWITCH_STATUS_SUCCESS;
        } else {
                cJSON_AddItemToObject(reply, "response", cJSON_CreateString("Session does not exist"));
@@ -6921,7 +6921,7 @@ SWITCH_STANDARD_JSON_API(json_execute_function)
        switch_core_session_t *tsession;
 
        reply = cJSON_CreateObject();
-       *json_reply = reply;    
+       *json_reply = reply;
 
        if (!data) {
                cJSON_AddItemToObject(reply, "response", cJSON_CreateString("INVALID INPUT"));
@@ -6938,7 +6938,7 @@ SWITCH_STANDARD_JSON_API(json_execute_function)
                cJSON_AddItemToObject(reply, "response", cJSON_CreateString("INVALID INPUT"));
                goto end;
        }
-       
+
        if ((tsession = switch_core_session_locate(uuid))) {
                if (switch_true(edata)) {
                        cJSON *jevent = NULL;
@@ -6974,7 +6974,7 @@ SWITCH_STANDARD_API(event_channel_broadcast_api_function)
 {
        cJSON *jdata = NULL;
        const char *channel;
-       
+
        if (!cmd) {
                stream->write_function(stream, "-ERR parsing channel\n", SWITCH_VA_NONE);
                return SWITCH_STATUS_SUCCESS;
@@ -6999,7 +6999,7 @@ SWITCH_STANDARD_API(event_channel_broadcast_api_function)
        }
 
        return SWITCH_STATUS_SUCCESS;
-       
+
 }
 
 SWITCH_STANDARD_JSON_API(json_api_function)
@@ -7024,7 +7024,7 @@ SWITCH_STANDARD_JSON_API(json_api_function)
        reply = cJSON_CreateObject();
 
        SWITCH_STANDARD_STREAM(stream);
-       
+
        if (cmd && (status = switch_api_execute(cmd->valuestring, arg ? arg->valuestring : NULL, session, &stream)) == SWITCH_STATUS_SUCCESS) {
                cJSON_AddItemToObject(reply, "message", cJSON_CreateString((char *) stream.data));
        } else {
@@ -7067,10 +7067,10 @@ SWITCH_STANDARD_JSON_API(json_status_function)
        cJSON_AddItemToObject(o, "seconds", cJSON_CreateNumber(duration.sec));
        cJSON_AddItemToObject(o, "milliseconds", cJSON_CreateNumber(duration.ms));
        cJSON_AddItemToObject(o, "microseconds", cJSON_CreateNumber(duration.mms));
-       
+
        cJSON_AddItemToObject(reply, "uptime", o);
        cJSON_AddItemToObject(reply, "version", cJSON_CreateString(switch_version_full_human()));
-       
+
        o = cJSON_CreateObject();
        cJSON_AddItemToObject(reply, "sessions", o);
 
@@ -7091,7 +7091,7 @@ SWITCH_STANDARD_JSON_API(json_status_function)
        cJSON_AddItemToObject(oo, "max", cJSON_CreateNumber(sps));
        cJSON_AddItemToObject(oo, "peak", cJSON_CreateNumber(max_sps));
        cJSON_AddItemToObject(oo, "peak5Min", cJSON_CreateNumber(max_sps_fivemin));
-       
+
 
        o = cJSON_CreateObject();
        cJSON_AddItemToObject(reply, "idleCPU", o);
@@ -7099,7 +7099,7 @@ SWITCH_STANDARD_JSON_API(json_status_function)
        cJSON_AddItemToObject(o, "used", cJSON_CreateNumber(switch_core_min_idle_cpu(-1.0)));
        cJSON_AddItemToObject(o, "allowed", cJSON_CreateNumber(switch_core_idle_cpu()));
 
-       
+
        if (switch_core_get_stacksizes(&cur, &max) == SWITCH_STATUS_SUCCESS) {
                o = cJSON_CreateObject();
                cJSON_AddItemToObject(reply, "stackSizeKB", o);
@@ -7107,10 +7107,10 @@ SWITCH_STANDARD_JSON_API(json_status_function)
                cJSON_AddItemToObject(o, "current", cJSON_CreateNumber((double)(cur / 1024)));
                cJSON_AddItemToObject(o, "max", cJSON_CreateNumber((double)(max / 1024)));
        }
-       
+
 
        *json_reply = reply;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -7119,7 +7119,7 @@ SWITCH_STANDARD_API(json_function)
        cJSON *jcmd = NULL, *format = NULL;
        const char *message = "";
        char *response = NULL;
-   
+
        if (zstr(cmd)) {
                message = "No JSON supplied.";
                goto err;
@@ -7142,13 +7142,13 @@ SWITCH_STANDARD_API(json_function)
        } else {
                response = cJSON_PrintUnformatted(jcmd);
        }
-       
+
        stream->write_function(stream, "%s\n", switch_str_nil(response));
-       
+
        switch_safe_free(response);
 
        cJSON_Delete(jcmd);
-       
+
        return SWITCH_STATUS_SUCCESS;
 
  err:
index fad7820edde90fbd4af272e0150e472d526d4a53..7b9349fd0976ee88033f1d66cd033283572b39fc 100644 (file)
@@ -1,4 +1,4 @@
-<!-- http://wiki.freeswitch.org/wiki/Mod_conference --> 
+<!-- http://wiki.freeswitch.org/wiki/Mod_conference -->
 <!-- None of these paths are real if you want any of these options you need to really set them up -->
 <configuration name="conference.conf" description="Audio Conference">
   <!-- Advertise certain presence on startup . -->
@@ -6,8 +6,8 @@
     <room name="3001@$${domain}" status="FreeSWITCH"/>
   </advertise>
 
-  <!-- These are the default keys that map when you do not specify a caller control group -->  
-  <!-- Note: none and default are reserved names for group names.  Disabled if dist-dtmf member flag is set. -->       
+  <!-- These are the default keys that map when you do not specify a caller control group -->
+  <!-- Note: none and default are reserved names for group names.  Disabled if dist-dtmf member flag is set. -->
   <caller-controls>
     <group name="default">
       <control action="mute" digits="0"/>
   <profiles>
     <!--If no profile is specified it will default to "default"-->
     <profile name="default">
-      <!-- Directory to drop CDR's 
+      <!-- Directory to drop CDR's
           'auto' means $PREFIX/logs/conference_cdr/<confernece_uuid>.cdr.xml
           a non-absolute path means $PREFIX/logs/<value>/<confernece_uuid>.cdr.xml
           absolute path means <value>/<confernece_uuid>.cdr.xml
       -->
       <!-- <param name="cdr-log-dir" value="auto"/> -->
-      <!-- How to create a CDR event 
+      <!-- How to create a CDR event
           'content' means event body will contain CDR as XML
           'file' means 'CDR-Path' header will contain a path to file created in 'cdr-log-dir'
           'none' for no event
       -->
       <!-- <param name="cdr-event-mode" value="content"/> -->
-      
+
       <!-- Domain (for presence) -->
       <param name="domain" value="$${domain}"/>
       <!-- Sample Rate-->
index 6740844c7c8b00fa75857b749ffc93073f79b5e9..f56fcbb7e696a93c966a8eb45188fd85c5db6bb3 100644 (file)
@@ -523,7 +523,7 @@ switch_status_t conference_api_sub_unvmute(conference_member_t *member, switch_s
        if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) {
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        if ((layer = conference_video_get_layer_locked(member))) {
                layer->clear = 1;
                conference_video_release_layer(&layer);
@@ -1277,7 +1277,7 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit
                } else {
                        group_name = argv[3];
                }
-               
+
                if (!group_name) {
                        stream->write_function(stream, "Group name not specified.\n");
                        return SWITCH_STATUS_SUCCESS;
@@ -1294,7 +1294,7 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit
                        }
 
                        stream->write_function(stream, "Change to layout group [%s]\n", group_name);
-                       
+
                        if (argv[xx]) {
                                if ((idx = atoi(argv[xx])) > 0) {
                                        idx--;
@@ -1638,7 +1638,7 @@ switch_status_t conference_api_sub_vid_logo_img(conference_member_t *member, swi
        }
 
        layer = conference_video_get_layer_locked(member);
-               
+
        if (!layer) {
                goto end;
        }
@@ -2545,7 +2545,7 @@ switch_status_t conference_api_sub_record(conference_obj_t *conference, switch_s
        }
 
        if (id == 0 && conference->canvases[0]) id = 1;
-       
+
        if (id > conference->canvas_count) {
                id = 1;
        }
@@ -3001,7 +3001,7 @@ switch_status_t conference_api_dispatch(conference_obj_t *conference, switch_str
                                                }
 
                                                member = conference_member_get_by_var(conference, var, val);
-                                               
+
                                                if (member != NULL) {
                                                        pfn(member, stream, argv[argn + 2]);
                                                        switch_thread_rwlock_unlock(member->rwlock);
index 9828efba7796801f134fa67db4e9eb781c0abe5f..79f487fae98c03fe398eb6dc3fc55226270b4cf0 100644 (file)
@@ -45,7 +45,7 @@
 static cJSON *get_canvas_info(mcu_canvas_t *canvas)
 {
        cJSON *obj = cJSON_CreateObject();
-       
+
        cJSON_AddItemToObject(obj, "canvasID", cJSON_CreateNumber(canvas->canvas_id));
        cJSON_AddItemToObject(obj, "totalLayers", cJSON_CreateNumber(canvas->total_layers));
        cJSON_AddItemToObject(obj, "layersUsed", cJSON_CreateNumber(canvas->layers_used));
@@ -53,7 +53,7 @@ static cJSON *get_canvas_info(mcu_canvas_t *canvas)
        if (canvas->vlayout) {
                cJSON_AddItemToObject(obj, "layoutName", cJSON_CreateString(canvas->vlayout->name));
        }
-       
+
        return obj;
 }
 
@@ -188,24 +188,24 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
                                }
                                if (member_id < 0) member_id = 0;
                        }
-               
+
                        if (member_id > 0) {
                                conference_member_t *member;
-                               
+
                                if ((member = conference_member_get(conference, member_id))) {
                                        mcu_canvas_t *canvas;
-                                       
+
                                        if ((canvas = conference_video_get_canvas_locked(member))) {
                                                cJSON *obj;
-                                               
+
                                                if ((obj = get_canvas_info(canvas))) {
-                                                       cJSON_AddItemToObject(obj, "layerID", cJSON_CreateNumber(member->video_layer_id));      
+                                                       cJSON_AddItemToObject(obj, "layerID", cJSON_CreateNumber(member->video_layer_id));
                                                        cJSON_AddItemToArray(array, obj);
                                                }
-                                               
+
                                                conference_video_release_canvas(&canvas);
                                        }
-                                       
+
                                        switch_thread_rwlock_unlock(member->rwlock);
                                }
 
@@ -225,12 +225,12 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
 
                                switch_mutex_unlock(conference->canvas_mutex);
                        }
-                       
+
                        switch_thread_rwlock_unlock(conference->rwlock);
                }
-       
+
                addobj = array;
-               
+
        } else if (!strcasecmp(action, "list-videoLayouts")) {
                switch_hash_index_t *hi;
                void *val;
@@ -245,15 +245,15 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
                                        cJSON *obj = cJSON_CreateObject();
                                        cJSON *resarray = cJSON_CreateArray();
                                        int i;
-                                       
+
                                        switch_core_hash_this(hi, &vvar, NULL, &val);
                                        vlayout = (video_layout_t *)val;
                                        for (i = 0; i < vlayout->layers; i++) {
                                                if (vlayout->images[i].res_id) {
                                                        cJSON_AddItemToArray(resarray, cJSON_CreateString((char *)vlayout->images[i].res_id));
                                                }
-                                       }                                       
-                                       
+                                       }
+
                                        cJSON_AddItemToObject(obj, "type", cJSON_CreateString("layout"));
                                        cJSON_AddItemToObject(obj, "name", cJSON_CreateString((char *)vvar));
                                        cJSON_AddItemToObject(obj, "resIDS", resarray);
@@ -274,11 +274,11 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
                                        lg = (layout_group_t *) val;
 
                                        name = switch_mprintf("group:%s", (char *)vvar);
-                                       
+
                                        for (vlnode = lg->layouts; vlnode; vlnode = vlnode->next) {
                                                cJSON_AddItemToArray(grouparray, cJSON_CreateString(vlnode->vlayout->name));
                                        }
-                                       
+
                                        cJSON_AddItemToObject(obj, "type", cJSON_CreateString("layoutGroup"));
                                        cJSON_AddItemToObject(obj, "name", cJSON_CreateString(name));
                                        cJSON_AddItemToObject(obj, "groupLayouts", grouparray);
index 801aab168abef7987286bdd93b63986442a15545..230ffb10c9f70b172788d68f1c52df006958ee08 100644 (file)
@@ -277,7 +277,7 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u
                const char *canvasstr = switch_event_get_header(fnode->fh.params, "canvas");
                const char *loopsstr = switch_event_get_header(fnode->fh.params, "loops");
                int canvas_id = -1;
-               
+
                if (loopsstr) {
                        fnode->loops = atoi(loopsstr);
 
index d022bea4b2d60ad2d9a2d9968db7e32d9a4764a5..34da5617646b6ddc465232851c21cad137942200 100644 (file)
@@ -800,8 +800,8 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
                        }
 
                        member->loop_loop = 1;
-                       
-                       goto do_continue;                       
+
+                       goto do_continue;
                }
 
                if (switch_test_flag(read_frame, SFF_CNG)) {
@@ -1003,7 +1003,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
                                }
                        }
                }
-               
+
                /* skip frames that are not actual media or when we are muted or silent */
                if ((conference_utils_member_test_flag(member, MFLAG_TALKING) || member->energy_level == 0 || conference_utils_test_flag(member->conference, CFLAG_AUDIO_ALWAYS))
                        && conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK) &&        !conference_utils_test_flag(member->conference, CFLAG_WAIT_MOD)
index e05bbacd2fe083a3c6f6a49c5fb29cc546834c8d..2dc5ce5a5f2c9b42645e6397415e57dce0e1626e 100644 (file)
@@ -152,7 +152,7 @@ void conference_member_update_status_field(conference_member_t *member)
        if (!member->conference->la || !member->json || !member->status_field || conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) {
                return;
        }
-       
+
        switch_live_array_lock(member->conference->la);
 
        if (!conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK)) {
@@ -198,7 +198,7 @@ void conference_member_update_status_field(conference_member_t *member)
                if (switch_channel_test_flag(member->channel, CF_VIDEO) || member->avatar_png_img) {
                        video = cJSON_CreateObject();
 
-                       if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && 
+                       if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) &&
                                member->video_layer_id > -1 && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) {
                                cJSON_AddItemToObject(video, "visible", cJSON_CreateTrue());
                        } else {
@@ -423,7 +423,7 @@ conference_member_t *conference_member_get_by_var(conference_obj_t *conference,
        switch_mutex_lock(conference->member_mutex);
        for (member = conference->members; member; member = member->next) {
                const char *check_var;
-               
+
                if (conference_utils_member_test_flag(member, MFLAG_NOCHANNEL)) {
                        continue;
                }
@@ -692,7 +692,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
        switch_mutex_lock(member->audio_out_mutex);
        lock_member(member);
        switch_mutex_lock(conference->member_mutex);
-       
+
        if (member->rec) {
                conference->recording_members++;
        }
@@ -766,7 +766,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
                                member->energy_level = id;
                        }
                }
-               
+
                if ((var = switch_channel_get_variable_dup(member->channel, "video_initial_canvas", SWITCH_FALSE, -1))) {
                        uint32_t id = atoi(var) - 1;
                        if (id < conference->canvas_count) {
@@ -777,16 +777,16 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
 
                if ((var = switch_channel_get_variable_dup(member->channel, "video_initial_watching_canvas", SWITCH_FALSE, -1))) {
                        uint32_t id = atoi(var) - 1;
-                       
+
                        if (id == 0) {
                                id = conference->canvas_count;
                        }
-                       
+
                        if (id <= conference->canvas_count && conference->canvases[id]) {
                                member->watching_canvas_id = id;
                        }
                }
-               
+
                conference_video_reset_member_codec_index(member);
 
                if (has_video) {
@@ -806,7 +806,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
                        if ((var = switch_channel_get_variable(member->channel, "rtp_video_max_bandwidth_in"))) {
                                member->max_bw_in = switch_parse_bandwidth_string(var);
                        }
-               
+
                        if ((var = switch_channel_get_variable(member->channel, "rtp_video_max_bandwidth_out"))) {
                                member->max_bw_out = switch_parse_bandwidth_string(var);
 
@@ -816,7 +816,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
                                }
                        }
                }
-               
+
                switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id);
                switch_channel_set_variable_printf(channel, "conference_moderator", "%s", conference_utils_member_test_flag(member, MFLAG_MOD) ? "true" : "false");
                switch_channel_set_variable_printf(channel, "conference_ghost", "%s", conference_utils_member_test_flag(member, MFLAG_GHOST) ? "true" : "false");
@@ -958,7 +958,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
                        cJSON *dvars;
                        switch_event_t *var_event;
                        switch_event_header_t *hi;
-                       
+
                        member->json = cJSON_CreateArray();
                        cJSON_AddItemToArray(member->json, cJSON_CreateStringPrintf("%0.4d", member->id));
                        cJSON_AddItemToArray(member->json, cJSON_CreateString(switch_channel_get_variable(member->channel, "caller_id_number")));
@@ -979,7 +979,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
                                for (hi = var_event->headers; hi; hi = hi->next) {
                                        if (!strncasecmp(hi->name, "verto_dvar_", 11)) {
                                                char *var = hi->name + 11;
-                                               
+
                                                if (var) {
                                                        cJSON_AddItemToObject(dvars, var, cJSON_CreateString(hi->value));
                                                }
@@ -1147,7 +1147,7 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
        lock_member(member);
        conference_utils_member_clear_flag(member, MFLAG_INTREE);
 
-       
+
        switch_safe_free(member->text_framedata);
        member->text_framesize = 0;
        if (member->text_buffer) {
index 64a444cdee06d750ac6111696bd2897f54f62581..f926d3043dfb5c5e88b2624133d0d85acc866626 100644 (file)
@@ -192,7 +192,7 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
        member->frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE;
        member->frame = switch_core_alloc(member->pool, member->frame_size);
        member->mux_frame = switch_core_alloc(member->pool, member->frame_size);
-       
+
        if (conference->canvases[0]) {
                member->canvas_id = rec->canvas_id;
                canvas = conference->canvases[member->canvas_id];
index 2cf5f58e54c5af9755353b308a0cee7c68cdeff5..850d274f963165f3ff4c23151e257c58491c5321 100644 (file)
@@ -113,7 +113,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
                                const char *val = NULL, *name = NULL, *bgimg = NULL;
                                switch_bool_t auto_3d = SWITCH_FALSE;
                                int border = 0;
-                               
+
                                if ((val = switch_xml_attr(x_layout, "name"))) {
                                        name = val;
                                }
@@ -126,7 +126,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
                                auto_3d = switch_true(switch_xml_attr(x_layout, "auto-3d-position"));
 
                                bgimg = switch_xml_attr(x_layout, "bgimg");
-                               
+
                                if ((val = switch_xml_attr(x_layout, "border"))) {
                                        border = atoi(val);
                                        if (border < 0) border = 0;
@@ -147,7 +147,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
                                        if ((val = switch_xml_attr(x_image, "x"))) {
                                                x = atoi(val);
                                        }
-                                       
+
                                        if ((val = switch_xml_attr(x_image, "y"))) {
                                                y = atoi(val);
                                        }
@@ -171,7 +171,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
                                        if ((val = switch_xml_attr(x_image, "floor-only"))) {
                                                flooronly = floor = switch_true(val);
                                        }
-                                       
+
                                        if ((val = switch_xml_attr(x_image, "file-only"))) {
                                                fileonly = switch_true(val);
                                        }
@@ -187,7 +187,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
                                        if ((val = switch_xml_attr(x_image, "audio-position"))) {
                                                audio_position = val;
                                        }
-                                       
+
                                        if ((val = switch_xml_attr(x_image, "border"))) {
                                                border = atoi(val);
 
@@ -203,9 +203,9 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
                                        if (hscale == -1) {
                                                hscale = scale;
                                        }
-                                       
+
                                        if (!border) border = conference->video_border_size;
-                                       
+
                                        if (fileonly) {
                                                floor = flooronly = 0;
                                        }
@@ -220,8 +220,8 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
                                        vlayout->images[vlayout->layers].flooronly = flooronly;
                                        vlayout->images[vlayout->layers].fileonly = fileonly;
                                        vlayout->images[vlayout->layers].overlap = overlap;
-                                       
-                                       
+
+
                                        if (res_id) {
                                                vlayout->images[vlayout->layers].res_id = switch_core_strdup(conference->pool, res_id);
                                        }
@@ -256,7 +256,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int
                                                        vlayout->images[vlayout->layers].audio_position = switch_core_strdup(conference->pool, audio_position);
                                                }
                                        }
-                                       
+
                                        vlayout->layers++;
                                }
 
@@ -341,7 +341,7 @@ void conference_video_clear_layer(mcu_layer_t *layer)
 
        layer->banner_patched = 0;
        layer->refresh = 1;
-       
+
 }
 
 void conference_video_reset_layer(mcu_layer_t *layer)
@@ -421,7 +421,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg,
                        layer->bug_frame.img = NULL;
                        switch_thread_rwlock_unlock(layer->member->rwlock);
                }
-               
+
                layer->bugged = 0;
        }
 
@@ -538,7 +538,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg,
                if (!layer->img) {
                        layer->img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, img_w, img_h, 1);
                }
-               
+
                if (layer->banner_img && !layer->banner_patched) {
                        switch_img_fill(layer->canvas->img, layer->x_pos + layer->geometry.border, layer->y_pos + layer->geometry.border, layer->screen_w, layer->screen_h, &layer->canvas->letterbox_bgcolor);
                        switch_img_fit(&layer->banner_img, layer->screen_w, layer->screen_h, SWITCH_FIT_SIZE);
@@ -556,13 +556,13 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg,
                if (layer->geometry.border) {
                        switch_img_fill(IMG, x_pos, y_pos, img_w, img_h, &layer->canvas->border_color);
                }
-               
+
                img_w -= (layer->geometry.border * 2);
                img_h -= (layer->geometry.border * 2);
 
                switch_img_scale(img, &layer->img, img_w, img_h);
 
-               if (layer->img) {                       
+               if (layer->img) {
                        switch_img_patch(IMG, layer->img, x_pos + layer->geometry.border, y_pos + layer->geometry.border);
                }
 
@@ -586,7 +586,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg,
                        }
 
                }
-               
+
                layer->last_img_addr = img_addr;
 
        } else {
@@ -644,7 +644,7 @@ mcu_layer_t *conference_video_get_layer_locked(conference_member_t *member)
                        conference_video_release_canvas(&canvas);
                }
        }
-       
+
        return layer;
 }
 
@@ -660,7 +660,7 @@ void conference_video_release_layer(mcu_layer_t **layer)
 
        switch_mutex_unlock(canvas->mutex);
        conference_video_release_canvas(&canvas);
-       
+
        *layer = NULL;
 }
 
@@ -686,7 +686,7 @@ void conference_video_release_canvas(mcu_canvas_t **canvasP)
        mcu_canvas_t *canvas = NULL;
 
        switch_assert(canvasP);
-       
+
        canvas = *canvasP;
 
        if (!canvas) return;
@@ -708,7 +708,7 @@ void conference_video_detach_video_layer(conference_member_t *member)
        mcu_canvas_t *canvas = NULL;
 
        if (member->canvas_id < 0) return;
-       
+
        if (!(canvas = conference_video_get_canvas_locked(member))) {
                return;
        }
@@ -718,7 +718,7 @@ void conference_video_detach_video_layer(conference_member_t *member)
        if (member->video_layer_id < 0) {
                goto end;
        }
-       
+
        layer = &canvas->layers[member->video_layer_id];
 
        if (layer->geometry.audio_position) {
@@ -745,7 +745,7 @@ void conference_video_detach_video_layer(conference_member_t *member)
        if (conference_utils_test_flag(member->conference, CFLAG_JSON_STATUS)) {
                conference_member_update_status_field(member);
        }
-       
+
        if (canvas->bgimg) {
                conference_video_set_canvas_bgimg(canvas, NULL);
        }
@@ -754,7 +754,7 @@ void conference_video_detach_video_layer(conference_member_t *member)
 
        switch_mutex_unlock(canvas->mutex);
        conference_video_release_canvas(&canvas);
-       
+
 }
 
 
@@ -1125,7 +1125,7 @@ void conference_video_init_canvas_layers(conference_obj_t *conference, mcu_canva
                layer->idx = i;
                layer->refresh = 1;
 
-                                                                                                                                               
+
                layer->screen_w = (uint32_t)(canvas->img->d_w * layer->geometry.scale / VIDEO_LAYOUT_SCALE);
                layer->screen_h = (uint32_t)(canvas->img->d_h * layer->geometry.hscale / VIDEO_LAYOUT_SCALE);
 
@@ -1177,7 +1177,7 @@ void conference_video_init_canvas_layers(conference_obj_t *conference, mcu_canva
        if (conference->video_canvas_bgimg && !vlayout->bgimg) {
                conference_video_set_canvas_bgimg(canvas, conference->video_canvas_bgimg);
        }
-       
+
        switch_mutex_unlock(canvas->mutex);
        switch_thread_rwlock_unlock(canvas->video_rwlock);
 
@@ -1196,7 +1196,7 @@ switch_status_t conference_video_set_canvas_bgimg(mcu_canvas_t *canvas, const ch
        } else {
                scaled = 1;
        }
-       
+
        if (!canvas->bgimg) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open image for bgimg\n");
                return SWITCH_STATUS_FALSE;
@@ -1434,7 +1434,7 @@ video_layout_t *conference_video_find_best_layout(conference_obj_t *conference,
 
        for (vlnode = lg->layouts; vlnode; vlnode = vlnode->next) {
                int x, file_layers = 0, member_count = (int)count - file_count, total = vlnode->vlayout->layers;
-               
+
                for (x = total; x >= 0; x--) {
                        if (vlnode->vlayout->images[x].fileonly) {
                                file_layers++;
@@ -1462,7 +1462,7 @@ video_layout_t *conference_video_get_layout(conference_obj_t *conference, const
        } else {
                vlayout = switch_core_hash_find(conference->layout_hash, video_layout_name);
        }
-               
+
        return vlayout;
 }
 
@@ -1473,9 +1473,9 @@ void conference_video_vmute_snap(conference_member_t *member, switch_bool_t clea
        if (member->canvas_id > -1 && member->video_layer_id > -1) {
                mcu_layer_t *layer = NULL;
                mcu_canvas_t *canvas = NULL;
-               
+
                if ((canvas = conference_video_get_canvas_locked(member))) {
-                       
+
                        switch_mutex_lock(canvas->mutex);
                        layer = &canvas->layers[member->video_layer_id];
                        switch_img_free(&layer->mute_img);
@@ -1522,7 +1522,7 @@ void conference_video_canvas_set_fnode_layer(mcu_canvas_t *canvas, conference_fi
                if (canvas->layout_floor_id > -1) {
                        idx = canvas->layout_floor_id;
                        xlayer = &canvas->layers[idx];
-                       
+
                        if (xlayer->fnode && xlayer->fnode != fnode) {
                                idx = -1;
                        }
@@ -1615,7 +1615,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
                } else {
                        pop_status = switch_frame_buffer_pop(member->fb, &pop);
                }
-               
+
                if (pop_status == SWITCH_STATUS_SUCCESS) {
                        mcu_layer_t *layer = NULL;
                        mcu_canvas_t *canvas = NULL;
@@ -1623,14 +1623,14 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
                        if (!pop) {
                                break;
                        }
-                               
+
                        if (loops == 0 || loops == 50) {
                                switch_core_media_gen_key_frame(member->session);
                                switch_core_session_request_video_refresh(member->session);
                        }
 
                        loops++;
-                       
+
                        if ((switch_size_t)pop != 1) {
                                frame = (switch_frame_t *) pop;
                                if (switch_test_flag(frame, SFF_ENCODED)) {
@@ -1641,23 +1641,23 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
 
                                if (!switch_test_flag(frame, SFF_ENCODED) || frame->m) {
                                        switch_time_t now = switch_time_now();
-                                       
+
                                        if (last) {
                                                int delta = (int)(now - last);
                                                if (delta > member->conference->video_fps.ms * 5000) {
-                                                       switch_core_session_request_video_refresh(member->session);                                                     
+                                                       switch_core_session_request_video_refresh(member->session);
                                                }
                                        }
 
                                        last = now;
 
-                                       
+
                                }
 
                                switch_frame_buffer_free(member->fb, &frame);
                        }
 
-                       canvas = NULL;                                                                                                                              
+                       canvas = NULL;
                        layer = NULL;
                        patched = 0;
 
@@ -1774,7 +1774,7 @@ void conference_video_check_recording(conference_obj_t *conference, mcu_canvas_t
                if (!imember->rec) {
                        continue;
                }
-               
+
                if (!conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS) && canvas && imember->canvas_id != canvas->canvas_id) {
                        continue;
                }
@@ -1805,10 +1805,10 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo
        canvas = conference_video_get_canvas_locked(member);
 
        if (conference_utils_test_flag(member->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS) &&
-               (!switch_channel_test_flag(member->channel, CF_VIDEO_READY) || 
+               (!switch_channel_test_flag(member->channel, CF_VIDEO_READY) ||
                 (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY  ||
                  switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_INACTIVE))) {
-               
+
                if (canvas) {
                        conference_video_release_canvas(&canvas);
                }
@@ -1821,7 +1821,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo
 
        member->avatar_patched = 0;
 
-       if (!force && switch_channel_test_flag(member->channel, CF_VIDEO_READY) && 
+       if (!force && switch_channel_test_flag(member->channel, CF_VIDEO_READY) &&
                switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE) {
                conference_utils_member_set_flag_locked(member, MFLAG_ACK_VIDEO);
                switch_core_session_request_video_refresh(member->session);
@@ -1888,7 +1888,7 @@ void conference_video_patch_fnode(mcu_canvas_t *canvas, conference_file_node_t *
                mcu_layer_t *layer = &canvas->layers[fnode->layer_id];
                switch_frame_t file_frame = { 0 };
                switch_status_t status = switch_core_file_read_video(&fnode->fh, &file_frame, SVR_FLUSH);
-               
+
                if (status == SWITCH_STATUS_SUCCESS) {
                        switch_img_free(&layer->cur_img);
                        layer->cur_img = file_frame.img;
@@ -1904,7 +1904,7 @@ void conference_video_patch_fnode(mcu_canvas_t *canvas, conference_file_node_t *
 
 void conference_video_fnode_check(conference_file_node_t *fnode, int canvas_id) {
        mcu_canvas_t *canvas = NULL;
-       
+
        if (switch_core_file_has_video(&fnode->fh, SWITCH_TRUE) && switch_core_file_read_video(&fnode->fh, NULL, SVR_CHECK) == SWITCH_STATUS_BREAK) {
                int full_screen = 0;
                char *res_id = NULL;
@@ -1915,7 +1915,7 @@ void conference_video_fnode_check(conference_file_node_t *fnode, int canvas_id)
                        }
                        fnode->canvas_id = canvas_id;
                }
-               
+
                canvas = fnode->conference->canvases[fnode->canvas_id];
                if (fnode->fh.params && fnode->conference->canvas_count == 1) {
                        full_screen = switch_true(switch_event_get_header(fnode->fh.params, "full-screen"));
@@ -1969,7 +1969,7 @@ switch_status_t conference_video_find_layer(conference_obj_t *conference, mcu_ca
        if (!layer &&
                (canvas->layers_used < canvas->total_layers ||
                 (avatar_layers && !member->avatar_png_img) || conference_utils_member_test_flag(member, MFLAG_MOD)) &&
-               (member->avatar_png_img || (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && 
+               (member->avatar_png_img || (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY &&
                  switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE))) {
 
                /* find an empty layer */
@@ -2050,7 +2050,7 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t
        //if (member->avatar_png_img && switch_channel_test_flag(member->channel, CF_VIDEO_READY) && conference_utils_member_test_flag(member, MFLAG_ACK_VIDEO)) {
        //      switch_img_free(&member->avatar_png_img);
        //}
-       
+
        if (switch_channel_test_flag(member->channel, CF_VIDEO_READY)) {
                do {
                        if (switch_queue_trypop(member->video_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
@@ -2063,13 +2063,13 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t
                        size = switch_queue_size(member->video_queue);
                } while(size > 0);
 
-               if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && 
-                       member->video_layer_id > -1 && 
+               if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) &&
+                       member->video_layer_id > -1 &&
                        switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY &&
                        switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE
                        ) {
                        switch_vid_params_t vid_params = { 0 };
-                       
+
                        switch_core_media_get_vid_params(member->session, &vid_params);
 
                        if (!vid_params.fps) {
@@ -2081,7 +2081,7 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t
                                if ((member->good_img % (int)(vid_params.fps * 10)) == 0) {
                                        conference_video_reset_video_bitrate_counters(member);
                                }
-                               
+
                                if (member->auto_avatar && member->good_img > vid_params.fps * 3) {
                                        conference_video_check_flush(member, SWITCH_TRUE);
                                }
@@ -2123,7 +2123,7 @@ void conference_video_set_incoming_bitrate(conference_member_t *member, int kps,
 
        if (!force && kps < member->managed_kps && member->conference->auto_kps_debounce) {
                member->auto_kps_debounce_ticks = member->conference->auto_kps_debounce / member->conference->video_fps.ms;
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s setting bitrate debounce timer to %dms\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s setting bitrate debounce timer to %dms\n",
                                                  switch_channel_get_name(member->channel), member->conference->auto_kps_debounce);
                member->managed_kps = kps;
                member->managed_kps_set = 0;
@@ -2133,8 +2133,8 @@ void conference_video_set_incoming_bitrate(conference_member_t *member, int kps,
        msg.message_id = SWITCH_MESSAGE_INDICATE_BITRATE_REQ;
        msg.numeric_arg = kps * 1024;
        msg.from = __FILE__;
-       
-       switch_core_session_receive_message(member->session, &msg);     
+
+       switch_core_session_receive_message(member->session, &msg);
 
        member->managed_kps_set = 1;
        member->managed_kps = kps;
@@ -2167,7 +2167,7 @@ void conference_video_set_max_incoming_bitrate(conference_obj_t *conference, int
                        conference_video_set_max_incoming_bitrate_member(imember, kps);
                }
        }
-       switch_mutex_unlock(conference->member_mutex);  
+       switch_mutex_unlock(conference->member_mutex);
 }
 
 void conference_video_set_absolute_incoming_bitrate(conference_obj_t *conference, int kps)
@@ -2180,7 +2180,7 @@ void conference_video_set_absolute_incoming_bitrate(conference_obj_t *conference
                        conference_video_set_absolute_incoming_bitrate_member(imember, kps);
                }
        }
-       switch_mutex_unlock(conference->member_mutex);  
+       switch_mutex_unlock(conference->member_mutex);
 }
 
 void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_t *layer)
@@ -2189,8 +2189,8 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_
        int kps = 0, kps_in = 0;
        int max = 0;
        int min_layer = 0, min = 0;
-       
-       if (!conference_utils_test_flag(member->conference, CFLAG_MANAGE_INBOUND_VIDEO_BITRATE) || 
+
+       if (!conference_utils_test_flag(member->conference, CFLAG_MANAGE_INBOUND_VIDEO_BITRATE) ||
                switch_channel_test_flag(member->channel, CF_VIDEO_BITRATE_UNMANAGABLE)) {
                return;
        }
@@ -2212,7 +2212,7 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_
                }
                return;
        }
-       
+
        if (vid_params.width != member->vid_params.width || vid_params.height != member->vid_params.height) {
                switch_core_session_request_video_refresh(member->session);
                conference_video_clear_managed_kps(member);
@@ -2224,7 +2224,7 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_
                return;
        }
 
-       if ((kps_in = switch_calc_bitrate(vid_params.width, vid_params.height, 
+       if ((kps_in = switch_calc_bitrate(vid_params.width, vid_params.height,
                                                                          member->conference->video_quality, (int)(member->conference->video_fps.fps))) < 512) {
                kps_in = 512;
        }
@@ -2237,9 +2237,9 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_
 
        min_layer = kps / 2;
        min = kps_in / 2;
-       
+
        if (min_layer > min) min = min_layer;
-       
+
        if (member->conference->max_bw_in) {
                max = member->conference->max_bw_in;
        } else {
@@ -2294,7 +2294,7 @@ static void wait_for_canvas(mcu_canvas_t *canvas)
 
                for (i = 0; i < canvas->total_layers; i++) {
                        mcu_layer_t *layer = &canvas->layers[i];
-                                       
+
                        if (layer->need_patch) {
                                if (layer->member_id && layer->member && conference_utils_member_test_flag(layer->member, MFLAG_RUNNING) && layer->member->fb) {
                                        switch_frame_buffer_trypush(layer->member->fb, (void *) 1);
@@ -2323,18 +2323,18 @@ static void personal_attach(mcu_layer_t *layer, conference_member_t *member)
                layer->avatar_patched = 0;
                switch_img_free(&layer->banner_img);
                switch_img_free(&layer->logo_img);
-               
+
                if (layer->geometry.audio_position) {
                        conference_api_sub_position(member, NULL, layer->geometry.audio_position);
                }
-               
+
                if (member->channel) {
                        var = NULL;
                        if (member->video_banner_text ||
                                (var = switch_channel_get_variable_dup(member->channel, "video_banner_text", SWITCH_FALSE, -1))) {
                                conference_video_layer_set_banner(member, layer, var);
                        }
-                       
+
                        var = NULL;
                        if (member->video_logo ||
                                (var = switch_channel_get_variable_dup(member->channel, "video_logo_path", SWITCH_FALSE, -1))) {
@@ -2342,7 +2342,7 @@ static void personal_attach(mcu_layer_t *layer, conference_member_t *member)
                        }
                }
        }
-       
+
        layer->member_id = member->id;
 }
 
@@ -2376,7 +2376,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
        canvas->video_layout_group = conference->video_layout_group;
 
        packet = switch_core_alloc(conference->pool, SWITCH_RTP_MAX_BUF_LEN);
-       
+
        while (conference_globals.running && !conference_utils_test_flag(conference, CFLAG_DESTRUCT) && conference_utils_test_flag(conference, CFLAG_VIDEO_MUXING)) {
                switch_bool_t need_refresh = SWITCH_FALSE, send_keyframe = SWITCH_FALSE, need_reset = SWITCH_FALSE;
                switch_time_t now;
@@ -2429,14 +2429,14 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                        int no_muted = conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS);
                        int no_av = conference_utils_test_flag(imember->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS);
                        int seen = conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN);
-                       
-                       if (imember->channel && switch_channel_ready(imember->channel) && switch_channel_test_flag(imember->channel, CF_VIDEO_READY) && 
+
+                       if (imember->channel && switch_channel_ready(imember->channel) && switch_channel_test_flag(imember->channel, CF_VIDEO_READY) &&
                                !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN) &&
                                conference_utils_member_test_flag(imember, MFLAG_RUNNING) && (!no_muted || seen) && (!no_av || (no_av && !imember->avatar_png_img))
                                && imember->canvas_id == canvas->canvas_id && imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY && imember->video_media_flow != SWITCH_MEDIA_FLOW_INACTIVE) {
                                video_count++;
                        }
-                       
+
                }
 
 
@@ -2470,7 +2470,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                if (members_with_avatar != conference->members_with_avatar) {
                        count_changed = 1;
                }
-       
+
                if (conference_utils_test_flag(conference, CFLAG_REFRESH_LAYOUT)) {
                        count_changed = 1;
                        conference_utils_clear_flag(conference, CFLAG_REFRESH_LAYOUT);
@@ -2490,7 +2490,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                if (count_changed && !personal) {
                        layout_group_t *lg = NULL;
                        video_layout_t *vlayout = NULL;
-                       
+
                        if (canvas->video_layout_group && (lg = switch_core_hash_find(conference->layout_group_hash, canvas->video_layout_group))) {
                                if ((vlayout = conference_video_find_best_layout(conference, lg, canvas->video_count, file_count)) && vlayout != canvas->vlayout) {
                                        switch_mutex_lock(conference->member_mutex);
@@ -2618,17 +2618,17 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                continue;
                        }
 
-                       if (conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) && 
+                       if (conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) &&
                                !conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN) && imember->video_layer_id > -1) {
                                conference_video_detach_video_layer(imember);
                                switch_img_free(&imember->video_mute_img);
-                               
+
                                if (imember->id == imember->conference->video_floor_holder) {
                                        conference_video_set_floor_holder(conference, NULL, SWITCH_FALSE);
                                } else if (imember->id == imember->conference->last_video_floor_holder) {
                                        conference->last_video_floor_holder = 0;
                                }
-                               
+
                                switch_core_session_rwunlock(imember->session);
                                continue;
                        }
@@ -2707,15 +2707,15 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                        }
 
                                        if (!layer->mute_patched) {
-                                               
+
                                                if (!imember->video_mute_img) {
                                                        conference_video_vmute_snap(imember, SWITCH_FALSE);
                                                }
-                                               
+
                                                if (imember->video_mute_img || layer->mute_img) {
                                                        conference_video_clear_layer(layer);
-                                                       
-                                                       if (!layer->mute_img) {                                                         
+
+                                                       if (!layer->mute_img) {
                                                                if (imember->video_mute_img) {
                                                                        //layer->mute_img = switch_img_read_png(imember->video_mute_png, SWITCH_IMG_FMT_I420);
                                                                        switch_img_copy(imember->video_mute_img, &layer->mute_img);
@@ -2768,7 +2768,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                        layout_group_t *lg = NULL;
                        video_layout_t *vlayout = NULL;
                        conference_member_t *omember;
-                       
+
                        if (video_key_freq && (now - last_key_time) > video_key_freq) {
                                send_keyframe = SWITCH_TRUE;
                                last_key_time = now;
@@ -2777,7 +2777,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                        switch_mutex_lock(conference->member_mutex);
 
                        for (imember = conference->members; imember; imember = imember->next) {
-                               
+
                                if (!imember->rec &&
                                        (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO_READY) ||
                                         switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS)) {
@@ -2797,12 +2797,12 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                        conference_video_init_canvas_layers(conference, imember->canvas, conference->new_personal_vlayout);
                                        layout_applied++;
                                }
-                               
+
                                if (imember->channel && switch_channel_test_flag(imember->channel, CF_VIDEO_REFRESH_REQ)) {
                                        switch_channel_clear_flag(imember->channel, CF_VIDEO_REFRESH_REQ);
                                        send_keyframe = SWITCH_TRUE;
                                }
-                               
+
                                if (count_changed) {
                                        int total = last_video_count;
                                        int kps;
@@ -2812,12 +2812,12 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                                total += conference->members_with_avatar;
                                        }
 
-                                       if (total > 0 && 
-                                               (!conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) || 
-                                                conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN)) && 
+                                       if (total > 0 &&
+                                               (!conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) ||
+                                                conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN)) &&
                                                imember->session && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY &&
                                                imember->session && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE) {
-                                               
+
                                                total--;
                                        }
 
@@ -2826,21 +2826,21 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                        if (conference->members_with_video == 1 && file_count) {
                                                total = 0;
                                        }
-                                       
+
                                        if (canvas->video_layout_group && (lg = switch_core_hash_find(conference->layout_group_hash, canvas->video_layout_group))) {
                                                if ((vlayout = conference_video_find_best_layout(conference, lg, total + file_count, file_count))) {
                                                        conference_video_init_canvas_layers(conference, imember->canvas, vlayout);
                                                }
                                        }
-                                       
-                                       if (imember->channel && !switch_channel_test_flag(imember->channel, CF_VIDEO_BITRATE_UNMANAGABLE) && 
+
+                                       if (imember->channel && !switch_channel_test_flag(imember->channel, CF_VIDEO_BITRATE_UNMANAGABLE) &&
                                                conference_utils_test_flag(conference, CFLAG_MANAGE_INBOUND_VIDEO_BITRATE)) {
                                                switch_core_media_get_vid_params(imember->session, &vid_params);
                                                kps = switch_calc_bitrate(vid_params.width, vid_params.height, conference->video_quality, (int)(imember->conference->video_fps.fps));
                                                conference_video_set_incoming_bitrate(imember, kps, SWITCH_TRUE);
                                        }
                                }
-                               
+
                                if (imember->session && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE) {
                                        conference_video_pop_next_image(imember, &imember->pcanvas_img);
                                }
@@ -2856,10 +2856,10 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                        }
 
                        switch_mutex_lock(conference->mutex);
-                       
+
                        if (check_async_file && conference->async_fnode) {
                                switch_status_t st = switch_core_file_read_video(&conference->async_fnode->fh, &file_frame, SVR_FLUSH);
-                               
+
                                if (st == SWITCH_STATUS_SUCCESS) {
                                        if ((async_file_img = file_frame.img)) {
                                                switch_img_free(&file_imgs[j]);
@@ -2887,8 +2887,8 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                        for (imember = conference->members; imember; imember = imember->next) {
                                int i = 0;
                                mcu_layer_t *floor_layer = NULL;
-                               
-                               if (!imember->rec && 
+
+                               if (!imember->rec &&
                                        (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO) || !imember->canvas ||
                                         (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY ||
                                         switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_INACTIVE) ||
@@ -2907,19 +2907,19 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
 
                                if (!file_count && imember->canvas->layout_floor_id > -1 && imember->conference->video_floor_holder &&
                                        imember->id != imember->conference->video_floor_holder) {
-                                       
+
                                        if ((omember = conference_member_get(imember->conference, imember->conference->video_floor_holder))) {
                                                if (conference->members_with_video + conference->members_with_avatar == 1 || imember != omember) {
                                                        layer = &imember->canvas->layers[imember->canvas->layout_floor_id];
                                                        floor_layer = layer;
                                                        layer = NULL;
                                                }
-                                               
+
                                                switch_thread_rwlock_unlock(omember->rwlock);
                                        }
                                }
 
-                               
+
                                for (omember = conference->members; omember; omember = omember->next) {
                                        mcu_layer_t *layer = NULL;
                                        switch_image_t *use_img = NULL;
@@ -2928,7 +2928,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                                switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY || switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_INACTIVE) {
                                                continue;
                                        }
-                                       
+
                                        if (conference->members_with_video + conference->members_with_avatar != 1 && imember == omember) {
                                                continue;
                                        }
@@ -2936,7 +2936,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                        if (file_count && (conference->members_with_video + conference->members_with_avatar == 1)) {
                                                floor_layer = NULL;
                                        }
-                                       
+
                                        if (!file_count && floor_layer && omember->id == conference->video_floor_holder) {
                                                layer = floor_layer;
                                        } else {
@@ -2945,7 +2945,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                                                i++;
                                                        }
                                                }
-                                               
+
                                                if (i < imember->canvas->total_layers) {
                                                        layer = &imember->canvas->layers[i++];
                                                }
@@ -2960,11 +2960,11 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                        }
 
                                        use_img = omember->pcanvas_img;
-                                       
+
                                        if (files_playing && layer && layer == &imember->canvas->layers[imember->canvas->layout_floor_id]) {
                                                use_img = NULL;
                                        }
-                                       
+
                                        if (layer) {
 
                                                if (use_img && !omember->avatar_png_img) {
@@ -3010,7 +3010,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                                conference_video_scale_and_patch(layer, img, SWITCH_FALSE);
                                        }
                                }
-                               
+
                                if (imember->session) {
                                        switch_core_session_rwunlock(imember->session);
                                }
@@ -3025,7 +3025,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                        for (imember = conference->members; imember; imember = imember->next) {
                                switch_frame_t *dupframe;
 
-                               if (!imember->rec && 
+                               if (!imember->rec &&
                                        (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO_READY) || !imember->canvas ||
                                         switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS)) {
                                        continue;
@@ -3040,7 +3040,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                }
 
                                write_frame.img = imember->canvas->img;
-                               
+
                                if (imember->rec) {
                                        switch_core_file_write_video(&imember->rec->fh, &write_frame);
                                } else {
@@ -3066,7 +3066,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
 
                        switch_mutex_unlock(conference->member_mutex);
                } else {
-                       
+
                        if (conference->async_fnode && (conference->async_fnode->canvas_id == canvas->canvas_id || conference->async_fnode->canvas_id == -1)) {
                                if (conference->async_fnode->layer_id > -1) {
                                        conference_video_patch_fnode(canvas, conference->async_fnode);
@@ -3170,11 +3170,11 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                        } else if (file_img) {
                                switch_img_free(&file_img);
                        }
-                       
+
                        write_frame.img = write_img;
 
                        wait_for_canvas(canvas);
-                       
+
                        if (canvas->recording) {
                                conference_video_check_recording(conference, canvas, &write_frame);
                        }
@@ -3196,14 +3196,14 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                                                                                                                           timestamp, need_refresh, send_keyframe, need_reset);
 
                                        if (canvas->video_write_bandwidth) {
-                                               switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, 
+                                               switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH,
                                                                                                  SCCT_INT, &canvas->video_write_bandwidth, SCCT_NONE, NULL, NULL, NULL);
                                                canvas->video_write_bandwidth = 0;
                                        }
 
                                }
                        }
-                       
+
                        switch_mutex_lock(conference->member_mutex);
                        for (imember = conference->members; imember; imember = imember->next) {
                                switch_frame_t *dupframe;
@@ -3218,7 +3218,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
                                        switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) {
                                        continue;
                                }
-                               
+
                                if (need_refresh) {
                                        switch_core_session_request_video_refresh(imember->session);
                                }
@@ -3545,7 +3545,7 @@ void *SWITCH_THREAD_FUNC conference_video_super_muxing_thread_run(switch_thread_
                                conference_video_write_canvas_image_to_codec_group(conference, canvas, write_codecs[i], i, timestamp, need_refresh, send_keyframe, need_reset);
 
                                if (canvas->video_write_bandwidth) {
-                                       switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, 
+                                       switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH,
                                                                                          SCCT_INT, &canvas->video_write_bandwidth, SCCT_NONE, NULL, NULL, NULL);
                                        canvas->video_write_bandwidth = 0;
                                }
@@ -3562,7 +3562,7 @@ void *SWITCH_THREAD_FUNC conference_video_super_muxing_thread_run(switch_thread_
                                continue;
                        }
 
-                       
+
                        if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO_READY) ||
                                switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) {
                                continue;
@@ -3771,7 +3771,7 @@ void conference_video_set_floor_holder(conference_obj_t *conference, conference_
                        }
                        conference_video_release_canvas(&canvas);
                }
-               
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Adding video floor %s\n",
                                                  switch_channel_get_name(member->channel));
 
@@ -3916,15 +3916,15 @@ void conference_video_write_frame(conference_obj_t *conference, conference_membe
        if (want_refresh) {
                for (imember = conference->members; imember; imember = imember->next) {
                        switch_core_session_t *isession = imember->session;
-                       
+
                        if (!isession || switch_core_session_read_lock(isession) != SWITCH_STATUS_SUCCESS) {
                                continue;
                        }
-                       
+
                        if (switch_channel_test_flag(imember->channel, CF_VIDEO_READY) ) {
-                               switch_core_session_request_video_refresh(imember->session);    
+                               switch_core_session_request_video_refresh(imember->session);
                        }
-                       
+
                        switch_core_session_rwunlock(isession);
                }
        }
@@ -3969,7 +3969,7 @@ switch_status_t conference_video_thread_callback(switch_core_session_t *session,
        if (conference_utils_test_flag(member->conference, CFLAG_VIDEO_MUXING)) {
                switch_image_t *img_copy = NULL;
 
-               if (frame->img && (member->video_layer_id > -1 || member->canvas) && 
+               if (frame->img && (member->video_layer_id > -1 || member->canvas) &&
                        conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) &&
                        switch_queue_size(member->video_queue) < member->conference->video_fps.fps * 2 &&
                        !member->conference->playing_video_file) {
@@ -3992,7 +3992,7 @@ switch_status_t conference_video_thread_callback(switch_core_session_t *session,
                        } else {
                                switch_img_copy(frame->img, &img_copy);
                        }
-                       
+
                        if (switch_queue_trypush(member->video_queue, img_copy) != SWITCH_STATUS_SUCCESS) {
                                switch_img_free(&img_copy);
                        }
index b21bd40cd7f2c6add361f5829616fb94f1ba742a..866fadef271bd7c7491377c956aa346f50d2ff8e 100644 (file)
@@ -258,16 +258,16 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                                const char *caller_id_name = switch_channel_get_variable(imember->channel, "caller_id_name");
                                unsigned char CR[3] = TEXT_UNICODE_LINEFEED;
 
-                               
+
                                switch_mutex_lock(imember->text_mutex);
 
                                framedatalen = strlen(imember->text_framedata) + strlen(caller_id_name) + 6;
 
                                switch_zmalloc(framedata, framedatalen);
-                               
+
                                switch_snprintf(framedata, framedatalen, "%s::\n%s", caller_id_name, imember->text_framedata);
                                memcpy(framedata + strlen(framedata), CR, sizeof(CR));
-                               
+
 
                                frame.data = framedata;
                                frame.datalen = framedatalen;
@@ -277,9 +277,9 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                                                switch_core_session_write_text_frame(omember->session, &frame, 0, 0);
                                        }
                                }
-                               
+
                                free(framedata);
-                               
+
                                imember->text_framedata[0] = '\0';
 
                                switch_mutex_unlock(imember->text_mutex);
@@ -295,7 +295,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                        if (conference_utils_member_test_flag(imember, MFLAG_RUNNING) && imember->session) {
                                switch_channel_t *channel = switch_core_session_get_channel(imember->session);
                                switch_media_flow_t video_media_flow;
-                               
+
                                if ((!floor_holder || (imember->score_iir > SCORE_IIR_SPEAKING_MAX && (floor_holder->score_iir < SCORE_IIR_SPEAKING_MIN)))) {// &&
                                        //(!conference_utils_test_flag(conference, CFLAG_VID_FLOOR) || switch_channel_test_flag(channel, CF_VIDEO))) {
                                        floor_holder = imember;
@@ -316,18 +316,18 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                                        }
                                }
 
-                               if (switch_channel_ready(channel) && 
-                                       switch_channel_test_flag(channel, CF_VIDEO_READY) && 
-                                       imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY && 
-                                       !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN) && 
-                                       (!conference_utils_test_flag(conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) || 
+                               if (switch_channel_ready(channel) &&
+                                       switch_channel_test_flag(channel, CF_VIDEO_READY) &&
+                                       imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY &&
+                                       !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN) &&
+                                       (!conference_utils_test_flag(conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) ||
                                         conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN))) {
                                        members_with_video++;
                                }
 
-                               if (switch_channel_ready(channel) && 
-                                       switch_channel_test_flag(channel, CF_VIDEO_READY) && 
-                                       imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY && 
+                               if (switch_channel_ready(channel) &&
+                                       switch_channel_test_flag(channel, CF_VIDEO_READY) &&
+                                       imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY &&
                                        !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN)) {
                                        members_seeing_video++;
                                }
@@ -455,7 +455,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                                        }
                                } else if (conference->fnode->type == NODE_TYPE_FILE) {
                                        switch_core_file_read(&conference->fnode->fh, file_frame, &file_sample_len);
-                                       
+
                                        if (conference->fnode->fh.vol) {
                                                switch_change_sln_volume_granular((void *)file_frame, (uint32_t)file_sample_len * conference->fnode->fh.channels,
                                                                                                                  conference->fnode->fh.vol);
@@ -470,13 +470,13 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                                                if (--conference->fnode->loops < 0) {
                                                        conference->fnode->loops = -1;
                                                }
-                                               
+
                                                if (conference->fnode->loops) {
                                                        uint32_t pos = 0;
                                                        switch_core_file_seek(&conference->fnode->fh, &pos, 0, SEEK_SET);
                                                }
                                        }
-                                       
+
                                        if (!conference->fnode->loops) {
                                                conference->fnode->done++;
                                        }
@@ -501,13 +501,13 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
                                                if (--conference->async_fnode->loops < 0) {
                                                        conference->async_fnode->loops = -1;
                                                }
-                                               
+
                                                if (conference->async_fnode->loops) {
                                                        uint32_t pos = 0;
                                                        switch_core_file_seek(&conference->async_fnode->fh, &pos, 0, SEEK_SET);
                                                }
                                        }
-                                       
+
                                        if (!conference->async_fnode->loops) {
                                                conference->async_fnode->done++;
                                        }
@@ -1814,17 +1814,17 @@ switch_status_t conference_text_thread_callback(switch_core_session_t *session,
                        memcpy(tmp, member->text_framedata, member->text_framesize);
 
                        switch_assert(tmp);
-                       
+
                        member->text_framesize = inuse + 1024;
-                       
+
                        free(member->text_framedata);
                        member->text_framedata = tmp;
 
                }
 
                bytes = switch_buffer_read(member->text_buffer, member->text_framedata, inuse);
-               *(member->text_framedata + bytes) = '\0'; 
-               
+               *(member->text_framedata + bytes) = '\0';
+
                /*
                for(p = member->text_framedata; p && *p; p++) {
                        if (*p > 32 && *p < 127) {
@@ -1837,7 +1837,7 @@ switch_status_t conference_text_thread_callback(switch_core_session_t *session,
                }
                */
        }
-       
+
        switch_mutex_unlock(member->text_mutex);
 
        return SWITCH_STATUS_SUCCESS;
@@ -2986,7 +2986,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
                                } else {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "video-kps-debounce must be 0 or higher\n");
                                }
-                               
+
                        } else if (!strcasecmp(var, "video-mode") && !zstr(val)) {
                                if (!strcasecmp(val, "passthrough")) {
                                        conference_video_mode = CONF_VIDEO_MODE_PASSTHROUGH;
@@ -3129,7 +3129,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
                if (!video_border_color) {
                        video_border_color = "#000000";
                }
-               
+
                if (!video_super_canvas_bgcolor) {
                        video_super_canvas_bgcolor = "#068df3";
                }
@@ -3146,7 +3146,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
                        conference->no_video_avatar = switch_core_strdup(conference->pool, no_video_avatar);
                }
 
-               
+
                conference->video_canvas_bgcolor = switch_core_strdup(conference->pool, video_canvas_bgcolor);
                conference->video_border_color = switch_core_strdup(conference->pool, video_border_color);
                conference->video_super_canvas_bgcolor = switch_core_strdup(conference->pool, video_super_canvas_bgcolor);
@@ -3529,7 +3529,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
                switch_live_array_set_command_handler(conference->la, conference_event_la_command_handler);
        }
 
-       
+
  end:
 
        switch_mutex_unlock(conference_globals.hash_mutex);
index 4499fe4cea5071e4bb1dbaaf4e0b3a6ee6a7452a..72996d52b989c828eb96013bb923d2143012914f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Rupa Schomaker <rupa@rupa.com>
  * Yossi Neiman <mishehu@freeswitch.org>
  * Seven Du <dujinfang@gmail.com>
@@ -45,7 +45,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_curl_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_curl_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_curl, mod_curl_load, mod_curl_shutdown, NULL);
@@ -273,14 +273,14 @@ static char *print_json(switch_memory_pool_t *pool, http_data_t *http_data)
        char *data = NULL;
        char tmp[32], *f = NULL;
        switch_curl_slist_t *header = http_data->headers;
-       
+
        if(!top || !headers) {
                cJSON_Delete(headers);
-               
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to alloc memory for cJSON structures.\n");
                goto curl_json_output_end;
        }
-       
+
        switch_snprintf(tmp, sizeof(tmp), "%ld", http_data->http_response_code);
        cJSON_AddItemToObject(top, "status_code", cJSON_CreateString(tmp));
        if (http_data->http_response) {
@@ -334,7 +334,7 @@ static char *print_json(switch_memory_pool_t *pool, http_data_t *http_data)
        f = cJSON_PrintUnformatted(top);
        data = switch_core_strdup(pool, f);
        switch_safe_free(f);
-       
+
 curl_json_output_end:
        cJSON_Delete(top);              /* should free up all children */
        return data;
@@ -344,7 +344,7 @@ static size_t http_sendfile_response_callback(void *ptr, size_t size, size_t nme
 {
        register unsigned int realsize = (unsigned int) (size * nmemb);
        http_sendfile_data_t *http_data = data;
-       
+
        if(http_data->sendfile_response_count + realsize < HTTP_SENDFILE_RESPONSE_SIZE)
        {
                // I'm not sure why we need the (realsize+1) here, but it truncates the data by 1 char if I don't do this
@@ -356,7 +356,7 @@ static size_t http_sendfile_response_callback(void *ptr, size_t size, size_t nme
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Response page is more than %d bytes long, truncating.\n", HTTP_SENDFILE_RESPONSE_SIZE);
                realsize = 0;
        }
-       
+
        return realsize;
 }
 
@@ -365,53 +365,53 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data)
 {
        uint8_t count;
        http_data->curl_handle = curl_easy_init();
-       
+
        if (!strncasecmp(http_data->url, "https", 5))
        {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", http_data->url);
                curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
                curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
        }
-       
-       /* From the docs: 
-        * Optionally, you can provide data to POST using the CURLOPT_READFUNCTION and CURLOPT_READDATA 
+
+       /* From the docs:
+        * Optionally, you can provide data to POST using the CURLOPT_READFUNCTION and CURLOPT_READDATA
         * options but then you must make sure to not set CURLOPT_POSTFIELDS to anything but NULL
         * curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, strlen(data));
         * curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, (void *) data);
         */
-       
+
        // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Post data: %s\n", data);
-       
+
        curl_easy_setopt(http_data->curl_handle, CURLOPT_FOLLOWLOCATION, 1);
        curl_easy_setopt(http_data->curl_handle, CURLOPT_MAXREDIRS, 15);
        curl_easy_setopt(http_data->curl_handle, CURLOPT_URL, http_data->url);
        curl_easy_setopt(http_data->curl_handle, CURLOPT_NOSIGNAL, 1);
        curl_easy_setopt(http_data->curl_handle, CURLOPT_USERAGENT, "freeswitch-curl/1.0");
-       
+
        http_data->sendfile_response = switch_core_alloc(http_data->pool, sizeof(char) * HTTP_SENDFILE_RESPONSE_SIZE);
        memset(http_data->sendfile_response, 0, sizeof(char) * HTTP_SENDFILE_RESPONSE_SIZE);
-       
+
        // Set the function where we will copy out the response body data to
        curl_easy_setopt(http_data->curl_handle, CURLOPT_WRITEFUNCTION, http_sendfile_response_callback);
        curl_easy_setopt(http_data->curl_handle, CURLOPT_WRITEDATA, (void *) http_data);
-       
-       /* Add the file to upload as a POST form field */ 
+
+       /* Add the file to upload as a POST form field */
        curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, http_data->filename_element_name, CURLFORM_FILE, http_data->filename_element, CURLFORM_END);
-       
+
        if(!zstr(http_data->extrapost_elements))
        {
                // Now to parse out the individual post element/value pairs
                char *argv[64] = { 0 }; // Probably don't need 64 but eh does it really use that much memory?
                uint32_t argc = 0;
                char *temp_extrapost = switch_core_strdup(http_data->pool, http_data->extrapost_elements);
-               
+
                argc = switch_separate_string(temp_extrapost, '&', argv, (sizeof(argv) / sizeof(argv[0])));
-               
+
                for(count = 0; count < argc; count++)
                {
                        char *argv2[4] = { 0 };
                        uint32_t argc2 = switch_separate_string(argv[count], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])));
-                       
+
                        if(argc2 == 2) {
                                switch_url_decode(argv2[0]);
                                switch_url_decode(argv2[1]);
@@ -419,19 +419,19 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data)
                        }
                }
        }
-       
-       /* Fill in the submit field too, even if this isn't really needed */ 
+
+       /* Fill in the submit field too, even if this isn't really needed */
        curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, "submit", CURLFORM_COPYCONTENTS, "or_die", CURLFORM_END);
-       
-       /* what URL that receives this POST */ 
+
+       /* what URL that receives this POST */
        curl_easy_setopt(http_data->curl_handle, CURLOPT_HTTPPOST, http_data->formpost);
-       
+
        // This part actually fires off the curl, captures the HTTP response code, and then frees up the handle.
        curl_easy_perform(http_data->curl_handle);
        curl_easy_getinfo(http_data->curl_handle, CURLINFO_RESPONSE_CODE, &http_data->http_response_code);
-       
+
        curl_easy_cleanup(http_data->curl_handle);
-               
+
        // Clean up the form data from POST
        curl_formfree(http_data->formpost);
 }
@@ -454,14 +454,14 @@ static switch_status_t http_sendfile_test_file_open(http_sendfile_data_t *http_d
                        else
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create event to notify of failure to open file %s\n", http_data->filename_element);
                }
-               
+
                if((switch_test_flag(http_data, CSO_STREAM) || switch_test_flag(http_data, CSO_NONE)) && http_data->stream)
                        http_data->stream->write_function(http_data->stream, "-Err Unable to open file %s\n", http_data->filename_element);
-               
+
                if(switch_test_flag(http_data, CSO_NONE) && !http_data->stream)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "curl_sendfile: Unable to open file %s\n", http_data->filename_element);
        }
-       
+
        return retval;
 }
 
@@ -474,31 +474,31 @@ static void http_sendfile_success_report(http_sendfile_data_t *http_data, switch
                        char *code_as_string = switch_core_alloc(http_data->pool, 16);
                        memset(code_as_string, 0, 16);
                        switch_snprintf(code_as_string, 16, "%d", http_data->http_response_code);
-                       
+
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Command-Execution-Identifier", http_data->identifier_str);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Filename", http_data->filename_element);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "File-Access", "Success");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "REST-HTTP-Code", code_as_string);
                        switch_event_add_body(event, "%s", http_data->sendfile_response);
-                       
+
                        switch_event_fire(&event);
                        switch_event_destroy(&event);
                }
                else
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create a event to report on success of curl_sendfile.\n");
        }
-       
+
        if((switch_test_flag(http_data, CSO_STREAM) || switch_test_flag(http_data, CSO_NONE) || switch_test_flag(http_data, CSO_EVENT)) && http_data->stream)
        {
                if(http_data->http_response_code == 200)
                        http_data->stream->write_function(http_data->stream, "+200 Ok\n");
                else
                        http_data->stream->write_function(http_data->stream, "-%d Err\n", http_data->http_response_code);
-               
+
                if(http_data->sendfile_response_count && switch_test_flag(http_data, CSO_STREAM))
                        http_data->stream->write_function(http_data->stream, "%s\n", http_data->sendfile_response);
        }
-       
+
        if(switch_test_flag(http_data, CSO_NONE) && !http_data->stream)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Sending of file %s to url %s resulted with code %lu\n", http_data->filename_element, http_data->url, http_data->http_response_code);
 }
@@ -512,31 +512,31 @@ SWITCH_STANDARD_APP(http_sendfile_app_function)
        http_sendfile_data_t *http_data = NULL;
        switch_memory_pool_t *pool = switch_core_session_get_pool(session);
        switch_channel_t *channel = switch_core_session_get_channel(session);
-       
+
        assert(channel != NULL);
-       
+
        http_data = switch_core_alloc(pool, sizeof(http_sendfile_data_t));
        memset(http_data, 0, sizeof(http_sendfile_data_t));
-       
+
        http_data->pool = pool;
-       
+
        // Either the parameters are provided on the data="" or else they are provided as chanvars.  No mixing & matching
        if(!zstr(data))
        {
                http_data->mydata = switch_core_strdup(http_data->pool, data);
-               
-               if ((argc = switch_separate_string(http_data->mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) 
+
+               if ((argc = switch_separate_string(http_data->mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))))
                {
                        uint8_t i = 0;
-                       
+
                        if (argc < 2 || argc > 5)
                                goto http_sendfile_app_usage;
-                       
+
                        http_data->url = switch_core_strdup(http_data->pool, argv[i++]);
-                       
+
                        switch_url_decode(argv[i]);
                        argc2 = switch_separate_string(argv[i++], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])));
-                       
+
                        if(argc2 == 2)
                        {
                                http_data->filename_element_name = switch_core_strdup(pool, argv2[0]);
@@ -544,11 +544,11 @@ SWITCH_STANDARD_APP(http_sendfile_app_function)
                        }
                        else
                                goto http_sendfile_app_usage;
-                       
+
                        if(argc > 2)
                        {
                                http_data->extrapost_elements = switch_core_strdup(pool, argv[i++]);
-                               
+
                                if(argc > 3)
                                {
                                        if(!strncasecmp(argv[i++], "event", 5))
@@ -556,7 +556,7 @@ SWITCH_STANDARD_APP(http_sendfile_app_function)
                                                switch_set_flag(http_data, CSO_EVENT);
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting output to event handler.\n");
                                        }
-                                       
+
                                        if(argc > 4)
                                        {
                                                if(strncasecmp(argv[i], "uuid", 4))
@@ -572,16 +572,16 @@ SWITCH_STANDARD_APP(http_sendfile_app_function)
        {
                char *send_output = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_report", SWITCH_TRUE, -1);
                char *identifier = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_identifier", SWITCH_TRUE, -1);
-               
+
                http_data->url = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_url", SWITCH_TRUE, -1);
                http_data->filename_element_name = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_filename_element", SWITCH_TRUE, -1);
                http_data->filename_element = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_filename", SWITCH_TRUE, -1);
                http_data->extrapost_elements = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_extrapost", SWITCH_TRUE, -1);
-               
-               
+
+
                if(zstr(http_data->url) || zstr(http_data->filename_element) || zstr(http_data->filename_element_name))
                        goto http_sendfile_app_usage;
-               
+
                if(!zstr(send_output))
                {
                        if(!strncasecmp(send_output, "event", 5))
@@ -599,7 +599,7 @@ SWITCH_STANDARD_APP(http_sendfile_app_function)
                        switch_set_flag(http_data, CSO_NONE);
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No parameter specified for curl_sendfile_report.  Setting default of 'none'.\n");
                }
-               
+
                if(!zstr(identifier))
                {
                        if(!strncasecmp(identifier, "uuid", 4))
@@ -608,33 +608,33 @@ SWITCH_STANDARD_APP(http_sendfile_app_function)
                                http_data->identifier_str = identifier;
                }
        }
-       
+
        switch_url_decode(http_data->filename_element_name);
        switch_url_decode(http_data->filename_element);
-       
+
        // We need to check the file now...
        if(http_sendfile_test_file_open(http_data, event) != SWITCH_STATUS_SUCCESS)
                goto http_sendfile_app_done;
-       
+
        switch_file_close(http_data->file_handle);
-       
+
        switch_url_decode(http_data->url);
-       
+
        http_sendfile_initialize_curl(http_data);
-       
+
        http_sendfile_success_report(http_data, event);
-       
+
        goto http_sendfile_app_done;
-       
+
 http_sendfile_app_usage:
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure:  Usage: <data=\"%s\">\nOr you can set chanvars curl_senfile_url, curl_sendfile_filename_element, curl_sendfile_filename, curl_sendfile_extrapost\n", HTTP_SENDFILE_APP_SYNTAX);
-       
+
 http_sendfile_app_done:
        if (http_data->headers)
        {
                switch_curl_slist_free_all(http_data->headers);
        }
-       
+
        return;
 }
 
@@ -648,7 +648,7 @@ SWITCH_STANDARD_API(http_sendfile_function)
        http_sendfile_data_t *http_data = NULL;
        switch_memory_pool_t *pool = NULL;
        switch_event_t *event = NULL;
-       
+
        if(zstr(cmd))
        {
                status = SWITCH_STATUS_SUCCESS;
@@ -664,31 +664,31 @@ SWITCH_STANDARD_API(http_sendfile_function)
                switch_core_new_memory_pool(&pool);
                new_memory_pool = SWITCH_TRUE;  // So we can properly destroy the memory pool
        }
-       
+
        http_data = switch_core_alloc(pool, sizeof(http_sendfile_data_t));
        memset(http_data, 0, sizeof(http_sendfile_data_t));
-       
+
        http_data->mydata = switch_core_strdup(pool, cmd);
        http_data->stream = stream;
        http_data->pool = pool;
-       
-       // stream->write_function(stream,"\ncmd is %s\nmydata is %s\n", cmd, http_data->mydata); 
-       
-       if ((argc = switch_separate_string(http_data->mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) 
+
+       // stream->write_function(stream,"\ncmd is %s\nmydata is %s\n", cmd, http_data->mydata);
+
+       if ((argc = switch_separate_string(http_data->mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))))
        {
                uint8_t i = 0;
-               
+
                if (argc < 2 || argc > 5)
                {
                        status = SWITCH_STATUS_SUCCESS;
                        goto http_sendfile_usage;
                }
-               
+
                http_data->url = switch_core_strdup(pool, argv[i++]);
-               
+
                switch_url_decode(argv[i]);
                argc2 = switch_separate_string(argv[i++], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])));
-               
+
                if(argc2 == 2)
                {
                        http_data->filename_element_name = switch_core_strdup(pool, argv2[0]);
@@ -696,14 +696,14 @@ SWITCH_STANDARD_API(http_sendfile_function)
                }
                else
                        goto http_sendfile_usage;
-               
+
                switch_url_decode(http_data->filename_element_name);
                switch_url_decode(http_data->filename_element);
-               
+
                if(argc > 2)
                {
                        http_data->extrapost_elements = switch_core_strdup(pool, argv[i++]);
-                       
+
                        if(argc > 3)
                        {
                                if(!strncasecmp(argv[i], "event", 5))
@@ -719,31 +719,31 @@ SWITCH_STANDARD_API(http_sendfile_function)
                                {
                                        if(strncasecmp(argv[i], "none", 4))
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Invalid 4th parameter set for curl_sendfile.  Defaulting to \"none\"\n");
-                                       
+
                                        switch_set_flag(http_data, CSO_NONE);
                                }
-                               
+
                                i++;
-                               
+
                                if(argc > 4)
                                        http_data->identifier_str = switch_core_strdup(pool, argv[i++]);
                        }
                }
        }
-       
+
        // We need to check the file now...
        if(http_sendfile_test_file_open(http_data, event) != SWITCH_STATUS_SUCCESS)
                goto http_sendfile_done;
-       
-       
+
+
        switch_file_close(http_data->file_handle);
-       
+
        switch_url_decode(http_data->url);
-       
+
        http_sendfile_initialize_curl(http_data);
-       
+
        http_sendfile_success_report(http_data, event);
-       
+
        status = SWITCH_STATUS_SUCCESS;
        goto http_sendfile_done;
 
@@ -756,12 +756,12 @@ http_sendfile_done:
        {
                switch_curl_slist_free_all(http_data->headers);
        }
-       
+
        if (new_memory_pool == SWITCH_TRUE)
        {
                switch_core_destroy_memory_pool(&pool);
        }
-       
+
        return status;
 }
 
@@ -1030,7 +1030,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load)
        SWITCH_ADD_API(api_interface, "curl", "curl API", curl_function, SYNTAX);
        SWITCH_ADD_APP(app_interface, "curl", "Perform a http request", "Perform a http request",
                                   curl_app_function, SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
-       
+
        SWITCH_ADD_API(api_interface, "curl_sendfile", "curl_sendfile API", http_sendfile_function, HTTP_SENDFILE_SYNTAX);
        SWITCH_ADD_APP(app_interface, "curl_sendfile", "Send a file and some optional post variables via HTTP", "Send a file and some optional post variables via HTTP",
                                   http_sendfile_app_function, HTTP_SENDFILE_APP_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
@@ -1045,7 +1045,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_curl_shutdown)
 {
 
        switch_event_free_subclass(HTTP_SENDFILE_ACK_EVENT);
-       
+
        /* Cleanup dynamically allocated config settings */
        return SWITCH_STATUS_SUCCESS;
 }
index 42b826e9a8b624dcaf0dea9bd787da93983b4e12..c3a0376b3bcd7ba3514f46a5bd68e41ec9d1345b 100644 (file)
@@ -728,11 +728,11 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
 
         switch_img_to_raw(frame->img, context->rawImage->imageData, context->rawImage->widthStep, SWITCH_IMG_FMT_RGB24);
         detectAndDraw(context);
-               
+
                if (context->shape_idx && context->shape[0].w && context->last_shape[0].w) {
                        int max, min;
                        int pct;
-                       
+
                        if (context->shape[0].w > context->last_shape[0].w) {
                                max = context->shape[0].w;
                                min = context->last_shape[0].w;
@@ -742,7 +742,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
                        }
 
                        pct = 100 - (((double)min / (double)max) * 100.0f );
-                       
+
                        if (pct > 25) {
                                context->detected.simo_count = 0;
                                memset(context->last_shape, 0, sizeof(context->last_shape[0]) * MAX_SHAPES);
@@ -1331,7 +1331,7 @@ SWITCH_STANDARD_API(cv_bug_api_function)
                flags = SMBF_VIDEO_PATCH;
        }
 
-    if ((status = switch_core_media_bug_add(rsession, function, NULL, 
+    if ((status = switch_core_media_bug_add(rsession, function, NULL,
                                                                                        cv_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
         stream->write_function(stream, "-ERR Failure!\n");
         switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock);
@@ -1367,7 +1367,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cv_load)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_VIDEO_DETECT);
                return SWITCH_STATUS_TERM;
        }
-       
+
     *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
     MODULE_INTERFACE = *module_interface;
@@ -1390,7 +1390,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cv_shutdown)
 {
 
        switch_event_free_subclass(MY_EVENT_VIDEO_DETECT);
-       
+
        return SWITCH_STATUS_UNLOAD;
 }
 
index f5682000dfef0144e45e66a78b36b776af786eba..0e3e227de7c991eb9b07338e8fbd1bf9ceac7469 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice <krice@freeswitch.org>
  * Mathieu Rene <mathieu.rene@gmail.com>
@@ -89,7 +89,7 @@ switch_cache_db_handle_t *limit_get_db_handle(void)
 {
        switch_cache_db_handle_t *dbh = NULL;
        char *dsn;
-       
+
        if (!zstr(globals.odbc_dsn)) {
                dsn = globals.odbc_dsn;
        } else {
@@ -99,7 +99,7 @@ switch_cache_db_handle_t *limit_get_db_handle(void)
        if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) {
                dbh = NULL;
        }
-       
+
        return dbh;
 
 }
@@ -158,7 +158,7 @@ static char * limit_execute_sql2str(char *sql, char *str, size_t len)
        cbt.len = len;
 
        limit_execute_sql_callback(sql, sql2str_callback, &cbt);
-       
+
        return cbt.buf;
 }
 
@@ -229,7 +229,7 @@ SWITCH_LIMIT_RELEASE(limit_release_db)
        }
        limit_execute_sql(sql);
        switch_safe_free(sql);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -238,12 +238,12 @@ SWITCH_LIMIT_USAGE(limit_usage_db)
        char usagestr[128] = "";
        int usage = 0;
        char *sql = NULL;
-       
+
        sql = switch_mprintf("select count(hostname) from limit_data where realm='%q' and id='%q'", realm, resource);
        limit_execute_sql2str(sql, usagestr, sizeof(usagestr));
        switch_safe_free(sql);
        usage = atoi(usagestr);
-       
+
        return usage;
 }
 
@@ -253,7 +253,7 @@ SWITCH_LIMIT_RESET(limit_reset_db)
        sql = switch_mprintf("delete from limit_data where hostname='%q';", globals.hostname);
        limit_execute_sql(sql);
        switch_safe_free(sql);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -262,7 +262,7 @@ SWITCH_LIMIT_STATUS(limit_status_db)
        char count[128] = "";
        char *ret = NULL;
        char *sql = NULL;
-       
+
        sql = switch_mprintf("select count(hostname) from limit_data where hostname='%q'", globals.hostname);
        limit_execute_sql2str(sql, count, sizeof(count));
        switch_safe_free(sql);
@@ -686,7 +686,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_db_load)
 
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
-       
+
 }
 
 
index a214003cf77b7af7d3be5cdb3a0c7f3142f54476..61a05a93a5c2a153464b8ed9333a5598d4da340e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard at moctel dot com>
  * Emmanuel Schmidbauer <e.schmidbauer@gmail.com>
  *
@@ -194,7 +194,7 @@ switch_cache_db_handle_t *directory_get_db_handle(void)
 {
        switch_cache_db_handle_t *dbh = NULL;
        char *dsn;
-       
+
        if (!zstr(globals.odbc_dsn)) {
                dsn = globals.odbc_dsn;
        } else {
@@ -204,7 +204,7 @@ switch_cache_db_handle_t *directory_get_db_handle(void)
        if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) {
                dbh = NULL;
        }
-       
+
        return dbh;
 
 }
@@ -661,7 +661,7 @@ static switch_status_t populate_database(switch_core_session_t *session, dir_pro
                                                        sql = generate_sql_entry_for_user(session, ux, profile->use_number_alias);
                                                        switch_xml_free(ux);
                                                }
-                                               
+
                                        } else {
                                                sql = generate_sql_entry_for_user(session, ut, profile->use_number_alias);
                                        }
@@ -677,7 +677,7 @@ static switch_status_t populate_database(switch_core_session_t *session, dir_pro
                                                        sql = NULL;
                                                }
                                        }
-                                       
+
                                        if (++count >= 100) {
                                                count = 0;
                                                sql = switch_mprintf("BEGIN;%s;COMMIT;", sqlvalues);
@@ -1018,7 +1018,7 @@ SWITCH_STANDARD_APP(directory_function)
        switch_copy_string(s_param.profile, profile_name, 255);
        switch_copy_string(s_param.domain, domain_name, 255);
 
-       if (!(search_by = switch_channel_get_variable(channel, "directory_search_order"))) { 
+       if (!(search_by = switch_channel_get_variable(channel, "directory_search_order"))) {
                search_by = profile->search_order;
        }
 
index 95f322a042df2f0dd07c6fa7cd8676659798362b..5a717e91de5070a29b7726c015567eff39be2b63 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<include>  
+<include>
   <extension name="test gateway distro">
       <condition field="destination_number" expression="^(.*)$">
           <action application="bridge" data="sofia/gateway/${distributor(test)}/$1"/>
index b02b4386690254e2ad283bc3dea01634b035dcc4..cbdcc987ed59dada7245573efff58826d2ab4069 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  *
@@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_distributor_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_distributor_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_distributor_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_distributor, mod_distributor_load, mod_distributor_shutdown, NULL);
@@ -173,7 +173,7 @@ static int load_config(int reloading)
                        switch_zmalloc(node, sizeof(*node));
                        node->name = strdup(name_attr);
                        node->wval = tmp;
-                       
+
                        if (np) {
                                np->next = node;
                        } else {
@@ -228,7 +228,7 @@ static struct dist_node *find_next(struct dist_list *list, int etotal, char **ex
 
        for (;;) {
        top:
-               
+
                if (++loops > 1000) {
                        break;
                }
@@ -253,7 +253,7 @@ static struct dist_node *find_next(struct dist_list *list, int etotal, char **ex
 
                if (match) {
                        int i;
-                       
+
                        match->cur_weight++;
                        list->lastnode = match;
                        list->last = mx;
@@ -266,7 +266,7 @@ static struct dist_node *find_next(struct dist_list *list, int etotal, char **ex
                                        goto top;
                                }
                        }
-                       
+
 
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Choose %s\n", match->name);
                        return match;
@@ -279,7 +279,7 @@ static struct dist_node *find_next(struct dist_list *list, int etotal, char **ex
                }
 
        }
-       
+
        return NULL;
 }
 
@@ -294,7 +294,7 @@ static char *dist_engine(const char *name)
        int argc = 0;
        char *argv[100] = { 0 };
 
-       
+
        if ((except = strchr(myname, ' '))) {
                *except++ = '\0';
                argc = switch_split(except, ' ', argv);
@@ -443,7 +443,7 @@ SWITCH_STANDARD_API(distributor_ctl_function)
                                                        *e++ = '\0';
                                                        if ((np = find_node(list, argv[i]))) {
                                                                int tmp = -1;
-                                                               
+
                                                                if (e) {
                                                                        tmp = atoi(e);
                                                                }
@@ -476,7 +476,7 @@ SWITCH_STANDARD_API(distributor_ctl_function)
                        }
                }
        }
-       
+
  err:
 
        if (err) {
index f63b5b3330f621a172844730a6ded496aebe0c35..9e9f4465499a80c87ddf0ce60562ff4eb504985c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice <krice@freeswitch.org>
  * Michael Murdock <mike at mmurdock dot org>
@@ -129,7 +129,7 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t
 
        switch_channel_set_variable(channel, "last_non_matching_digits", match->match_digits);
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n",
                                          switch_channel_get_name(channel), match->match_digits);
 
        if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
@@ -137,14 +137,14 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t
 
                if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) {
                        switch_event_destroy(&event);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n",
                                                          switch_core_session_get_name(use_session));
                }
        }
 
        /* send it back around and skip the dmachine */
        switch_channel_queue_dtmf_string(channel, match->match_digits);
-       
+
        if (use_session != session) {
                switch_core_session_rwunlock(use_session);
        }
@@ -166,7 +166,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
        int x = 0;
        char *flags = "";
 
-       if (act->target == DIGIT_TARGET_PEER || act->target == DIGIT_TARGET_BOTH) {             
+       if (act->target == DIGIT_TARGET_PEER || act->target == DIGIT_TARGET_BOTH) {
                if (switch_core_session_get_partner(act->session, &use_session) != SWITCH_STATUS_SUCCESS) {
                        use_session = act->session;
                }
@@ -183,14 +183,14 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
 
        switch_channel_set_variable(channel, "last_matching_digits", match->match_digits);
 
-       
+
        if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n",
                                                  switch_channel_get_name(channel), act->string, act->value);
 
                if (!strncasecmp(string, "exec", 4)) {
                        char *e;
-                       
+
                        string += 4;
                        if (*string == ':') {
                                string++;
@@ -220,7 +220,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
 
                if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) {
                        switch_event_destroy(&event);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n",
                                                          switch_core_session_get_name(use_session));
                }
        }
@@ -244,7 +244,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
                switch_api_execute(string, act->value, NULL, &stream);
                if (stream.data) {
                        switch_channel_set_variable(channel, "bind_digit_action_api_result", (char *)stream.data);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s] api executed, %s\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s] api executed, %s\n",
                                switch_core_session_get_name(use_session), act->string, act->value, (char *)stream.data);
                } else {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s] api executed\n",
@@ -252,7 +252,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
                }
                switch_safe_free(stream.data);
        }
-       
+
 
        if (use_session != act->session) {
                switch_core_session_rwunlock(use_session);
@@ -275,7 +275,7 @@ static switch_digit_action_target_t str2target(const char *target_str)
        if (!strcasecmp(target_str, "both")) {
                return DIGIT_TARGET_BOTH;
        }
-       
+
        return DIGIT_TARGET_SELF;
 }
 
@@ -341,7 +341,7 @@ SWITCH_STANDARD_APP(digit_action_set_realm_function)
                return;
        }
 
-       
+
        if ((dmachine = switch_core_session_get_dmachine(session, target))) {
                switch_ivr_dmachine_set_realm(dmachine, realm);
        }
@@ -349,7 +349,7 @@ SWITCH_STANDARD_APP(digit_action_set_realm_function)
 }
 
 
-static void bind_to_session(switch_core_session_t *session, 
+static void bind_to_session(switch_core_session_t *session,
                                                        const char *arg0, const char *arg1, const char *arg2, const char *arg3,
                                                        switch_digit_action_target_t target, switch_digit_action_target_t bind_target)
 {
@@ -367,16 +367,16 @@ static void bind_to_session(switch_core_session_t *session,
                if ((var = switch_channel_get_variable(channel, "bind_digit_digit_timeout"))) {
                        digit_timeout = switch_atoul(var);
                }
-               
+
                if ((var = switch_channel_get_variable(channel, "bind_digit_input_timeout"))) {
                        input_timeout = switch_atoul(var);
                }
-               
+
                switch_ivr_dmachine_create(&dmachine, "DPTOOLS", NULL, digit_timeout, input_timeout, NULL, digit_nomatch_action_callback, session);
                switch_core_session_set_dmachine(session, dmachine, target);
        }
 
-       
+
        act = switch_core_session_alloc(session, sizeof(*act));
        act->realm = switch_core_session_strdup(session, arg0);
        act->input = switch_core_session_strdup(session, arg1);
@@ -404,7 +404,7 @@ static void bind_to_session(switch_core_session_t *session,
        }
 
        switch_ivr_dmachine_bind(dmachine, act->realm, act->input, is_priority, 0, digit_action_callback, act);
-       
+
        if ((terminators = switch_channel_get_variable(channel, "bda_terminators"))) {
                switch_ivr_dmachine_set_terminators(dmachine, terminators);
        }
@@ -617,7 +617,7 @@ SWITCH_STANDARD_APP(keepalive_function)
                        msg.message_id = SWITCH_MESSAGE_INDICATE_KEEPALIVE;
                        msg.numeric_arg = seconds;
                        switch_core_session_receive_message(session, &msg);
-                       
+
                        switch_core_session_enable_heartbeat(session, seconds);
                        return;
                }
@@ -660,7 +660,7 @@ SWITCH_STANDARD_APP(rename_function)
                switch_file_rename(argv[0], argv[1], switch_core_session_get_pool(session));
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RENAME: %s %s\n",
                                                  switch_channel_get_name(switch_core_session_get_channel(session)), argv[0], argv[1]);
-       
+
        } else {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", RENAME_SYNTAX);
        }
@@ -672,7 +672,7 @@ SWITCH_STANDARD_APP(transfer_vars_function)
        char *argv[1] = { 0 };
        int argc;
        char *lbuf = NULL;
-       
+
        if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
                && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
                switch_core_session_t *nsession = NULL;
@@ -922,7 +922,7 @@ SWITCH_STANDARD_APP(eavesdrop_function)
                                        switch_safe_free(e_data.uuid_list[x]);
                                }
                                e_data.total = 0;
-                               
+
                                if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Database Error!\n");
                                        break;
@@ -1056,7 +1056,7 @@ SWITCH_STANDARD_APP(ring_ready_function)
                        return;
                }
        }
-       
+
        switch_channel_ring_ready(switch_core_session_get_channel(session));
 }
 
@@ -1182,7 +1182,7 @@ SWITCH_STANDARD_APP(sched_transfer_function)
 
                        id = switch_ivr_schedule_transfer(when, switch_core_session_get_uuid(session), argv[1], argv[2], argv[3]);
                        snprintf(ids, sizeof(ids), "%u", id);
-                       switch_channel_set_variable(switch_core_session_get_channel(session), "last_sched_id", ids);                    
+                       switch_channel_set_variable(switch_core_session_get_channel(session), "last_sched_id", ids);
                } else {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Args\n");
                }
@@ -1377,7 +1377,7 @@ SWITCH_STANDARD_APP(pre_answer_function)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
        const char *arg = (char *) data;
-       
+
        if (!zstr(arg)) {
                if (switch_stristr("is_conference", arg)) {
                        switch_channel_set_flag(channel, CF_CONFERENCE);
@@ -1559,9 +1559,9 @@ static void base_set (switch_core_session_t *session, const char *data, switch_s
                        expanded = switch_channel_expand_variables(channel, val);
                }
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s [%s]=[%s]\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s [%s]=[%s]\n",
                                                  what, switch_channel_get_name(channel), var, expanded ? expanded : "UNDEF");
-                                                 
+
                switch_channel_add_variable_var_check(channel, var, expanded, SWITCH_FALSE, stack);
 
                if (expanded && expanded != val) {
@@ -1586,11 +1586,11 @@ SWITCH_STANDARD_APP(multiset_function)
 
                arg = switch_core_session_strdup(session, arg);
                argc = switch_split(arg, delim, array);
-               
+
                for(i = 0; i < argc; i++) {
                        base_set(session, array[i], SWITCH_STACK_BOTTOM);
                }
-               
+
 
        } else {
                base_set(session, data, SWITCH_STACK_BOTTOM);
@@ -1933,7 +1933,7 @@ SWITCH_STANDARD_API(strftime_api_function)
 
        if (!zstr(q) && (p = strchr(q, '|'))) {
                *p++ = '\0';
-               
+
                thetime = switch_time_make(atol(q), 0);
                q = p + 1;
        } else {
@@ -2226,7 +2226,7 @@ SWITCH_STANDARD_APP(park_state_function)
 /********************************************************************************/
 
 /*
-  dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+  dtmf handler function you can hook up to be executed when a digit is dialed during playback
    if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
 */
 static switch_status_t bridge_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
@@ -2451,7 +2451,7 @@ static switch_status_t tmp_hanguphook(switch_core_session_t *session)
 
                if (!zstr(bond)) {
                        switch_core_session_t *b_session;
-                       
+
                        if ((b_session = switch_core_session_locate(bond))) {
                                switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
                                if (switch_channel_up(b_channel)) {
@@ -2710,7 +2710,7 @@ SWITCH_STANDARD_APP(read_function)
                valid_terminators = "#";
        }
 
-       switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators, 
+       switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators,
                                        digit_timeout);
 }
 
@@ -2799,7 +2799,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function)
        }
 
        switch_play_and_get_digits(session, min_digits, max_digits, max_tries, timeout, valid_terminators,
-                                                          prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), 
+                                                          prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer),
                                                           digits_regex, digit_timeout, transfer_on_failure);
 }
 
@@ -3066,7 +3066,7 @@ SWITCH_STANDARD_APP(capture_function)
        int ovector[30] = {0};
        char *lbuf;
        int proceed;
-       
+
        if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
                && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) == 3) {
                if ((proceed = switch_regex_perform(argv[1], argv[2], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
@@ -3075,7 +3075,7 @@ SWITCH_STANDARD_APP(capture_function)
                switch_regex_safe_free(re);
        } else {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No data specified.\n");
-       }       
+       }
 }
 
 SWITCH_STANDARD_APP(record_function)
@@ -3164,7 +3164,7 @@ SWITCH_STANDARD_APP(record_session_function)
 
        path = switch_core_session_strdup(session, data);
 
-       /* Search for a space then a plus followed by only numbers at the end of the path, 
+       /* Search for a space then a plus followed by only numbers at the end of the path,
           if found trim any spaces to the left/right of the plus use the left side as the
           path and right side as a time limit on the recording
         */
@@ -3385,7 +3385,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
                        moh = switch_channel_get_hold_music(caller_channel);
                }
 
-               if (!zstr(moh) && !strcasecmp(moh, "silence")) { 
+               if (!zstr(moh) && !strcasecmp(moh, "silence")) {
                        moh = NULL;
                }
 
@@ -3427,7 +3427,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
 
                                        if (fail) {
                                                int64_t wait = (int64_t)campon_sleep * 1000000;
-                                               
+
                                                while (stake.running && wait > 0 && switch_channel_ready(caller_channel)) {
                                                        switch_yield(100000);
                                                        wait -= 100000;
@@ -3436,8 +3436,8 @@ SWITCH_STANDARD_APP(audio_bridge_function)
                                }
                        }
 
-                       status = switch_ivr_originate(NULL, &peer_session, 
-                                                                                 &cause, camp_data, campon_timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE, 
+                       status = switch_ivr_originate(NULL, &peer_session,
+                                                                                 &cause, camp_data, campon_timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE,
                                                                                  switch_channel_get_cause_ptr(caller_channel));
 
 
@@ -3564,19 +3564,19 @@ static void pickup_send_presence(const char *key_name)
        switch_event_t *event;
        int count;
 
-       
+
        dup_key_name = strdup(key_name);
        key_name = dup_key_name;
 
        if ((domain_name = strchr(dup_key_name, '@'))) {
                *domain_name++ = '\0';
        }
-       
+
        if (zstr(domain_name)) {
                dup_domain_name = switch_core_get_domain(SWITCH_TRUE);
                domain_name = dup_domain_name;
        }
-       
+
        if (zstr(domain_name)) {
                domain_name = "cluecon.com";
        }
@@ -3591,7 +3591,7 @@ static void pickup_send_presence(const char *key_name)
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", dup_id);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", dup_id);
 
-                       
+
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d call%s)", count, count == 1 ? "" : "s");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -3609,7 +3609,7 @@ static void pickup_send_presence(const char *key_name)
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", dup_id);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", dup_id);
 
-                       
+
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Idle");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -3620,13 +3620,13 @@ static void pickup_send_presence(const char *key_name)
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound");
                        switch_event_fire(&event);
-               }               
+               }
        }
-       
+
        switch_safe_free(dup_domain_name);
        switch_safe_free(dup_key_name);
        switch_safe_free(dup_id);
-                                               
+
 }
 
 static void pickup_pres_event_handler(switch_event_t *event)
@@ -3667,7 +3667,7 @@ static void pickup_pres_event_handler(switch_event_t *event)
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO);
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", key_name);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", key_name, domain_name);
-                       
+
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d call%s)", count, count == 1 ? "" : "s");
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active");
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -3681,7 +3681,7 @@ static void pickup_pres_event_handler(switch_event_t *event)
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO);
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", key_name);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", key_name, domain_name);
-                       
+
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Idle");
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -3751,7 +3751,7 @@ static char *pickup_pop_uuid(const char *key, const char *uuid)
        if ((head = switch_core_hash_find(globals.pickup_hash, key))) {
 
                switch_core_hash_delete(globals.pickup_hash, key);
-               
+
                if (uuid) {
                        pickup_node_t *np, *lp = NULL;
 
@@ -3762,14 +3762,14 @@ static char *pickup_pop_uuid(const char *key, const char *uuid)
                                        } else {
                                                head = np->next;
                                        }
-                                       
+
                                        node = np;
                                        break;
                                }
 
                                lp = np;
                        }
-                       
+
                } else {
                        node = head;
                        head = head->next;
@@ -3786,13 +3786,13 @@ static char *pickup_pop_uuid(const char *key, const char *uuid)
                free(node->key);
                free(node);
        }
-       
+
        switch_mutex_unlock(globals.pickup_mutex);
 
        if (r) pickup_send_presence(key);
 
        switch_safe_free(dup_key);
-       
+
        return r;
 }
 
@@ -3829,7 +3829,7 @@ static switch_status_t pickup_event_handler(switch_core_session_t *session)
                return SWITCH_STATUS_FALSE;
        case CS_HANGUP:
                {
-                       
+
                        if (switch_channel_test_flag(channel, CF_CHANNEL_SWAP)) {
                                const char *key = switch_channel_get_variable(channel, "channel_swap_uuid");
                                switch_core_session_t *swap_session;
@@ -3903,7 +3903,7 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio
 
 
        switch_core_session_set_private(nsession, tech_pvt);
-       
+
        nchannel = switch_core_session_get_channel(nsession);
        switch_channel_set_cap(nchannel, CC_PROXY_MEDIA);
        switch_channel_set_cap(nchannel, CC_BYPASS_MEDIA);
@@ -3912,7 +3912,7 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio
        switch_channel_set_caller_profile(nchannel, caller_profile);
 
        switch_channel_set_state(nchannel, CS_ROUTING);
-       
+
 
 
        *new_session = nsession;
@@ -3963,7 +3963,7 @@ SWITCH_STANDARD_APP(pickup_function)
        if ((uuid = pickup_pop_uuid((char *)data, NULL))) {
                if ((pickup_session = switch_core_session_locate(uuid))) {
                        switch_channel_t *pickup_channel = switch_core_session_get_channel(pickup_session);
-                       switch_caller_profile_t *pickup_caller_profile = switch_channel_get_caller_profile(pickup_channel), 
+                       switch_caller_profile_t *pickup_caller_profile = switch_channel_get_caller_profile(pickup_channel),
                                *caller_profile = switch_channel_get_caller_profile(channel);
                        const char *name, *num;
                        switch_event_t *event;
@@ -3974,10 +3974,10 @@ SWITCH_STANDARD_APP(pickup_function)
                                switch_channel_set_variable(channel, hp->name, hp->value);
                        }
 
-                       
+
                        switch_channel_set_flag(pickup_channel, CF_CHANNEL_SWAP);
                        switch_channel_set_variable(pickup_channel, "channel_swap_uuid", switch_core_session_get_uuid(session));
-                       
+
                        name = caller_profile->caller_id_name;
                        num = caller_profile->caller_id_number;
 
@@ -3986,11 +3986,11 @@ SWITCH_STANDARD_APP(pickup_function)
 
                        caller_profile->callee_id_name = name;
                        caller_profile->callee_id_number = num;
-                       
+
                        if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
                                const char *partner_uuid = switch_channel_get_partner_uuid(channel);
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV");
-                               
+
                                if (partner_uuid) {
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", partner_uuid);
                                }
@@ -4221,7 +4221,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
                }
                var_event = NULL;
        }
-       
+
        if (switch_xml_locate_user_merged("id", user, domain, NULL, &x_user, params) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", user, domain);
                cause = SWITCH_CAUSE_SUBSCRIBER_ABSENT;
@@ -4345,7 +4345,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
                        switch_safe_free(d_dest);
                }
        }
-       
+
        if (new_channel && x_user) {
                if ((x_params = switch_xml_child(x_user, "variables"))) {
                        for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
@@ -4493,7 +4493,7 @@ SWITCH_STANDARD_APP(detect_silence_function)
 }
 
 static switch_status_t event_chat_send(switch_event_t *message_event)
-                                                                          
+
 {
        switch_event_t *event;
        const char *to;
@@ -4512,7 +4512,7 @@ static switch_status_t event_chat_send(switch_event_t *message_event)
        if (switch_event_fire(&event) == SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        switch_event_destroy(&event);
 
        return SWITCH_STATUS_MEMERR;
@@ -4521,7 +4521,7 @@ static switch_status_t event_chat_send(switch_event_t *message_event)
 static switch_status_t api_chat_send(switch_event_t *message_event)
 {
        const char *proto;
-       const char *from; 
+       const char *from;
        const char *to;
        //const char *subject;
        //const char *body;
@@ -4534,7 +4534,7 @@ static switch_status_t api_chat_send(switch_event_t *message_event)
        //subject = switch_event_get_header(message_event, "subject");
        //body = switch_event_get_body(message_event);
        type = switch_event_get_header(message_event, "type");
-       hint = switch_event_get_header(message_event, "hint");  
+       hint = switch_event_get_header(message_event, "hint");
 
 
        if (to) {
@@ -4610,7 +4610,7 @@ SWITCH_STANDARD_APP(limit_function)
                mydata = switch_core_session_strdup(session, data);
                argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
        }
-       
+
        backend = argv[0];
 
        /* must have at least one item */
@@ -4618,10 +4618,10 @@ SWITCH_STANDARD_APP(limit_function)
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "USAGE: limit %s\n", LIMIT_USAGE);
                return;
        }
-       
+
        /* if this is an invalid backend, fallback to db backend */
        /* TODO: remove this when we can! */
-       if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) && 
+       if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) &&
                        !switch_loadable_module_get_limit_interface(backend)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown backend '%s'.  To maintain backwards compatability, falling back on db backend and shifting argumens. Either update your diaplan to include the backend, fix the typo, or load the appropriate limit implementation module.\n", backend);
                mydata = switch_core_session_sprintf(session, "db %s", data);
@@ -4709,9 +4709,9 @@ SWITCH_STANDARD_APP(limit_execute_function)
                mydata = switch_core_session_strdup(session, data);
                argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
        }
-       
+
        /* backwards compat version, if we have 5, just prepend with db and reparse */
-       if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) && 
+       if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) &&
                        argc == 5) {
                mydata = switch_core_session_sprintf(session, "db %s", data);
                argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -4758,7 +4758,7 @@ SWITCH_STANDARD_APP(limit_execute_function)
                /* Only release the resource if we are still in CS_EXECUTE */
                if (switch_channel_get_state(switch_core_session_get_channel(session)) == CS_EXECUTE) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "immediately releasing\n");
-                       switch_limit_release(backend, session, realm, id);                      
+                       switch_limit_release(backend, session, realm, id);
                }
        }
 }
@@ -4902,12 +4902,12 @@ static switch_status_t next_file(switch_file_handle_t *handle)
                }
 
                if (context->file && switch_test_flag(handle, SWITCH_FILE_DATA_SHORT)) { /* TODO handle other data type flags */
-                       switch_size_t len;                      
+                       switch_size_t len;
                        uint16_t buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
                        switch_status_t stat;
                        switch_file_handle_t fh = { 0 };
 
-                       if ((stat = switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate, 
+                       if ((stat = switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate,
                                                                                                SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL)) == SWITCH_STATUS_SUCCESS) {
                                        do {
                                                len = SWITCH_RECOMMENDED_BUFFER_SIZE / handle->channels;
@@ -4916,7 +4916,7 @@ static switch_status_t next_file(switch_file_handle_t *handle)
                                                }
                                        } while (stat == SWITCH_STATUS_SUCCESS);
 
-                                       switch_core_file_close(&fh);                            
+                                       switch_core_file_close(&fh);
                                        switch_file_remove(context->file, handle->memory_pool);
 
                        } else {
@@ -4962,7 +4962,7 @@ static switch_status_t file_string_file_seek(switch_file_handle_t *handle, unsig
                context->index = -1;
                return next_file(handle);
        }
-       
+
        if (!handle->seekable) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n");
                return SWITCH_STATUS_NOTIMPL;
@@ -5004,7 +5004,7 @@ static switch_status_t file_string_file_set_string(switch_file_handle_t *handle,
        file_string_context_t *context = handle->private_info;
        file_string_audio_col_t *col_ptr = context->audio_cols;
 
-       while (col_ptr && col != col_ptr->col) { 
+       while (col_ptr && col != col_ptr->col) {
                col_ptr = col_ptr->next;
        }
 
@@ -5017,7 +5017,7 @@ static switch_status_t file_string_file_set_string(switch_file_handle_t *handle,
                col_ptr->next = context->audio_cols;
                context->audio_cols = col_ptr;
        }
-       
+
        return switch_core_file_set_string(&context->fh, col, string);
 }
 
@@ -5232,7 +5232,7 @@ static switch_status_t read_frame_callback(switch_core_session_t *session, switc
        }
 
        return switch_channel_test_app_flag_key(rf->key, channel, MUTEX_FLAG_WAIT) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
-       
+
 }
 
 static void free_node(mutex_node_t **npp)
@@ -5256,7 +5256,7 @@ static void cancel(switch_core_session_t *session, master_mutex_t *master)
        for (np = master->list; np; np = np->next) {
                if (np && !strcmp(np->uuid, uuid)) {
                        switch_core_event_hook_remove_state_change(session, mutex_hanguphook);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s canceled\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s canceled\n",
                                                          switch_core_session_get_uuid(session),
                                                          switch_core_session_get_name(session), master->key);
 
@@ -5269,7 +5269,7 @@ static void cancel(switch_core_session_t *session, master_mutex_t *master)
                        }
 
                        free_node(&np);
-                       
+
                        break;
                }
 
@@ -5288,7 +5288,7 @@ static void advance(master_mutex_t *master, switch_bool_t pop_current)
        if (!master || !master->list) {
                goto end;
        }
-       
+
        while (master->list) {
                mutex_node_t *np;
 
@@ -5302,14 +5302,14 @@ static void advance(master_mutex_t *master, switch_bool_t pop_current)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ADVANCE POP %p\n", (void *)np);
                        free_node(&np);
                }
-       
+
 
                if (master->list) {
                        switch_core_session_t *session;
 
                        if ((session = switch_core_session_locate(master->list->uuid))) {
                                switch_channel_t *channel = switch_core_session_get_channel(session);
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                  "%s mutex %s advanced\n", switch_channel_get_name(channel), master->key);
                                switch_channel_set_app_flag_key(master->key, channel, MUTEX_FLAG_SET);
                                switch_channel_clear_app_flag_key(master->key, channel, MUTEX_FLAG_WAIT);
@@ -5327,7 +5327,7 @@ static void advance(master_mutex_t *master, switch_bool_t pop_current)
 
        switch_mutex_unlock(globals.mutex_mutex);
 
-       
+
 }
 
 static void confirm(switch_core_session_t *session, master_mutex_t *master)
@@ -5346,7 +5346,7 @@ static void confirm(switch_core_session_t *session, master_mutex_t *master)
                if (!strcmp(master->list->uuid, switch_core_session_get_uuid(session))) {
                        switch_channel_clear_app_flag_key(master->key, channel, MUTEX_FLAG_SET);
                        switch_core_event_hook_remove_state_change(session, mutex_hanguphook);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s cleared\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s cleared\n",
                                                          switch_core_session_get_uuid(session),
                                                          switch_channel_get_name(channel), master->key);
                        advance(master, SWITCH_TRUE);
@@ -5396,7 +5396,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
                switch_mutex_unlock(globals.mutex_mutex);
                return SWITCH_FALSE;
        }
-       
+
        if (!(master = switch_core_hash_find(globals.mutex_hash, key))) {
                master = switch_core_alloc(globals.pool, sizeof(*master));
                master->key = switch_core_strdup(globals.pool, key);
@@ -5406,7 +5406,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
        } else {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "EXIST MASTER %s %p\n", key, (void *) master);
        }
-               
+
        if (on) {
 
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "HIT ON\n");
@@ -5430,7 +5430,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
                        switch_channel_clear_app_flag_key(key, channel, MUTEX_FLAG_WAIT);
                        switch_channel_set_private(channel, "_mutex_master", master);
                        switch_core_event_hook_add_state_change(session, mutex_hanguphook);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n",
                                                          switch_core_session_get_uuid(session),
                                                          switch_channel_get_name(channel), key);
                        switch_mutex_unlock(globals.mutex_mutex);
@@ -5444,7 +5444,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
        }
 
        switch_mutex_unlock(globals.mutex_mutex);
-       
+
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s mutex %s is busy, waiting...\n", switch_channel_get_name(channel), key);
 
        if ((feedback = switch_channel_get_variable(channel, "mutex_feedback"))) {
@@ -5456,19 +5456,19 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
        if ((rf.exten = switch_channel_get_variable(channel, "mutex_orbit_exten"))) {
                to_val = 60;
        }
-       
+
        if ((var = switch_channel_get_variable(channel, "mutex_timeout"))) {
                long tmp = atol(var);
-               
+
                if (tmp > 0) {
                        to_val = tmp;
                }
        }
-       
+
        if (to_val) {
                switch_codec_implementation_t read_impl;
                switch_core_session_get_read_impl(session, &read_impl);
-               
+
                rf.to = (1000 / (read_impl.microseconds_per_packet / 1000)) * to_val;
                rf.dp = switch_channel_get_variable(channel, "mutex_orbit_dialplan");
                rf.context = switch_channel_get_variable(channel, "mutex_orbit_context");
@@ -5500,7 +5500,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s
        if (switch_channel_test_app_flag_key(key, channel, MUTEX_FLAG_WAIT) || !switch_channel_up(channel)) {
                cancel(session, master);
        } else {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n",
                                                  switch_core_session_get_uuid(session),
                                                  switch_channel_get_name(channel), key);
                switch_core_event_hook_add_state_change(session, mutex_hanguphook);
@@ -5534,7 +5534,7 @@ SWITCH_STANDARD_APP(mutex_function)
        }
 
        do_mutex(session, key, on);
-       
+
 
 }
 
@@ -5587,7 +5587,7 @@ void *SWITCH_THREAD_FUNC page_thread(switch_thread_t *thread, void *obj)
 
        if (switch_ivr_originate(NULL, &session, &cause, pd->dial_str, 60, NULL, NULL, NULL, NULL, pd->var_event, SOF_NONE, NULL) == SWITCH_STATUS_SUCCESS) {
                switch_channel_t *channel = switch_core_session_get_channel(session);
-               
+
                switch_channel_set_variable(channel, "page_file", pd->path);
 
                mypd = switch_core_session_alloc(session, sizeof(*mypd));
@@ -5613,14 +5613,14 @@ void *SWITCH_THREAD_FUNC page_thread(switch_thread_t *thread, void *obj)
        return NULL;
 }
 
-static void launch_call(const char *dial_str, 
-                                               const char *path, const char *exten, const char *context, const char *dp, 
+static void launch_call(const char *dial_str,
+                                               const char *path, const char *exten, const char *context, const char *dp,
                                                switch_mutex_t *mutex, uint32_t *counter, switch_event_t **var_event)
 {
        switch_thread_data_t *td;
        switch_memory_pool_t *pool;
        page_data_t *pd;
-       
+
        switch_core_new_memory_pool(&pool);
 
        pd = switch_core_alloc(pool, sizeof(*pd));
@@ -5648,7 +5648,7 @@ static void launch_call(const char *dial_str,
        td->obj = pd;
 
        switch_thread_pool_launch_thread(&td);
-       
+
 }
 
 typedef struct call_monitor_s {
@@ -5689,7 +5689,7 @@ void *SWITCH_THREAD_FUNC call_monitor_thread(switch_thread_t *thread, void *obj)
        while (data && *data && *data == ' ') {
                data++;
        }
-       
+
        while (*data == '<') {
                char *parsed = NULL;
 
@@ -5716,15 +5716,15 @@ void *SWITCH_THREAD_FUNC call_monitor_thread(switch_thread_t *thread, void *obj)
        }
 
        while (sent < size) {
-               do {                            
-                       switch_mutex_lock(mutex);                               
+               do {
+                       switch_mutex_lock(mutex);
                        busy = (counter >= cm->chunk_size);
                        switch_mutex_unlock(mutex);
-                       
-                       if (busy) {                                     
+
+                       if (busy) {
                                switch_yield(100000);
-                       }                                                                                               
-                       
+                       }
+
                } while (busy);
 
                launch_call(argv[sent++], cm->path, cm->exten, cm->context, cm->dp, mutex, &counter, &var_event);
@@ -5755,7 +5755,7 @@ static void launch_call_monitor(const char *path, int del, const char *data, uin
        switch_thread_data_t *td;
        switch_memory_pool_t *pool;
        call_monitor_t *cm;
-       
+
        switch_core_new_memory_pool(&pool);
 
        cm = switch_core_alloc(pool, sizeof(*cm));
@@ -5777,7 +5777,7 @@ static void launch_call_monitor(const char *path, int del, const char *data, uin
        td->obj = cm;
 
        switch_thread_pool_launch_thread(&td);
-       
+
 }
 
 
@@ -5814,10 +5814,10 @@ SWITCH_STANDARD_APP(page_function)
        if ((l = switch_channel_get_variable(channel, "page_dp"))) {
                dp = l;
        }
-       
+
 
        l = switch_channel_get_variable(channel, "page_record_limit");
-       
+
        if (l) {
                if (*l == '+') {
                        l++;
@@ -5866,7 +5866,7 @@ SWITCH_STANDARD_APP(page_function)
                }
 
                switch_ivr_play_file(session, NULL, beep, NULL);
-               
+
 
                switch_ivr_record_file(session, &fh, path, &args, limit);
        }
@@ -5874,7 +5874,7 @@ SWITCH_STANDARD_APP(page_function)
        if (zstr(exten)) {
                exten = switch_core_session_sprintf(session, "playback:%s", path);
        }
-       
+
        if (switch_file_exists(path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
                launch_call_monitor(path, del, pdata, chunk_size, exten, context, dp);
        } else {
@@ -5909,7 +5909,7 @@ SWITCH_STANDARD_API(page_api_function)
        while (data && *data && *data == ' ') {
                data++;
        }
-       
+
        while (*data == '(') {
                char *parsed = NULL;
 
@@ -5928,7 +5928,7 @@ SWITCH_STANDARD_API(page_api_function)
        if (!var_event) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
                goto end;
-       }          
+       }
 
        pdata = data;
 
@@ -5948,7 +5948,7 @@ SWITCH_STANDARD_API(page_api_function)
        if ((l = switch_event_get_header(var_event, "page_dp"))) {
                dp = l;
        }
-       
+
 
        if ((l = switch_event_get_header(var_event, "page_chunk_size"))) {
                uint32_t tmp = switch_atoui(l);
@@ -5967,7 +5967,7 @@ SWITCH_STANDARD_API(page_api_function)
                oexten = switch_mprintf("playback:%s", path);
                exten = oexten;
        }
-       
+
        if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
                launch_call_monitor(path, 0, pdata, chunk_size, exten, context, dp);
        } else {
@@ -5976,7 +5976,7 @@ SWITCH_STANDARD_API(page_api_function)
 
 
  end:
-       
+
 
        switch_safe_free(odata);
        switch_safe_free(oexten);
@@ -6217,16 +6217,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
 
        SWITCH_ADD_APP(app_interface, "blind_transfer_ack", "", "", blind_transfer_ack_function, "[true|false]", SAF_NONE);
 
-       SWITCH_ADD_APP(app_interface, "bind_digit_action", "bind a key sequence or regex to an action", 
+       SWITCH_ADD_APP(app_interface, "bind_digit_action", "bind a key sequence or regex to an action",
                                   "bind a key sequence or regex to an action", bind_digit_action_function, BIND_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA);
 
-       SWITCH_ADD_APP(app_interface, "capture", "capture data into a var", "capture data into a var", 
+       SWITCH_ADD_APP(app_interface, "capture", "capture data into a var", "capture data into a var",
                                   capture_function, "<varname>|<data>|<regex>", SAF_SUPPORT_NOMEDIA);
 
-       SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "", 
+       SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "",
                                   clear_digit_action_function, CLEAR_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA);
 
-       SWITCH_ADD_APP(app_interface, "digit_action_set_realm", "change binding realm", "", 
+       SWITCH_ADD_APP(app_interface, "digit_action_set_realm", "change binding realm", "",
                                   digit_action_set_realm_function, DIGIT_ACTION_SET_REALM_USAGE, SAF_SUPPORT_NOMEDIA);
 
        SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number",
@@ -6258,7 +6258,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
        SWITCH_ADD_APP(app_interface, "eval", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
        SWITCH_ADD_APP(app_interface, "set_media_stats", "Set Media Stats", "Set Media Stats", set_media_stats_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
        SWITCH_ADD_APP(app_interface, "stop", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
-       SWITCH_ADD_APP(app_interface, "set_zombie_exec", "Enable Zombie Execution", "Enable Zombie Execution", 
+       SWITCH_ADD_APP(app_interface, "set_zombie_exec", "Enable Zombie Execution", "Enable Zombie Execution",
                                   zombie_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
        SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
@@ -6311,7 +6311,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
        SWITCH_ADD_APP(app_interface, "video_decode", "Set video decode.", "Set video decode.", video_set_decode_function, "[[on|wait]|off]",
                                   SAF_NONE);
        SWITCH_ADD_APP(app_interface, "send_info", "Send info", "Send info", send_info_function, "<info>", SAF_SUPPORT_NOMEDIA);
-       SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.", 
+       SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.",
                                   jitterbuffer_function, "<jitterbuffer_data>", SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>",
                                   SAF_SUPPORT_NOMEDIA);
@@ -6377,10 +6377,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
        SWITCH_ADD_APP(app_interface, "loop_playback", "Playback File looply", "Playback a file to the channel looply for limted times",
                                   loop_playback_function, "[+loops] <path>", SAF_NONE);
        SWITCH_ADD_APP(app_interface, "att_xfer", "Attended Transfer", "Attended Transfer", att_xfer_function, "<channel_url>", SAF_NONE);
-       SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, 
+       SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function,
                                   "<min> <max> <file> <var_name> <timeout> <terminators> <digit_timeout>", SAF_NONE);
        SWITCH_ADD_APP(app_interface, "play_and_get_digits", "Play and get Digits", "Play and get Digits",
-                                  play_and_get_digits_function, 
+                                  play_and_get_digits_function,
                                   "\n\t<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp> [<digit_timeout>] ['<failure_ext> [failure_dp [failure_context]]']", SAF_NONE);
 
        SWITCH_ADD_APP(app_interface, "stop_video_write_overlay", "Stop video write overlay", "Stop video write overlay", stop_video_write_overlay_session_function, "<path>", SAF_NONE);
index 350a50989b0443cf9d60eb7eefba28788b746a62..2ae834be707ae35ad2b940459302569bfe3db296 100644 (file)
@@ -7,7 +7,7 @@
 
     <!-- Default Technology and profile -->
     <param name="default-techprofile" value="sofia/default"/>
-    
+
     <!-- IP or Hostname of Default Route -->
     <param name="default-gateway" value="192.168.66.6"/>
 
@@ -21,7 +21,7 @@
         call_limit varchar(16) - contains optional call limit
         tech_prefix varchar(128) - tech prefix used to build dial string (ex: sofia/default )
         acctcode varchar(128) - used to set channel variable acctcode for logging into the CDRs
-        destination_number varchar(16) - Number returning for the query for building the dial string. (ex: 18005551212) 
+        destination_number varchar(16) - Number returning for the query for building the dial string. (ex: 18005551212)
         See Documentation on the Wiki for further information -->
     <!-- <param name="custom-query" value="call  FS_GET_SIP_LOCATION(%s);"/> -->
   </settings>
index 980e845e50071e6cf210ca61d2de04c7eeb080d9..18f634e393fc2e49c9736d81fd0d3b8f833d812f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
index 8d74ba0033d5bd0fb742fc4f83c9401bf95a32b9..a00095e531515836123a7de4b9b1abce1ccb894d 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Jay Binks <jaybinks@gmail.com>
  *
@@ -117,7 +117,7 @@ static switch_status_t load_config(void)
        globals.timeout = 5000;
        globals.retries = 3;
        globals.random  = 0;
-       
+
        if ((settings = switch_xml_child(cfg, "settings"))) {
                for (param = switch_xml_child(settings, "param"); param; param = param->next) {
                        const char *var = switch_xml_attr_soft(param, "name");
@@ -165,8 +165,8 @@ static switch_status_t load_config(void)
                HKEY hKey;
                DWORD data_sz;
                char* buf;
-               RegOpenKeyEx(HKEY_LOCAL_MACHINE, 
-                       "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 
+               RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                       "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
                        0, KEY_QUERY_VALUE, &hKey);
 
                if (hKey) {
@@ -249,7 +249,7 @@ static void add_result(enum_record_t **results, int order, int preference, char
        new_result->service = strdup(service);
        new_result->route = strdup(route);
        new_result->supported = supported;
-       
+
 
        if (!*results) {
                *results = new_result;
@@ -310,7 +310,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t
        char *packstr;
 
        char *regex, *replace;
-       
+
        if (zstr(str)) {
                if (str != NULL) {
                        /* In this case ldns_rr2str returned a malloc'd null terminated string */
@@ -339,7 +339,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t
        if (zstr(service) || zstr(packstr)) {
                goto end;
        }
-       
+
        if (!zstr(argv[4])) {
                order = atoi(argv[4]);
        }
@@ -355,7 +355,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t
        } else {
                goto end;
        }
-       
+
        for (p = replace; p && *p; p++) {
                if (*p == '\\') {
                        *p = '$';
@@ -388,11 +388,11 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t
                        } else {
                                orig_uri = replace;
                        }
-                       
+
                        switch_mutex_lock(MUTEX);
                        for (route = globals.route_order; route; route = route->next) {
                                char *uri = orig_uri;
-                               
+
                                if (strcasecmp(service, route->service)) {
                                        continue;
                                }
@@ -429,13 +429,13 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t
 
                                        supported++;
                                        add_result(results, order, preference, service, uri, supported);
-                                       
+
                                }
                                switch_safe_free(uri_expanded);
                                switch_safe_free(substituted_2);
                                switch_regex_safe_free(re2);
                        }
-                       switch_mutex_unlock(MUTEX);                     
+                       switch_mutex_unlock(MUTEX);
 
                        if (!supported) {
                                add_result(results, order, preference, service, orig_uri, 0);
@@ -449,7 +449,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t
  end:
 
        switch_safe_free(str);
-       
+
        return;
 }
 
@@ -471,15 +471,15 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parse Error!\n");
                goto end;
        }
-       
+
        if (!(domain = ldns_dname_new_frm_str(name))) {
                goto end;
        }
-       
+
        if (server_name) {
                res = ldns_resolver_new();
                switch_assert(res);
-               
+
                for(inameserver=0; inameserver<ENUM_MAXNAMESERVERS; inameserver++) {
                        if ( server_name[inameserver] != NULL ) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding Nameserver [%s]\n", server_name[inameserver]);
@@ -488,9 +488,9 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n
                                        ldns_rdf_deep_free(serv_rdf);
                                        added_server = 1;
                                }
-                       } 
+                       }
                }
-       } 
+       }
        if (!added_server) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No Nameservers specified, using host default\n");
                /* create a new resolver from /etc/resolv.conf */
@@ -520,7 +520,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n
                if ((naptr = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_NAPTR, LDNS_SECTION_ANSWER))) {
                        size_t i;
 
-                       ldns_rr_list_sort(naptr); 
+                       ldns_rr_list_sort(naptr);
 
                        for (i = 0; i < ldns_rr_list_rr_count(naptr); i++) {
                                parse_naptr(ldns_rr_list_rr(naptr, i), number, results);
@@ -535,7 +535,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n
  end:
 
        switch_safe_free(name);
-       
+
        if (domain) {
                ldns_rdf_deep_free(domain);
        }
@@ -556,7 +556,7 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results
        switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
        char *mnum = NULL, *mroot = NULL, *p;
        char *server[ENUM_MAXNAMESERVERS];
-       int inameserver = 0;  
+       int inameserver = 0;
        char *argv[ ENUM_MAXNAMESERVERS ] = { 0 };
        int argc;
        int x = 0;
@@ -580,12 +580,12 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results
        /* Empty the server array */
        for(inameserver=0; inameserver<ENUM_MAXNAMESERVERS; inameserver++) {
                server[inameserver] = NULL;
-       }  
+       }
 
        inameserver = 0;
 
        /* check for enum_nameserver channel var */
-       
+
        if (channel) {
                enum_nameserver = switch_channel_get_variable(channel, "enum_nameserver");
        }
@@ -691,7 +691,7 @@ SWITCH_STANDARD_APP(enum_app_function)
                root = argv[1];
                if (enum_lookup(root, dest, &results, channel, session) == SWITCH_STATUS_SUCCESS) {
                        switch_event_t *vars;
-                       
+
                        if (switch_channel_get_variables(channel, &vars) == SWITCH_STATUS_SUCCESS) {
                                switch_event_header_t *hi;
                                for (hi = vars->headers; hi; hi = hi->next) {
@@ -921,7 +921,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown)
 
        switch_safe_free(globals.root);
        switch_safe_free(globals.isn_root);
-       
+
        return SWITCH_STATUS_UNLOAD;
 }
 
index d295ca4ae09bc3655884aa380c65235cbc617ad7..4ac8e160714b11589107d16a2beb7f1343f28b33 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -165,7 +165,7 @@ SWITCH_STANDARD_APP(bcast_function)
        const char *codec_name = "PCMU";
        int read_rate = 8000;
        int need_transcode = 0;
-       
+
        inc_serno();
 
        switch_core_session_get_read_impl(session, &read_impl);
@@ -313,7 +313,7 @@ SWITCH_STANDARD_APP(bcast_function)
                goto fail;
        }
 
-       
+
        while (!ready) {
                status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 
@@ -333,7 +333,7 @@ SWITCH_STANDARD_APP(bcast_function)
 
        alert_packet->audio_header.codec = 0x00;
        alert_packet->audio_header.flags = 0;
-       
+
        if ((var = switch_channel_get_variable(channel, "esf_multicast_write_codec"))) {
                if (!strcasecmp(var, "PCMU")) {
                        codec_name = var;
@@ -379,7 +379,7 @@ SWITCH_STANDARD_APP(bcast_function)
                                goto fail;
                        }
                }
-               
+
 
                if (!(rtp_port = switch_rtp_request_port(source_ip))) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RTP Port Error\n");
@@ -393,7 +393,7 @@ SWITCH_STANDARD_APP(bcast_function)
                                                                         alert_packet->audio_header.codec,
                                                                         160,
                                                                         20000, flags, "soft", &err, switch_core_session_get_pool(session));
-               
+
                if (!switch_rtp_ready(rtp_session)) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RTP Error\n");
                        goto fail;
@@ -420,7 +420,7 @@ SWITCH_STANDARD_APP(bcast_function)
 
        strncpy((char *)polycom_packet->cid, caller_id_name, sizeof(polycom_packet->cid));
        polycom_packet->cid_len = 13;
-       
+
        polycom_packet->op = 0x0F;
        polycom_packet->channel = 0x1a;
        polycom_packet->serno = htonl(get_serno());
@@ -485,27 +485,27 @@ SWITCH_STANDARD_APP(bcast_function)
                                ebuf = read_frame->data;
                                encoded_datalen = read_frame->datalen;
                        }
-                       
+
                        switch_rtp_write_frame(rtp_session, read_frame);
-                       
+
                        seq += 160;
-                       
+
                        alert_packet->audio_header.seq = htonl(seq);
-                       
+
                        if (last_polycom_len) {
                                memcpy(alert_packet->data, last_polycom_buf, last_polycom_len);
                                memcpy(alert_packet->data + last_polycom_len, ebuf, encoded_datalen);
                        } else {
                                memcpy(alert_packet->data, ebuf, encoded_datalen);
                        }
-                       
+
                        bytes = sizeof(*alert_packet) + encoded_datalen + last_polycom_len;
 
                        switch_socket_sendto(socket, polycom_addr, 0, (void *) polycom_buf, &bytes);
-                       
+
                        last_polycom_len = encoded_datalen;
                        memcpy((void *)last_polycom_buf, (void *)ebuf, last_polycom_len);
-                       
+
                } else {
                        bytes = read_frame->packetlen;
                        switch_socket_sendto(socket, audio_addr, 0, read_frame->packet, &bytes);
@@ -543,7 +543,7 @@ SWITCH_STANDARD_APP(bcast_function)
        if (socket) {
                switch_socket_close(socket);
        }
-       
+
        if (polycom_socket) {
                switch_socket_close(polycom_socket);
        }
index eced37f48c8bd3bb6478752360e6ab8667d692d2..159d18ed28972265fc93a7ebbf0ef28682fae917 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
@@ -38,7 +38,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_esl_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_esl_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_esl_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_esl, mod_esl_load, mod_esl_shutdown, NULL);
@@ -65,7 +65,7 @@ SWITCH_STANDARD_API(single_esl_api_function)
 
        if (password && (host = strchr(password, ' '))) {
                *host++ = '\0';
-       }   
+       }
 
        if (host && (s_timeout = strchr(host, ' '))) {
                *s_timeout++ = '\0';
index a83971fdd6065fb218baa4e08752ca4b7b058e56..24f9a84aee624f23f6d0f6c1c9a88161f499df9a 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Written by:
  * Hongli Lai <hongli@telekabel.nl>
- * tkorrovi <tkorrovi@altavista.net> on 2002/02/26. 
+ * tkorrovi <tkorrovi@altavista.net> on 2002/02/26.
  * Andrew Westcott <ajwestco@users.sourceforge.net>
  *
  * Offered for use in the public domain without any warranty.
index c2f94b4d2f0d69f34ed87e659466306baa33cc44..48a6421d00c56690b9047308edb0e8a78f6f32df 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_expr.c -- Framework Demo Module
index b85e792992695e792565a5b011d1ffa02cc7b984..0c2368763b63ef80c32e88375611226f76960044 100644 (file)
@@ -1,4 +1,4 @@
-       <!-- 
+       <!--
                Parking extensions... transferring calls to 5900 will park them in a queue.
        -->
        <extension name="park">
@@ -8,7 +8,7 @@
                </condition>
        </extension>
 
-       <!-- 
+       <!--
                Parking pickup extension.  Calling 5901 will pickup the call.
        -->
        <extension name="unpark">
index ee9b52e6bc34014af266f098cc13a4d359639fbe..2b00f0d7d391300e59a3c7db0452f32463f3f75a 100644 (file)
@@ -84,7 +84,7 @@ SWITCH_MODULE_DEFINITION(mod_fifo, mod_fifo_load, mod_fifo_shutdown, NULL);
  * who will be available to answer a single caller. In ringall this
  * maximum is the number who will be called, in enterprise the need defines
  * how many agents will be called. outbound_per_cycle_min will define
- * the minimum agents who will be called to answer a caller regardless of 
+ * the minimum agents who will be called to answer a caller regardless of
  * need, giving the enterprise strategy the ability to ring through more
  * than one agent for one caller.
 
@@ -1999,19 +1999,19 @@ static int place_call_enterprise_callback(void *pArg, int argc, char **argv, cha
  * care of invoking the handler.
  *
  * Within the ringall call strategy outbound_per_cycle is used to define
- * how many agents exactly are assigned to the caller. With ringall if 
+ * how many agents exactly are assigned to the caller. With ringall if
  * multiple callers are calling in and one is answered, because the call
  * is assigned to all agents the call to the agents that is not answered
  * will be lose raced and the other agents will drop the call before the
- * next one will begin to ring. When oubound_per_cycle is used in the 
+ * next one will begin to ring. When oubound_per_cycle is used in the
  * enterprise strategy it acts as a maximum value for how many agents
- * are rung at once on any call, the caller is not assigned to any agent 
+ * are rung at once on any call, the caller is not assigned to any agent
  * until the call is answered. Enterprise only rings the number of phones
  * that are needed, so outbound_per_cycle as a max does not give you the
  * effect of ringall. outbound_per_cycle_min defines how many agents minimum
  * will be rung by an incoming caller through fifo, which can give a ringall
  * effect. outbound_per_cycle and outbound_per_cycle_min both default to 1.
- * 
+ *
  */
 static int find_consumers(fifo_node_t *node)
 {
@@ -4083,7 +4083,7 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve
        switch_xml_set_attr_d(x_fifo, "outbound_per_cycle", tmp);
 
        switch_snprintf(tmp, sizeof(buffer), "%u", node->outbound_per_cycle_min);
-       switch_xml_set_attr_d(x_fifo, "outbound_per_cycle_min", tmp); 
+       switch_xml_set_attr_d(x_fifo, "outbound_per_cycle_min", tmp);
 
        switch_snprintf(tmp, sizeof(buffer), "%u", node->ring_timeout);
        switch_xml_set_attr_d(x_fifo, "ring_timeout", tmp);
index 773b0deaae722ec46ba14fa105f3298c2ae218dd..94fd98e7a8ffe5032c3ff5b4ab3a981be3b603bd 100644 (file)
@@ -211,7 +211,7 @@ dsp_fsk_handle_t *dsp_fsk_create(dsp_fsk_attr_t *attr)
 /*
  *     dsp_fsk_destroy
  *
- *     Destroys a handle, releasing any associated memory.  Sets handle pointer to NULL 
+ *     Destroys a handle, releasing any associated memory.  Sets handle pointer to NULL
  *     so A destroyed handle can not be used for anything after the destroy.
 */
 
@@ -306,11 +306,11 @@ dsp_fsk_sample (dsp_fsk_handle_t *handle, double normalized_sample)
 
        if (handle->cellpos > 1.0) {
                handle->cellpos -= 1.0;
-               
+
                switch (handle->state) {
                case FSK_STATE_DATA:
-                       {               
-                               
+                       {
+
                                (*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit);
                        }
                        break;
index b098444d0397c3db6f32e42eec18c0d63c4c4d42..4299e2988569c653c6506a34b10ffecd10d8d16a 100644 (file)
@@ -109,5 +109,5 @@ void                                        dsp_fsk_sample(dsp_fsk_handle_t *handle, double normalized_sample);
 
 extern fsk_modem_definition_t fsk_modem_definitions[];
 
-#endif 
+#endif
 
index 24acb75d90633aa02ca4be29eba4759a8b5a662e..a5b57465596ddfdb44b6ff83730094aee211d49f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_fsk -- FSK data transfer
@@ -39,7 +39,7 @@ void bitstream_init(bitstream_t *bsp, uint8_t *data, uint32_t datalen, endian_t
        bsp->datalen = datalen;
        bsp->endian = endian;
        bsp->ss = ss;
-       
+
        if (endian < 0) {
                bsp->top = bsp->bit_index = 7;
                bsp->bot = 0;
@@ -53,7 +53,7 @@ void bitstream_init(bitstream_t *bsp, uint8_t *data, uint32_t datalen, endian_t
 int8_t bitstream_get_bit(bitstream_t *bsp)
 {
        int8_t bit = -1;
-       
+
 
        if (bsp->byte_index >= bsp->datalen) {
                goto done;
@@ -71,19 +71,19 @@ int8_t bitstream_get_bit(bitstream_t *bsp)
        }
 
        bit = (bsp->data[bsp->byte_index] >> (bsp->bit_index)) & 1;
-       
+
        if (bsp->bit_index == bsp->bot) {
                bsp->bit_index = bsp->top;
                if (bsp->ss) {
                        bsp->ssv = 2;
                        goto done;
-               } 
+               }
 
                if (++bsp->byte_index > bsp->datalen) {
                        bit = -1;
                        goto done;
                }
-               
+
        } else {
                bsp->bit_index = bsp->bit_index + bsp->endian;
        }
@@ -109,7 +109,7 @@ static void fsk_byte_handler (void *x, int data)
        if (state->dlen) {
                goto add_byte;
        }
-       
+
        if (state->bpos == 1) {
                state->blen = byte;
 
@@ -189,7 +189,7 @@ switch_status_t fsk_data_parse(fsk_data_state_t *state, size_t *type, char **dat
 
        size_t i;
        int sum = 0;
-       
+
  top:
 
        if (state->checksum != 0 || state->ppos >= state->dlen - 1) {
@@ -201,7 +201,7 @@ switch_status_t fsk_data_parse(fsk_data_state_t *state, size_t *type, char **dat
                        sum += state->buf[i];
                }
                state->checksum = sum % 256;
-               state->ppos = 2;                
+               state->ppos = 2;
 
                if (state->buf[0] != CID_TYPE_MDMF && state->buf[0] != CID_TYPE_SDMF) {
                        state->checksum = -1;
@@ -224,7 +224,7 @@ switch_status_t fsk_data_parse(fsk_data_state_t *state, size_t *type, char **dat
                        }
                }
                *data = (char *)&state->buf[state->ppos];
-               state->ppos += *len;            
+               state->ppos += *len;
                return SWITCH_STATUS_SUCCESS;
        } else if (state->buf[0] == CID_TYPE_MDMF) {
                *type = state->buf[state->ppos++];
@@ -277,7 +277,7 @@ int fsk_demod_init(fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsi
        memset(buf, 0, bufsize);
        state->buf = buf;
        state->bufsize = bufsize;
-       
+
        dsp_fsk_attr_init (&fsk1200_attr);
        dsp_fsk_attr_set_samplerate (&fsk1200_attr, rate);
        dsp_fsk_attr_set_bytehandler (&fsk1200_attr, fsk_byte_handler, state);
@@ -293,7 +293,7 @@ int fsk_demod_init(fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsi
 size_t fsk_modulator_generate_bit(fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, size_t buflen)
 {
        size_t i;
-               
+
        for(i = 0 ; i < buflen; i++) {
                fsk_trans->bit_accum += fsk_trans->bit_factor;
                if (fsk_trans->bit_accum >= FSK_MOD_FACTOR) {
@@ -333,7 +333,7 @@ void fsk_modulator_generate_chan_sieze(fsk_modulator_t *fsk_trans)
        uint32_t i = 0;
        size_t r = 0;
        int8_t bit = 0;
-       
+
        for (i = 0; i < fsk_trans->chan_sieze_bits; i++) {
                if ((r = fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) {
                        if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != SWITCH_STATUS_SUCCESS) {
@@ -344,7 +344,7 @@ void fsk_modulator_generate_chan_sieze(fsk_modulator_t *fsk_trans)
                }
                bit = !bit;
        }
-       
+
 
 }
 
index 0813ba18b3ada5b02db7f37771ec6286086cd1ce..ce5b16615ddc598d9058a166fe974d75b787fee1 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_fsk -- FSK data transfer
index 566de16138539017614eaa2d0112a1bc6673975b..1e22cff74f2a9db9d4d3e2fb02003421bb595340 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_fsk.c -- FSK data transfer
@@ -36,7 +36,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fsk_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_fsk_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_fsk_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_fsk, mod_fsk_load, mod_fsk_shutdown, NULL);
@@ -46,7 +46,7 @@ switch_status_t my_write_sample(int16_t *buf, size_t buflen, void *user_data)
        switch_buffer_t *buffer = (switch_buffer_t *) user_data;
 
        switch_buffer_write(buffer, buf, buflen * 2);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -62,7 +62,7 @@ static switch_status_t write_fsk_data(uint32_t rate, int32_t db, switch_buffer_t
        switch_size_t plen = 0;
 
        memset(&fsk_trans, 0, sizeof(fsk_trans));
-       
+
        time(&now);
        localtime_r(&now, &tm);
        strftime(time_str, sizeof(time_str), "%m%d%H%M", &tm);
@@ -91,7 +91,7 @@ static switch_status_t write_fsk_data(uint32_t rate, int32_t db, switch_buffer_t
                        }
 
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoding [%s][%s]\n", hp->name, hp->value);
-                       
+
                        if (!strcasecmp(name, "phone_num")) {
                                fsk_data_add_mdmf(&fsk_data, MDMF_PHONE_NUM, (uint8_t *)hp->value, strlen(hp->value));
                        } else if (!strcasecmp(name, "phone_name")) {
@@ -122,14 +122,14 @@ SWITCH_STANDARD_APP(fsk_send_function) {
        switch_channel_t *channel = switch_core_session_get_channel(session);
        switch_frame_t *read_frame;
        switch_status_t status;
-       
+
 
        if (data) {
                switch_ivr_sleep(session, 1000, SWITCH_TRUE, NULL);
                switch_core_session_send_dtmf_string(session, (const char *) data);
                switch_ivr_sleep(session, 1500, SWITCH_TRUE, NULL);
        }
-       
+
        if (switch_core_session_set_codec_slin(session, &sdata) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
                                                  SWITCH_LOG_ERROR, "FAILURE\n");
@@ -139,7 +139,7 @@ SWITCH_STANDARD_APP(fsk_send_function) {
        switch_buffer_create_dynamic(&buffer, 1024, 2048, 0);
 
        switch_channel_get_variables(channel, &event);
-       
+
        write_fsk_data(sdata.codec.implementation->actual_samples_per_second, -14, buffer, event, "fsk_");
 
        while(switch_channel_ready(channel)) {
@@ -149,14 +149,14 @@ SWITCH_STANDARD_APP(fsk_send_function) {
                        break;
                }
 
-               if ((sdata.write_frame.datalen = switch_buffer_read(buffer, sdata.write_frame.data, 
+               if ((sdata.write_frame.datalen = switch_buffer_read(buffer, sdata.write_frame.data,
                                                                                                                         sdata.codec.implementation->decoded_bytes_per_packet)) <= 0) {
                        break;
                }
 
-               
+
                if (sdata.write_frame.datalen < sdata.codec.implementation->decoded_bytes_per_packet) {
-                       memset((char *)sdata.write_frame.data + sdata.write_frame.datalen, 255, 
+                       memset((char *)sdata.write_frame.data + sdata.write_frame.datalen, 255,
                                   sdata.codec.implementation->decoded_bytes_per_packet - sdata.write_frame.datalen);
                        sdata.write_frame.datalen = sdata.codec.implementation->decoded_bytes_per_packet;
                }
@@ -168,7 +168,7 @@ SWITCH_STANDARD_APP(fsk_send_function) {
        switch_buffer_destroy(&buffer);
        switch_core_codec_destroy(&sdata.codec);
        switch_core_session_set_read_codec(session, NULL);
-       
+
 }
 
 typedef struct {
@@ -191,11 +191,11 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat
        case SWITCH_ABC_TYPE_INIT: {
                switch_codec_implementation_t read_impl = { 0 };
                switch_core_session_get_read_impl(pvt->session, &read_impl);
-               
+
                if (fsk_demod_init(&pvt->fsk_data, read_impl.actual_samples_per_second, pvt->fbuf, sizeof(pvt->fbuf))) {
                        return SWITCH_FALSE;
                }
-               
+
                break;
        }
        case SWITCH_ABC_TYPE_CLOSE:
@@ -224,10 +224,10 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat
                                int total = 0;
 
                                switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA);
-                               
+
                                while(fsk_data_parse(&pvt->fsk_data, &type, &sp, &mlen) == SWITCH_STATUS_SUCCESS) {
                                        char *varname = NULL, *val, *p;
-                                       
+
                                        switch_copy_string(str, sp, mlen+1);
                                        *(str+mlen) = '\0';
                                        switch_clean_string(str);
@@ -258,7 +258,7 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat
 
                                        if (varname && val) {
                                                total++;
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s setting FSK var [%s][%s]\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s setting FSK var [%s][%s]\n",
                                                                                  switch_channel_get_name(channel), varname, val);
                                                switch_channel_set_variable(channel, varname, val);
                                                if (event) {
@@ -272,21 +272,21 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat
                                                switch_event_destroy(&event);
                                        }
                                }
-                               
+
                                if (total && (app_var = switch_channel_get_variable(channel, "execute_on_fsk"))) {
                                        char *app_arg;
 
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s processing execute_on_fsk [%s]\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s processing execute_on_fsk [%s]\n",
                                                                          switch_channel_get_name(channel), app_var);
                                        if ((app_arg = strchr(app_var, ' '))) {
                                                *app_arg++ = '\0';
                                        }
                                        switch_core_session_execute_application(pvt->session, app_var, app_arg);
                                }
-                               
+
                                pvt->skip = 10;
                        }
-                       
+
                        memset(rframe->data, 255, rframe->datalen);
 
                        if (type == SWITCH_ABC_TYPE_READ_REPLACE) {
@@ -359,12 +359,12 @@ switch_status_t fsk_detect_session(switch_core_session_t *session, const char *f
 }
 
 
-SWITCH_STANDARD_APP(fsk_recv_function) 
+SWITCH_STANDARD_APP(fsk_recv_function)
 {
        fsk_detect_session(session, data);
 }
 
-SWITCH_STANDARD_APP(fsk_display_function) 
+SWITCH_STANDARD_APP(fsk_display_function)
 {
        /* expected to be called via 'execute_on_fsk' -- passes display update over FSK */
 
@@ -380,7 +380,7 @@ SWITCH_STANDARD_APP(fsk_display_function)
        if (zstr(cid_name)) {
                cid_name = cid_num;
        }
-       
+
        if (zstr(cid_num)) {
                return;
        }
@@ -409,13 +409,13 @@ SWITCH_STANDARD_APP(fsk_display_function)
        }
 }
 
-SWITCH_STANDARD_APP(fsk_simplify_function) 
+SWITCH_STANDARD_APP(fsk_simplify_function)
 {
        /* expected to be called via 'execute_on_fsk' -- redirects call to point-to-point and eliminates legs in the middle */
        switch_channel_t *channel = switch_core_session_get_channel(session);
        const char *sip_uri, *fsk_simplify_profile, *fsk_simplify_context;
        char *bridgeto;
-       
+
        if (!(sip_uri = switch_channel_get_variable(channel, "fsk_uri"))) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Missing URI field!\n", switch_channel_get_name(channel));
        }
@@ -431,21 +431,21 @@ SWITCH_STANDARD_APP(fsk_simplify_function)
                switch_channel_t *pchannel;
 
                bridgeto = switch_core_session_sprintf(session, "bridge:sofia/%s/sip:%s", fsk_simplify_profile, sip_uri);
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s transfering to [%s]\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s transfering to [%s]\n",
                                                  switch_channel_get_name(channel), bridgeto);
-               
+
 
                if (switch_core_session_get_partner(session, &psession) == SWITCH_STATUS_SUCCESS) {
                        pchannel = switch_core_session_get_channel(psession);
                        switch_channel_set_flag(pchannel, CF_REDIRECT);
                        switch_channel_set_flag(pchannel, CF_TRANSFER);
                }
-               
+
                switch_ivr_session_transfer(session, bridgeto, "inline", fsk_simplify_context);
 
                if (psession) {
                        switch_ivr_session_transfer(psession, "sleep:5000", "inline", NULL);
-                       switch_core_session_rwunlock(psession);                 
+                       switch_core_session_rwunlock(psession);
                }
        }
 }
index e99022cee8fee81b09a90e1d13b6a7e7e9bd1e8c..7408767719b6755bf8cedef9afc8f506a89f4030 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Seven Du <dujinfang@gmail.com>
  *
@@ -124,14 +124,14 @@ SWITCH_STANDARD_APP(record_fsv_function)
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "%s waiting for video.\n", switch_channel_get_name(channel));
                        count = 100;
                        if (!--sanity) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s timeout waiting for video.\n", 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s timeout waiting for video.\n",
                                                                  switch_channel_get_name(channel));
                                switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "Got timeout while waiting for video");
                                goto done;
                        }
                }
        }
-       
+
        if (!switch_channel_ready(channel)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s not ready.\n", switch_channel_get_name(channel));
                switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "Channel not ready");
@@ -241,7 +241,7 @@ SWITCH_STANDARD_APP(record_fsv_function)
                        }
                        break;
                }
-        
+
                if (mutex) {
                        switch_mutex_unlock(mutex);
                }
@@ -442,7 +442,7 @@ SWITCH_STANDARD_APP(play_fsv_function)
                                if (terminators && !strcasecmp(terminators, "none"))
                                {
                                        terminators = NULL;
-                               }                                                               
+                               }
 
                                if (terminators && strchr(terminators, dtmf.digit)) {
 
@@ -452,7 +452,7 @@ SWITCH_STANDARD_APP(play_fsv_function)
                                }
                        }
                }
-               
+
        }
 
        switch_core_thread_session_end(session);
@@ -625,7 +625,7 @@ SWITCH_STANDARD_APP(play_yuv_function)
                                break;
                        }
                }
-               
+
                if (read_frame) {
                        memset(read_frame->data, 0, read_frame->datalen);
                        switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);
@@ -699,7 +699,7 @@ static void decode_video_thread(switch_core_session_t *session, void *obj)
                        switch_core_session_request_video_refresh(session);
                        count = 1;
                }
-                       
+
 
                if (frame && frame->datalen > 0) {
                        switch_core_session_write_video_frame(session, frame, SWITCH_IO_FLAG_NONE, 0);
index a7c2cb6aee63c437922a793c1347775e8d90ddfa..ed86ab34fbfec938d4d411ef4813565e55887b08 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice <krice at suspicious dot org
  * Mathieu Rene <mathieu.rene@gmail.com>
@@ -98,18 +98,18 @@ typedef struct {
        const char *username;
        const char *password;
        int port;
-       
+
        int interval;
-       
+
        esl_handle_t handle;
 
        switch_hash_t *index;
        switch_thread_rwlock_t *rwlock;
        switch_memory_pool_t *pool;
-       
+
        switch_bool_t running;
        switch_thread_t *thread;
-       
+
        limit_remote_state_t state;
 } limit_remote_t;
 
@@ -232,24 +232,24 @@ SWITCH_HASH_DELETE_FUNC(limit_hash_cleanup_delete_callback) {
        if (item->total_usage == 0 && item->rate_usage == 0) {
                /* Noone is using this item anymore */
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Freeing limit item: %s\n", (const char *) key);
-               
+
                free(item);
                return SWITCH_TRUE;
        }
-       
+
        return SWITCH_FALSE;
 }
 
-SWITCH_HASH_DELETE_FUNC(limit_hash_remote_cleanup_callback) 
+SWITCH_HASH_DELETE_FUNC(limit_hash_remote_cleanup_callback)
 {
        limit_hash_item_t *item = (limit_hash_item_t *) val;
        switch_time_t now = (switch_time_t)(intptr_t)pData;
-       
+
        if (item->last_update != now) {
                free(item);
                return SWITCH_TRUE;
        }
-       
+
        return SWITCH_FALSE;
 }
 
@@ -262,7 +262,7 @@ SWITCH_STANDARD_SCHED_FUNC(limit_hash_cleanup_callback)
        }
        switch_thread_rwlock_unlock(globals.limit_hash_rwlock);
 
-       if (globals.limit_hash) {       
+       if (globals.limit_hash) {
                task->runtime = switch_epoch_time_now(NULL) + LIMIT_HASH_CLEANUP_INTERVAL;
        }
 }
@@ -323,7 +323,7 @@ SWITCH_LIMIT_RELEASE(limit_release_hash)
        }
 
        switch_thread_rwlock_unlock(globals.limit_hash_rwlock);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -338,7 +338,7 @@ SWITCH_LIMIT_USAGE(limit_usage_hash)
 
        hash_key = switch_mprintf("%s_%s", realm, resource);
        remote_usage = get_remote_usage(hash_key);
-       
+
        count = remote_usage.total_usage;
        *rcount = remote_usage.rate_usage;
 
@@ -382,15 +382,15 @@ SWITCH_LIMIT_STATUS(limit_status_hash)
        switch_hash_index_t *hi = NULL;
        int count = 0;
        char *ret = NULL;
-       
+
        switch_thread_rwlock_rdlock(globals.limit_hash_rwlock);
-       
+
        for (hi = switch_core_hash_first(globals.limit_hash); hi; switch_core_hash_next(hi)) {
                count++;
        }
-       
+
        switch_thread_rwlock_unlock(globals.limit_hash_rwlock);
-       
+
        ret = switch_mprintf("There are %d elements being tracked.", count);
        return ret;
        */
@@ -577,7 +577,7 @@ SWITCH_STANDARD_API(hash_api_function)
 }
 
 #define HASH_DUMP_SYNTAX "all|limit|db [<realm>]"
-SWITCH_STANDARD_API(hash_dump_function) 
+SWITCH_STANDARD_API(hash_dump_function)
 {
        int mode;
        switch_hash_index_t *hi;
@@ -586,7 +586,7 @@ SWITCH_STANDARD_API(hash_dump_function)
        char *mydata = NULL;
        int realm = 0;
        char *realmvalue = NULL;
-       
+
        if (zstr(cmd)) {
                stream->write_function(stream, "Usage: "HASH_DUMP_SYNTAX"\n");
                goto done;
@@ -600,8 +600,8 @@ SWITCH_STANDARD_API(hash_dump_function)
        if (argc == 2) {
                realm = 1;
                realmvalue = switch_mprintf("%s_", argv[1]);
-       } 
-       
+       }
+
        if (!strcmp(cmd, "all")) {
                mode = 3;
        } else if (!strcmp(cmd, "limit")) {
@@ -612,7 +612,7 @@ SWITCH_STANDARD_API(hash_dump_function)
                stream->write_function(stream, "Usage: "HASH_DUMP_SYNTAX"\n");
                goto done;
        }
-       
+
        if (mode & 1) {
                switch_thread_rwlock_rdlock(globals.limit_hash_rwlock);
                for (hi = switch_core_hash_first(globals.limit_hash); hi; hi = switch_core_hash_next(&hi)) {
@@ -621,14 +621,14 @@ SWITCH_STANDARD_API(hash_dump_function)
                        switch_ssize_t keylen;
                        limit_hash_item_t *item;
                        switch_core_hash_this(hi, &key, &keylen, &val);
-                                               
+
                        item = (limit_hash_item_t *)val;
 
                        stream->write_function(stream, "L/%s/%d/%d/%d/%d\n", key, item->total_usage, item->rate_usage, item->interval, item->last_check);
                }
                switch_thread_rwlock_unlock(globals.limit_hash_rwlock);
        }
-       
+
        if (mode & 2) {
                switch_thread_rwlock_rdlock(globals.db_hash_rwlock);
                for (hi = switch_core_hash_first(globals.db_hash); hi; hi = switch_core_hash_next(&hi)) {
@@ -646,7 +646,7 @@ SWITCH_STANDARD_API(hash_dump_function)
                }
                switch_thread_rwlock_unlock(globals.db_hash_rwlock);
        }
-       
+
  done:
        switch_safe_free(mydata);
        switch_safe_free(realmvalue);
@@ -655,38 +655,38 @@ SWITCH_STANDARD_API(hash_dump_function)
 }
 
 #define HASH_REMOTE_SYNTAX "list|kill [name]|rescan"
-SWITCH_STANDARD_API(hash_remote_function) 
+SWITCH_STANDARD_API(hash_remote_function)
 {
        //int argc;
        char *argv[10];
        char *dup = NULL;
-       
+
        if (zstr(cmd)) {
                stream->write_function(stream, "-ERR Usage: "HASH_REMOTE_SYNTAX"\n");
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        dup = strdup(cmd);
-       
+
        switch_split(dup, ' ', argv);
        if (argv[0] && !strcmp(argv[0], "list")) {
                switch_hash_index_t *hi;
                stream->write_function(stream, "Remote connections:\nName\t\t\tState\n");
-               
+
                switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
                for (hi = switch_core_hash_first(globals.remote_hash); hi; hi = switch_core_hash_next(&hi)) {
-                       void *val;      
+                       void *val;
                        const void *key;
                        switch_ssize_t keylen;
                        limit_remote_t *item;
                        switch_core_hash_this(hi, &key, &keylen, &val);
-                                                               
+
                        item = (limit_remote_t *)val;
-                       stream->write_function(stream, "%s\t\t\t%s\n", item->name, state_str(item->state));     
+                       stream->write_function(stream, "%s\t\t\t%s\n", item->name, state_str(item->state));
                }
                switch_thread_rwlock_unlock(globals.remote_hash_rwlock);
                stream->write_function(stream, "+OK\n");
-               
+
        } else if (argv[0] && !strcmp(argv[0], "kill")) {
                const char *name = argv[1];
                limit_remote_t *remote;
@@ -697,15 +697,15 @@ SWITCH_STANDARD_API(hash_remote_function)
                switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
                remote = switch_core_hash_find(globals.remote_hash, name);
                switch_thread_rwlock_unlock(globals.remote_hash_rwlock);
-               
+
                if (remote) {
                        limit_remote_destroy(&remote);
 
                        switch_thread_rwlock_wrlock(globals.remote_hash_rwlock);
                        switch_core_hash_delete(globals.remote_hash, name);
                        switch_thread_rwlock_unlock(globals.remote_hash_rwlock);
-                       
-                       stream->write_function(stream, "+OK\n");                        
+
+                       stream->write_function(stream, "+OK\n");
                } else {
                        stream->write_function(stream, "-ERR No such remote instance %s\n", name);
                }
@@ -714,9 +714,9 @@ SWITCH_STANDARD_API(hash_remote_function)
                stream->write_function(stream, "+OK\n");
        } else {
                stream->write_function(stream, "-ERR Usage: "HASH_REMOTE_SYNTAX"\n");
-               
+
        }
-       
+
 done:
 
        switch_safe_free(dup);
@@ -724,11 +724,11 @@ done:
        return SWITCH_STATUS_SUCCESS;
 }
 
-limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t port, const char *username, const char *password, int interval) 
+limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t port, const char *username, const char *password, int interval)
 {
        limit_remote_t *r;
        switch_memory_pool_t *pool;
-       
+
        switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
        if (switch_core_hash_find(globals.remote_hash, name)) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Already have a remote instance named %s\n", name);
@@ -736,11 +736,11 @@ limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t
                        return NULL;
        }
        switch_thread_rwlock_unlock(globals.remote_hash_rwlock);
-       
+
        if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
                return NULL;
        }
-       
+
        r = switch_core_alloc(pool, sizeof(limit_remote_t));
        r->pool = pool;
        r->name = switch_core_strdup(r->pool, name);
@@ -749,10 +749,10 @@ limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t
        r->username = switch_core_strdup(r->pool, username);
        r->password = switch_core_strdup(r->pool, password);
        r->interval = interval;
-       
+
        switch_thread_rwlock_create(&r->rwlock, pool);
        switch_core_hash_init(&r->index);
-       
+
        switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
        switch_core_hash_insert(globals.remote_hash, name, r);
        switch_thread_rwlock_unlock(globals.remote_hash_rwlock);
@@ -776,17 +776,17 @@ void limit_remote_destroy(limit_remote_t **r)
 
                /* Free hashtable data */
                for (hi = switch_core_hash_first((*r)->index); hi; hi = switch_core_hash_next(&hi)) {
-                       void *val;      
+                       void *val;
                        const void *key;
                        switch_ssize_t keylen;
                        switch_core_hash_this(hi, &key, &keylen, &val);
 
                        free(val);
                }
-               
+
                switch_thread_rwlock_unlock((*r)->rwlock);
                switch_thread_rwlock_destroy((*r)->rwlock);
-                                       
+
                switch_core_destroy_memory_pool(&((*r)->pool));
                *r = NULL;
        }
@@ -796,21 +796,21 @@ void limit_remote_destroy(limit_remote_t **r)
 static limit_hash_item_t get_remote_usage(const char *key) {
        limit_hash_item_t usage = { 0 };
        switch_hash_index_t *hi;
-       
+
        switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
        for (hi = switch_core_hash_first(globals.remote_hash); hi; hi = switch_core_hash_next(&hi)) {
-               void *val;      
+               void *val;
                const void *hashkey;
                switch_ssize_t keylen;
                limit_remote_t *remote;
                limit_hash_item_t *item;
                switch_core_hash_this(hi, &hashkey, &keylen, &val);
-                                                       
+
                remote = (limit_remote_t *)val;
                if (remote->state != REMOTE_UP) {
                        continue;
                }
-               
+
                switch_thread_rwlock_rdlock(remote->rwlock);
                if ((item = switch_core_hash_find(remote->index, key))) {
                        usage.total_usage += item->total_usage;
@@ -821,9 +821,9 @@ static limit_hash_item_t get_remote_usage(const char *key) {
                }
                switch_thread_rwlock_unlock(remote->rwlock);
        }
-       
+
        switch_thread_rwlock_unlock(globals.remote_hash_rwlock);
-       
+
        return usage;
 }
 
@@ -835,7 +835,7 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi
                        if  (esl_connect_timeout(&remote->handle, remote->host, (esl_port_t)remote->port, remote->username, remote->password, 5000) == ESL_SUCCESS) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected to remote FreeSWITCH (%s) at %s:%d\n",
                                        remote->name, remote->host, remote->port);
-                               
+
                                remote->state = REMOTE_UP;
                        } else {
                                esl_disconnect(&remote->handle);
@@ -860,20 +860,20 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi
                                        switch_time_t now = switch_epoch_time_now(NULL);
                                        while (p && *p) {
                                                /* We are getting the limit data as:
-                                                       L/key/usage/rate/interval/last_checked 
+                                                       L/key/usage/rate/interval/last_checked
                                                */
                                                if ((p2 = strchr(p, '\n'))) {
                                                        *p2++ = '\0';
                                                }
-                                               
-                                               /* Now p points at the beginning of the current line, 
+
+                                               /* Now p points at the beginning of the current line,
                                                p2 at the start of the next one */
                                                if (*p == 'L') { /* Limit data */
-                                                       char *argv[5]; 
+                                                       char *argv[5];
                                                        int argc = switch_split(p+2, '/', argv);
-                                                       
+
                                                        if (argc < 5) {
-                                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "[%s] Protocol error: missing argument in line: %s\n", 
+                                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "[%s] Protocol error: missing argument in line: %s\n",
                                                                        remote->name, p);
                                                        } else {
                                                                limit_hash_item_t *item;
@@ -890,11 +890,11 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi
                                                                switch_thread_rwlock_unlock(remote->rwlock);
                                                        }
                                                }
-                                               
+
                                                p = p2;
                                        }
                                        free(data);
-                                       
+
                                        /* Now free up anything that wasn't in this update since it means their usage is 0 */
                                        switch_thread_rwlock_wrlock(remote->rwlock);
                                        switch_core_hash_delete_multi(remote->index, limit_hash_remote_cleanup_callback, (void*)(intptr_t)now);
@@ -902,12 +902,12 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi
                                }
                        }
                }
-               
+
                switch_yield(remote->interval * 1000);
        }
-       
+
        remote->thread = NULL;
-       
+
        return NULL;
 }
 
@@ -927,7 +927,7 @@ static void do_config(switch_bool_t reload)
                                int     interval = 0;
                                limit_remote_t *remote;
                                switch_threadattr_t *thd_attr = NULL;
-                               
+
                                if (reload) {
                                        switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
                                        if (switch_core_hash_find(globals.remote_hash, name)) {
@@ -940,15 +940,15 @@ static void do_config(switch_bool_t reload)
                                if (!zstr(szport)) {
                                        port = (uint16_t)atoi(szport);
                                }
-                               
+
                                if (!zstr(szinterval)) {
                                        interval = atoi(szinterval);
                                }
-                               
+
                                remote = limit_remote_create(name, host, port, username, password, interval);
-                               
-                               remote->state = REMOTE_DOWN;    
-                               
+
+                               remote->state = REMOTE_DOWN;
+
                                switch_threadattr_create(&thd_attr, remote->pool);
                                switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
                                switch_thread_create(&remote->thread, thd_attr, limit_remote_thread, remote, remote->pool);
@@ -990,24 +990,24 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_hash_load)
 
        switch_scheduler_add_task(switch_epoch_time_now(NULL) + LIMIT_HASH_CLEANUP_INTERVAL, limit_hash_cleanup_callback, "limit_hash_cleanup", "mod_hash", 0, NULL,
                                                  SSHF_NONE);
-       
+
        SWITCH_ADD_APP(app_interface, "hash", "Insert into the hashtable", HASH_DESC, hash_function, HASH_USAGE, SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC)
        SWITCH_ADD_API(commands_api_interface, "hash", "hash get/set", hash_api_function, "[insert|delete|select]/<realm>/<key>/<value>");
        SWITCH_ADD_API(commands_api_interface, "hash_dump", "dump hash/limit_hash data (used for synchronization)", hash_dump_function, HASH_DUMP_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "hash_remote", "hash remote", hash_remote_function, HASH_REMOTE_SYNTAX);
-       
+
        switch_console_set_complete("add hash insert");
        switch_console_set_complete("add hash delete");
        switch_console_set_complete("add hash select");
-       
+
        switch_console_set_complete("add hash_remote list");
        switch_console_set_complete("add hash_remote kill");
        switch_console_set_complete("add hash_remote rescan");
-       
+
        do_config(SWITCH_FALSE);
 
        /* indicate that the module should continue to be loaded */
-       return SWITCH_STATUS_SUCCESS;   
+       return SWITCH_STATUS_SUCCESS;
 }
 
 
@@ -1015,25 +1015,25 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown)
 {
        switch_hash_index_t *hi = NULL;
        switch_bool_t remote_clean = SWITCH_TRUE;
-       
+
        switch_scheduler_del_task_group("mod_hash");
 
        /* Kill remote connections, destroy needs a wrlock so we unlock after finding a pointer */
        while(remote_clean) {
-               void *val;      
+               void *val;
                const void *key = NULL;
                switch_ssize_t keylen;
                limit_remote_t *item = NULL;
-               
+
                switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);
                if ((hi = switch_core_hash_first(globals.remote_hash))) {
                        switch_core_hash_this(hi, &key, &keylen, &val);
                        item = (limit_remote_t *)val;
                }
                switch_thread_rwlock_unlock(globals.remote_hash_rwlock);
-               
-               if (!item) { 
-                       remote_clean = SWITCH_FALSE; 
+
+               if (!item) {
+                       remote_clean = SWITCH_FALSE;
                } else {
                        limit_remote_destroy(&item);
                        switch_thread_rwlock_wrlock(globals.remote_hash_rwlock);
@@ -1044,7 +1044,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown)
 
        switch_thread_rwlock_wrlock(globals.limit_hash_rwlock);
        switch_thread_rwlock_wrlock(globals.db_hash_rwlock);
-       
+
        while ((hi = switch_core_hash_first_iter( globals.limit_hash, hi))) {
                void *val = NULL;
                const void *key;
@@ -1053,7 +1053,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown)
                free(val);
                switch_core_hash_delete(globals.limit_hash, key);
        }
-       
+
        while ((hi = switch_core_hash_first_iter( globals.db_hash, hi))) {
                void *val = NULL;
                const void *key;
@@ -1064,7 +1064,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown)
        }
 
        switch_core_hash_destroy(&globals.limit_hash);
-       switch_core_hash_destroy(&globals.db_hash);     
+       switch_core_hash_destroy(&globals.db_hash);
        switch_core_hash_destroy(&globals.remote_hash);
 
        switch_thread_rwlock_unlock(globals.limit_hash_rwlock);
index f108e1ac7569b4bef7377215e6939ff02e4ac797..a5fbec1da8ddaa9a5cd58f6bed558029006b21d5 100644 (file)
@@ -119,7 +119,7 @@ switch_status_t hiredis_profile_create(hiredis_profile_t **new_profile, char *na
 {
        hiredis_profile_t *profile = NULL;
        switch_memory_pool_t *pool = NULL;
-       
+
        switch_core_new_memory_pool(&pool);
 
        profile = switch_core_alloc(pool, sizeof(hiredis_profile_t));
index 95e1503a0ce604456651a72b504df02db42bface..e90ba6c1ee512e39d1cae0d74dc7a3a40548eea6 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <mod_hiredis.h>
 
-switch_status_t mod_hiredis_do_config() 
+switch_status_t mod_hiredis_do_config()
 {
        char *conf = "hiredis.conf";
        switch_xml_t xml, cfg, profiles, profile, connections, connection, params, param;
@@ -43,7 +43,7 @@ switch_status_t mod_hiredis_do_config()
        }
 
        if ( (profiles = switch_xml_child(cfg, "profiles")) != NULL) {
-               for (profile = switch_xml_child(profiles, "profile"); profile; profile = profile->next) {               
+               for (profile = switch_xml_child(profiles, "profile"); profile; profile = profile->next) {
                        hiredis_profile_t *new_profile = NULL;
                        uint8_t ignore_connect_fail = 0;
                        uint8_t ignore_error = 0;
@@ -79,10 +79,10 @@ switch_status_t mod_hiredis_do_config()
 
                        /* Add connection to profile */
                        if ( (connections = switch_xml_child(profile, "connections")) != NULL) {
-                               for (connection = switch_xml_child(connections, "connection"); connection; connection = connection->next) {             
+                               for (connection = switch_xml_child(connections, "connection"); connection; connection = connection->next) {
                                        char *host = NULL, *password = NULL;
                                        uint32_t port = 0, timeout_ms = 0, max_connections = 0;
-                                       
+
                                        for (param = switch_xml_child(connection, "param"); param; param = param->next) {
                                                char *var = (char *) switch_xml_attr_soft(param, "name");
                                                if ( !strncmp(var, "hostname", 8) ) {
@@ -114,9 +114,9 @@ switch_status_t mod_hiredis_do_config()
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profiles config is missing\n");
                goto err;
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
-       
+
  err:
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Configuration failed\n");
        return SWITCH_STATUS_GENERR;
index 6fe1a2db70a613d6c3280c77d6fb63f8aa9376a2..7472c0298aab3e0ace31e38068ce1728950b501a 100644 (file)
@@ -457,7 +457,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hiredis_shutdown)
        }
 
        switch_core_hash_destroy(&(mod_hiredis_globals.profiles));
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index 68ab548183f4acd6a1ccd144ab32af2366eefa60..e6435667034222518c1b9a9ef715ee221b296822 100644 (file)
        <permission name="set-vars" value="false">
          <!-- default to "deny" or "allow" -->
          <!-- type attr can be "deny" or "allow" nothing defaults to opposite of the list default so allow in this case -->
-         <!-- 
+         <!--
          <variable-list default="deny">
            <variable name="caller_id_name"/>
-           <variable name="hangup"/> 
+           <variable name="hangup"/>
          </variable-list>
          -->
        </permission>
        <permission name="get-vars" value="false">
          <!-- default to "deny" or "allow" -->
          <!-- type attr can be "deny" or "allow" nothing defaults to opposite of the list default so allow in this case -->
-         <!-- 
+         <!--
          <variable-list default="deny">
            <variable name="caller_id_name"/>
-           <variable name="hangup"/> 
+           <variable name="hangup"/>
          </variable-list>
          -->
        </permission>
        <permission name="expand-vars" value="false">
          <!-- default to "deny" or "allow" -->
          <!-- type attr can be "deny" or "allow" nothing defaults to opposite of the list default so allow in this case -->
-         <!-- 
+         <!--
          <variable-list default="deny">
            <variable name="caller_id_name"/>
-           <variable name="hangup"/> 
+           <variable name="hangup"/>
          </variable-list>
 
          <api-list default="deny">
            <api name="expr"/>
-           <api name="lua"/> 
+           <api name="lua"/>
          </api-list>
          -->
        </permission>
        <permission name="conference" value="true"/>
        <permission name="conference-set-profile" value="false"/>
       </permissions>
-      
+
       <params>
        <!-- default url can be overridden by app data -->
        <param name="gateway-url" value="http://www.freeswitch.org/api/index.cgi" />
-       
+
        <!-- set this to provide authentication credentials to the server -->
        <!--<param name="gateway-credentials" value="muser:mypass"/>-->
        <!--<param name="auth-scheme" value="basic"/>-->
index 59b0148a3549dc8b08c190970a849c7aea738355..76304f4dcaa6daa167cfd485df0fe89d18bc7b57 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Raymond Chandler <intralanman@freeswitch.org>
  * Seven Du <dujinfang@gmail.com>
@@ -238,7 +238,7 @@ SWITCH_STANDARD_API(httapi_api_function)
 static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
 {
        action_binding_t *action_binding = (action_binding_t *) match->user_data;
-       
+
        action_binding->client->matching_action_binding = action_binding;
        action_binding->match_digits = switch_core_strdup(action_binding->client->pool, match->match_digits);
 
@@ -250,7 +250,7 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t
        action_binding_t *action_binding = (action_binding_t *) match->user_data;
 
        action_binding->client->no_matching_action_binding = action_binding;
-       
+
        return SWITCH_STATUS_BREAK;
 }
 
@@ -339,7 +339,7 @@ static switch_status_t parse_get_var(const char *tag_name, client_t *client, swi
        }
 
 
-       if (client->profile->perms.get_vars && 
+       if (client->profile->perms.get_vars &&
                (!client->profile->var_params.get_var_list || switch_event_check_permission_list(client->profile->var_params.get_var_list, var))) {
                const char *vval = switch_channel_get_variable(client->channel, var);
                if (vval) {
@@ -351,12 +351,12 @@ static switch_status_t parse_get_var(const char *tag_name, client_t *client, swi
        }
 
        return SWITCH_STATUS_SUCCESS;
-       
+
 }
 
 static switch_status_t parse_continue(const char *tag_name, client_t *client, switch_xml_t tag, const char *body)
 {
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -364,7 +364,7 @@ static switch_status_t parse_log(const char *tag_name, client_t *client, switch_
 {
        const char *level = switch_xml_attr(tag, "level");
        const char *clean = switch_xml_attr(tag, "clean");
-       
+
        if (switch_true(clean)) {
                console_clean_log(level, body);
        } else {
@@ -414,7 +414,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
                say_method = switch_xml_attr(tag, "method");
                say_gender = switch_xml_attr(tag, "gender");
                text = switch_xml_attr(tag, "text");
-               
+
                if (zstr(text)) {
                        if (!zstr(file)) {
                                text = file;
@@ -427,9 +427,9 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "speak: missing required attributes or text! (language) (type) (method) \n");
                        return SWITCH_STATUS_FALSE;
                }
-               
+
                say = 1;
-               
+
        } else if (!strcasecmp(tag_name, "speak")) {
                tts_engine = switch_xml_attr(tag, "engine");
                tts_voice = switch_xml_attr(tag, "voice");
@@ -470,7 +470,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
                char *p;
 
                SWITCH_STANDARD_STREAM(stream);
-               
+
                cmd = switch_mprintf("%s|name_path", id);
 
                switch_api_execute("vm_prefs", cmd, NULL, &stream);
@@ -501,7 +501,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
 
                        text = free_string;
                        switch_ivr_play_file(client->session, NULL, "voicemail/vm-person.wav", &nullargs);
-                       
+
                }
 
                switch_safe_free(resp);
@@ -527,7 +527,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid digit timeout [%s]\n", digit_timeout_);
                }
        }
-       
+
        if (input_timeout_) {
                tmp = atol(input_timeout_);
 
@@ -541,7 +541,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
        if ((bind = switch_xml_child(tag, "bind"))) {
                action_binding_t *action_binding;
                const char *realm = "default";
-       
+
 
                input++;
 
@@ -550,9 +550,9 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
                top_action_binding->action = (char *) action;
                top_action_binding->error_file = (char *)error_file;
 
-               switch_ivr_dmachine_create(&dmachine, "HTTAPI", NULL, digit_timeout, 0, 
+               switch_ivr_dmachine_create(&dmachine, "HTTAPI", NULL, digit_timeout, 0,
                                                                   NULL, digit_nomatch_action_callback, top_action_binding);
-               
+
                while(bind) {
                        action_binding = switch_core_session_alloc(client->session, sizeof(*action_binding));
                        action_binding->realm = (char *) realm;
@@ -562,11 +562,11 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
                        action_binding->strip = (char *) switch_xml_attr(bind, "strip");
                        action_binding->error_file = (char *) error_file;
                        action_binding->parent = top_action_binding;
-                       
+
                        switch_ivr_dmachine_bind(dmachine, action_binding->realm, action_binding->input, 0, 0, digit_action_callback, action_binding);
                        bind = bind->next;
                }
-               
+
                switch_ivr_dmachine_set_realm(dmachine, realm);
                if (!zstr(terminators)) {
                        switch_ivr_dmachine_set_terminators(dmachine, terminators);
@@ -597,7 +597,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
                        char *result = NULL;
 
                        status = switch_ivr_play_and_detect_speech(client->session, file, sp_engine, sp_grammar, &result, input_timeout, args);
-                       
+
                        if (!zstr(result)) {
                                switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, name, result);
                                switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "input_type", "detected_speech");
@@ -642,7 +642,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
                        break;
                }
        } while (loops-- > 0);
-       
+
 
        if (submit) {
                if (client->matching_action_binding) {
@@ -660,26 +660,26 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
                                switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, name, client->matching_action_binding->match_digits);
                                switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "input_type", "dtmf");
                        }
-                       
+
                        if (client->matching_action_binding->action) {
                                sub_action = client->matching_action_binding->action;
                        } else if (client->matching_action_binding->parent && client->matching_action_binding->parent->action) {
                                sub_action = client->matching_action_binding->parent->action;
                        }
                }
-               
+
                if (!sub_action && top_action_binding && top_action_binding->action) {
                        sub_action = top_action_binding->action;
                }
-               
+
                if (sub_action && client->matching_action_binding && client->matching_action_binding->match_digits) {
                        if (!strncasecmp(sub_action, "dial:", 5)) {
                                char *context = NULL;
                                char *dp = NULL;
-                               
+
                                if (client->profile->perms.dial.set_context) {
                                        context = switch_core_session_strdup(client->session, sub_action + 5);
-                                       
+
                                        if ((dp = strchr(context, ':'))) {
                                                *dp++ = '\0';
                                                if (!client->profile->perms.dial.set_dp) {
@@ -690,19 +690,19 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw
 
                                switch_ivr_session_transfer(client->session, client->matching_action_binding->match_digits, dp, context);
                                status = SWITCH_STATUS_FALSE;
-                               
+
                        } else {
                                switch_event_add_header_string(client->params, SWITCH_STACK_BOTTOM, "url", sub_action);
                        }
                }
        }
-       
+
        if (dmachine) {
                switch_ivr_dmachine_destroy(&dmachine);
        }
 
        switch_safe_free(free_string);
-       
+
        return status;
 }
 
@@ -713,7 +713,7 @@ static switch_status_t parse_conference(const char *tag_name, client_t *client,
        const char *profile_name = switch_xml_attr(tag, "profile");
        const char *pin = switch_xml_attr(tag, "pin");
        const char *flags = switch_xml_attr(tag, "flags");
-       
+
        if (!client->profile->perms.conference.enabled) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Permission Denied!\n");
                switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -742,7 +742,7 @@ static switch_status_t parse_conference(const char *tag_name, client_t *client,
 
 static switch_status_t parse_dial(const char *tag_name, client_t *client, switch_xml_t tag, const char *body)
 {
-       const char *context = NULL; 
+       const char *context = NULL;
        const char *dp = NULL;
        const char *cid_name = NULL;
        const char *cid_number = NULL;
@@ -779,7 +779,7 @@ static switch_status_t parse_dial(const char *tag_name, client_t *client, switch
                        cid_number = switch_channel_get_variable(client->channel, "caller_id_number");
                }
 
-               str = switch_core_session_sprintf(client->session, 
+               str = switch_core_session_sprintf(client->session,
                                                                                  "{origination_caller_id_name='%s',origination_caller_id_number='%s'}%s", cid_name, cid_number, body);
 
                switch_core_session_execute_application(client->session, "bridge", str);
@@ -812,7 +812,7 @@ static switch_status_t parse_sms(const char *tag_name, client_t *client, switch_
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", switch_channel_get_variable(client->channel, "caller_id_number"));
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to);
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "text/plain");
-               
+
                if (body) {
                        switch_event_add_body(event, "%s", body);
                }
@@ -856,7 +856,7 @@ static switch_status_t parse_execute(const char *tag_name, client_t *client, swi
 
        if (!client->profile->perms.expand_vars) {
                const char *p;
-               
+
                for(p = data; p && *p; p++) {
                        if (*p == '$') {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Expand Variables: Permission Denied!\n");
@@ -929,16 +929,16 @@ static switch_status_t parse_record_call(const char *tag_name, client_t *client,
        } else {
                client->record.action = (char *) action;
                client->record.name = (char *)name;
-               client->record.file = switch_core_session_sprintf(client->session, "%s%s%s.wav", 
+               client->record.file = switch_core_session_sprintf(client->session, "%s%s%s.wav",
                                                                                                                  SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(client->session));
                record_file = client->record.file;
        }
-       
+
        if (limit_) {
                limit = atoi(limit_);
                if (limit < 0) limit = 0;
        }
-       
+
 
        switch_ivr_record_session(client->session, (char *)record_file, limit, NULL);
 
@@ -982,7 +982,7 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit
        if (zstr(file)) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        fname = switch_core_strdup(client->pool, file);
 
        for(p = fname; p && *p; p++) {
@@ -1006,7 +1006,7 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit
                tmp_record_path = fname;
                http = 1;
        } else {
-               tmp_record_path = switch_core_sprintf(client->pool, "%s%s%s_%s.%s", 
+               tmp_record_path = switch_core_sprintf(client->pool, "%s%s%s_%s.%s",
                                                                                          SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str, fname, ext);
        }
 
@@ -1045,19 +1045,19 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid digit timeout [%s]\n", digit_timeout_);
                }
        }
-       
+
        if ((bind = switch_xml_child(tag, "bind"))) {
                action_binding_t *action_binding;
                const char *realm = "default";
-               
+
                top_action_binding = switch_core_session_alloc(client->session, sizeof(*action_binding));
                top_action_binding->client = client;
                top_action_binding->action = (char *) action;
                top_action_binding->error_file = (char *)error_file;
 
-               switch_ivr_dmachine_create(&dmachine, "HTTAPI", NULL, digit_timeout, 0, 
+               switch_ivr_dmachine_create(&dmachine, "HTTAPI", NULL, digit_timeout, 0,
                                                                   NULL, digit_nomatch_action_callback, top_action_binding);
-               
+
                while(bind) {
                        action_binding = switch_core_session_alloc(client->session, sizeof(*action_binding));
                        action_binding->realm = (char *) realm;
@@ -1066,11 +1066,11 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit
                        action_binding->action = (char *) switch_xml_attr(bind, "action");
                        action_binding->error_file = (char *) error_file;
                        action_binding->parent = top_action_binding;
-                       
+
                        switch_ivr_dmachine_bind(dmachine, action_binding->realm, action_binding->input, 0, 0, digit_action_callback, action_binding);
                        bind = bind->next;
                }
-               
+
                switch_ivr_dmachine_set_realm(dmachine, realm);
                if (!zstr(terminators)) {
                        switch_ivr_dmachine_set_terminators(dmachine, terminators);
@@ -1092,7 +1092,7 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit
                switch_file_handle_t fh = { 0 };
                fh.thresh = thresh;
                fh.silence_hits = silence_hits;
-               
+
                status = switch_ivr_record_file(client->session, &fh, tmp_record_path, args, record_limit);
        }
 
@@ -1142,7 +1142,7 @@ static switch_status_t parse_common(const char *tag_name, client_t *client, swit
        if (tmp_action) {
                switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "url", tmp_action);
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1155,7 +1155,7 @@ static switch_status_t parse_xml(client_t *client)
 
        if ((len = switch_buffer_peek_zerocopy(client->buffer, &bdata)) && switch_buffer_len(client->buffer) > len) {
                switch_xml_t xml, tag, category;
-               
+
                if (globals.debug) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Debugging Return Data:\n%s\n", (char *)bdata);
                }
@@ -1165,7 +1165,7 @@ static switch_status_t parse_xml(client_t *client)
                        if (client->profile->perms.set_params) {
                                if ((category = switch_xml_child(xml, "params"))) {
                                        tag = category->child;
-                                       
+
                                        while(tag) {
                                                if (!zstr(tag->name)) {
                                                        char *val = tag->txt;
@@ -1182,7 +1182,7 @@ static switch_status_t parse_xml(client_t *client)
                        if (client->profile->perms.set_vars) {
                                if ((category = switch_xml_child(xml, "variables"))) {
                                        tag = category->child;
-                                       
+
                                        while(tag) {
                                                if (!zstr(tag->name)) {
                                                        char *val = tag->txt;
@@ -1190,8 +1190,8 @@ static switch_status_t parse_xml(client_t *client)
                                                                val = NULL;
                                                        }
 
-                                                       if (client->profile->perms.set_vars && 
-                                                               (!client->profile->var_params.set_var_list || 
+                                                       if (client->profile->perms.set_vars &&
+                                                               (!client->profile->var_params.set_var_list ||
                                                                 switch_event_check_permission_list(client->profile->var_params.set_var_list, tag->name))) {
                                                                switch_channel_set_variable(client->channel, tag->name, val);
                                                        } else {
@@ -1204,7 +1204,7 @@ static switch_status_t parse_xml(client_t *client)
                        }
 
                        if ((category = switch_xml_child(xml, "work"))) {
-                               
+
                                tag = category->child;
                                status = SWITCH_STATUS_SUCCESS;
 
@@ -1219,18 +1219,18 @@ static switch_status_t parse_xml(client_t *client)
                                                        if (tag->txt && client->profile->perms.expand_vars) {
                                                                switch_channel_get_variables(client->channel, &templ_data);
                                                                switch_event_merge(templ_data, client->params);
-                                                               expanded = switch_event_expand_headers_check(templ_data, tag->txt, 
-                                                                                                                                                        client->profile->var_params.expand_var_list, 
+                                                               expanded = switch_event_expand_headers_check(templ_data, tag->txt,
+                                                                                                                                                        client->profile->var_params.expand_var_list,
                                                                                                                                                         client->profile->var_params.api_list, 0);
                                                                switch_event_destroy(&templ_data);
                                                        }
 
                                                        runs++;
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Process Tag: [%s]\n", tag->name);
-                                                       
+
                                                        parse_common(tag->name, client, tag, expanded);
                                                        status = handler(tag->name, client, tag, expanded);
-                                                       
+
                                                        if (expanded && expanded != tag->txt) {
                                                                free(expanded);
                                                        }
@@ -1249,15 +1249,15 @@ static switch_status_t parse_xml(client_t *client)
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No instructions found in result!\n");
                                status = SWITCH_STATUS_FALSE;
                        }
-                       
+
 
                        switch_xml_free(xml);
                }
        }
-       
+
        return status;
 }
-       
+
 
 static size_t get_header_callback(void *ptr, size_t size, size_t nmemb, void *userdata)
 {
@@ -1285,7 +1285,7 @@ static size_t get_header_callback(void *ptr, size_t size, size_t nmemb, void *us
 
                switch_event_add_header_string(client->headers, SWITCH_STACK_BOTTOM, header, val);
        }
-       
+
        switch_safe_free(header);
        return realsize;
 }
@@ -1305,7 +1305,7 @@ static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
        }
 
        switch_buffer_write(client->buffer, ptr, realsize);
-       
+
        return realsize;
 }
 
@@ -1313,7 +1313,7 @@ static void client_destroy(client_t **client)
 {
        if (client && *client) {
                switch_memory_pool_t *pool;
-               
+
                switch_event_destroy(&(*client)->headers);
                switch_event_destroy(&(*client)->params);
                switch_event_destroy(&(*client)->one_time_params);
@@ -1333,7 +1333,7 @@ static void client_reset(client_t *client)
        switch_event_destroy(&client->one_time_params);
        switch_event_create(&client->one_time_params, SWITCH_EVENT_CLONE);
        client->one_time_params->flags |= EF_UNIQ_HEADERS;
-       
+
        switch_event_create(&client->headers, SWITCH_EVENT_CLONE);
 
 
@@ -1367,13 +1367,13 @@ static client_t *client_create(switch_core_session_t *session, const char *profi
        client->pool = pool;
 
        switch_event_create(&client->headers, SWITCH_EVENT_CLONE);
-       
+
        if (session) {
                client->session = session;
                client->channel = switch_core_session_get_channel(session);
        }
 
-       
+
        client->profile = profile;
 
        client->max_bytes = HTTAPI_MAX_API_BYTES;
@@ -1406,7 +1406,7 @@ static void cleanup_attachments(client_t *client)
                        if (switch_file_exists(hp->value, client->pool) == SWITCH_STATUS_SUCCESS) {
                                unlink(hp->value);
                        }
-               }       
+               }
        }
 }
 
@@ -1416,7 +1416,7 @@ size_t put_file_read( void *ptr, size_t size, size_t nmemb, void *userdata)
 }
 
 static switch_status_t httapi_sync(client_t *client)
-                                                                 
+
 {
        switch_CURL *curl_handle = NULL;
        char *data = NULL;
@@ -1433,7 +1433,7 @@ static switch_status_t httapi_sync(client_t *client)
        FILE *fd = NULL;
        char *creds, *dup_creds = NULL, *ua = NULL;
 
-       
+
        if (client->one_time_params && client->one_time_params->headers) {
                save_params = client->params;
                switch_event_dup(&client->params, save_params);
@@ -1449,7 +1449,7 @@ static switch_status_t httapi_sync(client_t *client)
        if (zstr(ua)) {
                ua = client->profile->ua;
        }
-       
+
        if (!(session_id = switch_event_get_header(client->params, "HTTAPI_SESSION_ID"))) {
                if (client->channel && !(session_id = switch_channel_get_variable(client->channel, "HTTAPI_SESSION_ID"))) {
                        session_id = switch_core_session_get_uuid(client->session);
@@ -1471,7 +1471,7 @@ static switch_status_t httapi_sync(client_t *client)
        }
 
        get_style_method = method ? strcasecmp(method, "post") : 1;
-       
+
        switch_event_add_header_string(client->params, SWITCH_STACK_TOP, "session_id", session_id);
 
        dynamic_url = switch_event_expand_headers(client->params, url);
@@ -1484,7 +1484,7 @@ static switch_status_t httapi_sync(client_t *client)
        }
 
        if (!put_file) {
-               switch_curl_process_form_post_params(client->params, curl_handle, &formpost);   
+               switch_curl_process_form_post_params(client->params, curl_handle, &formpost);
        }
 
        if (formpost) {
@@ -1495,11 +1495,11 @@ static switch_status_t httapi_sync(client_t *client)
 
                if (get_style_method) {
                        char *tmp = switch_mprintf("%s%c%s", dynamic_url, strchr(dynamic_url, '?') != NULL ? '&' : '?', data);
-               
+
                        if (dynamic_url != url) {
                                free(dynamic_url);
                        }
-               
+
                        dynamic_url = tmp;
                }
        }
@@ -1525,7 +1525,7 @@ static switch_status_t httapi_sync(client_t *client)
                                        if ((p = strstr(q, "://"))) {
                                                *(p+3) = '\0';
                                        }
-               
+
                                        p = switch_mprintf("%s%s", q, r);
                                        if (p) {
                                                free(dynamic_url);
@@ -1546,9 +1546,9 @@ static switch_status_t httapi_sync(client_t *client)
                *p = '\0';
 
                if ((q = strchr(dup_creds, '@'))) *q = '\0';
-               
+
                creds = dup_creds;
-               
+
                p = switch_mprintf("%s%s", p, use_url);
                free(dynamic_url);
                dynamic_url = p;
@@ -1593,7 +1593,7 @@ static switch_status_t httapi_sync(client_t *client)
                curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1L);
                curl_easy_setopt(curl_handle, CURLOPT_READDATA, fd);
                curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, put_file_read);
-               
+
        } else if (formpost) {
                curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, formpost);
        } else {
@@ -1646,7 +1646,7 @@ static switch_status_t httapi_sync(client_t *client)
        } else {
                switch_curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
        }
-       
+
 
        if (client->profile->ssl_cacert_file) {
                switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, client->profile->ssl_cacert_file);
@@ -1891,7 +1891,7 @@ static switch_status_t do_config(void)
                profile->perms.set_params = 1;
                profile->perms.conference.enabled = 1;
                profile->perms.dial.enabled = 1;
-               
+
 
                if ((tag = switch_xml_child(profile_tag, "conference"))) {
                        for (param = switch_xml_child(tag, "param"); param; param = param->next) {
@@ -1937,7 +1937,7 @@ static switch_status_t do_config(void)
                                                switch_xml_t x_list, x_var;
                                                if ((x_list = switch_xml_child(param, "variable-list"))) {
                                                        char *var = (char *) switch_xml_attr_soft(param, "default");
-                                                       
+
                                                        profile->var_params.default_allow = (var && !strcasecmp(var, "allow"));
                                                        switch_event_create(&profile->var_params.set_var_list, SWITCH_EVENT_CLONE);
                                                        profile->var_params.set_var_list->flags |= EF_UNIQ_HEADERS;
@@ -1965,7 +1965,7 @@ static switch_status_t do_config(void)
                                                switch_xml_t x_list, x_var;
                                                if ((x_list = switch_xml_child(param, "variable-list"))) {
                                                        char *var = (char *) switch_xml_attr_soft(param, "default");
-                                                       
+
                                                        profile->var_params.default_allow = (var && !strcasecmp(var, "allow"));
                                                        switch_event_create(&profile->var_params.get_var_list, SWITCH_EVENT_CLONE);
                                                        profile->var_params.get_var_list->flags |= EF_UNIQ_HEADERS;
@@ -1990,12 +1990,12 @@ static switch_status_t do_config(void)
                                        profile->perms.extended_data = switch_true_byte(val);
                                } else if (!strcasecmp(var, "execute-apps")) {
                                        profile->perms.execute_apps = switch_true_byte(val);
-                                       
+
                                        if (profile->perms.execute_apps) {
                                                switch_xml_t x_list, x_app;
                                                if ((x_list = switch_xml_child(param, "application-list"))) {
                                                        char *var = (char *) switch_xml_attr_soft(param, "default");
-                                                       
+
                                                        profile->dial_params.default_allow = (var && !strcasecmp(var, "allow"));
                                                        switch_event_create(&profile->dial_params.app_list, SWITCH_EVENT_CLONE);
                                                        profile->dial_params.app_list->flags |= EF_UNIQ_HEADERS;
@@ -2016,7 +2016,7 @@ static switch_status_t do_config(void)
                                                        }
                                                }
                                        }
-                                       
+
                                } else if (!strcasecmp(var, "expand-vars")) {
                                        profile->perms.expand_vars = switch_true_byte(val);
 
@@ -2024,7 +2024,7 @@ static switch_status_t do_config(void)
                                                switch_xml_t x_list, x_var, x_api;
                                                if ((x_list = switch_xml_child(param, "variable-list"))) {
                                                        char *var = (char *) switch_xml_attr_soft(param, "default");
-                                                       
+
                                                        profile->var_params.default_allow = (var && !strcasecmp(var, "allow"));
                                                        switch_event_create(&profile->var_params.expand_var_list, SWITCH_EVENT_CLONE);
                                                        profile->var_params.expand_var_list->flags |= EF_UNIQ_HEADERS;
@@ -2047,7 +2047,7 @@ static switch_status_t do_config(void)
 
                                                if ((x_list = switch_xml_child(param, "api-list"))) {
                                                        char *api = (char *) switch_xml_attr_soft(param, "default");
-                                                       
+
                                                        profile->var_params.default_allow = (api && !strcasecmp(api, "allow"));
                                                        switch_event_create(&profile->var_params.api_list, SWITCH_EVENT_CLONE);
                                                        profile->var_params.api_list->flags |= EF_UNIQ_HEADERS;
@@ -2202,7 +2202,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
        }
 
        switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "exiting", "true");
-       
+
        if (client->record.file) {
                char *key = switch_core_sprintf(client->pool, "attach_file:%s:%s.wav", client->record.name, switch_core_session_get_uuid(session));
                switch_ivr_stop_record_session(client->session, client->record.file);
@@ -2221,7 +2221,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                        switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "exiting", "true");
                }
        }
-       
+
        httapi_sync(client);
 
        client_destroy(&client);
@@ -2264,7 +2264,7 @@ SWITCH_STANDARD_APP(httapi_function)
                } else {
                        url = data;
                }
-               
+
                if (!zstr(url) && switch_stristr("://", url)) {
                        if (!params) {
                                switch_event_create(&params, SWITCH_EVENT_CLONE);
@@ -2288,7 +2288,7 @@ SWITCH_STANDARD_APP(httapi_function)
                if (zstr(profile_name) && !(profile_name = switch_channel_get_variable(channel, "httapi_profile"))) {
                        profile_name = "default";
                }
-               
+
                if ((client = client_create(session, profile_name, &params))) {
                        switch_channel_set_private(channel, "_HTTAPI_CLIENT_", client);
                        switch_channel_add_state_handler(channel, &state_handlers);
@@ -2346,7 +2346,7 @@ SWITCH_STANDARD_APP(httapi_function)
 
 
        switch_safe_free(parsed);
-       
+
 }
 
 
@@ -2355,7 +2355,7 @@ SWITCH_STANDARD_APP(httapi_function)
 static const char *find_ext(const char *in)
 {
        const char *p = in + (strlen(in) - 1);
-       
+
        while(p >= in && *p) {
                if (*p == '/') return NULL;
                if (*p == '.') return (p+1);
@@ -2379,11 +2379,11 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
        if (context->url_params) {
                ext = switch_event_get_header(context->url_params, "ext");
        }
-       
+
        if (zstr(ext)) {
                ext = find_ext(url);
        }
-       
+
        if (ext && (p = strchr(ext, '?'))) {
                dext = strdup(ext);
                if ((p = strchr(dext, '?'))) {
@@ -2432,7 +2432,7 @@ static size_t save_file_callback(void *ptr, size_t size, size_t nmemb, void *dat
        unsigned char *buffer = (unsigned char *) ptr;
 
        client->bytes += realsize;
-       
+
        if (client->bytes > client->max_bytes) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int) client->bytes);
                client->err = 1;
@@ -2468,14 +2468,14 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char
        const char *profile_name = NULL;
        int tries = 10;
 
-       if (context->url_params) { 
+       if (context->url_params) {
                profile_name = switch_event_get_header(context->url_params, "profile_name");
        }
 
        if (zstr(profile_name)) {
                if (globals.profile) profile_name = globals.profile->name;
        }
-       
+
        if (zstr(profile_name)) {
                profile_name = "default";
        }
@@ -2500,7 +2500,7 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char
        if (context->url_params) {
                ua = switch_event_get_header(context->url_params, "user_agent");
        }
-       
+
        if (zstr(ua)) {
                ua = "mod_httapi/1.0";
        }
@@ -2520,7 +2520,7 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char
                if ((p = strstr(q, "://"))) {
                        *(p+3) = '\0';
                }
-               
+
                p = switch_mprintf("%s%s", q, r);
                dynamic_url = p;
                free(q);
@@ -2617,12 +2617,12 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char
                switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
                switch_curl_easy_setopt(curl_handle, CURLOPT_USERPWD, dup_creds);
        }
-       
+
        switch_curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, ua);
        switch_curl_easy_perform(curl_handle);
        switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &code);
        switch_curl_easy_cleanup(curl_handle);
-       
+
        if (client->fd > -1) {
                close(client->fd);
                client->fd = -1;
@@ -2645,7 +2645,7 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char
        case 404:
                status = SWITCH_STATUS_NOTFOUND;
                break;
-               
+
        default:
                status = SWITCH_STATUS_FALSE;
                break;
@@ -2695,7 +2695,7 @@ static switch_status_t write_meta_file(http_file_context_t *context, const char
                } else if (headers && (cc = switch_event_get_header(headers, "Cache-Control"))) {
                        if ((p = switch_stristr("max-age=", cc))) {
                                p += 8;
-                               
+
                                if (!zstr(p)) {
                                        x = atoi(p);
 
@@ -2710,11 +2710,11 @@ static switch_status_t write_meta_file(http_file_context_t *context, const char
                        }
                }
 
-               switch_snprintf(write_data, sizeof(write_data), 
+               switch_snprintf(write_data, sizeof(write_data),
                                                "%" TIME_T_FMT ":%s",
                                                switch_epoch_time_now(NULL) + ttl,
                                                data);
-               
+
 
                status = write(fd, write_data, (int)strlen(write_data) + 1) > 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
        }
@@ -2737,7 +2737,7 @@ static void lock_file(http_file_context_t *context, switch_bool_t lock)
                                switch_yield(100000);
                        }
                } while(x);
-               
+
                switch_core_hash_insert(globals.request_hash, context->dest_url, (void *)1);
                switch_mutex_unlock(globals.request_mutex);
        } else {
@@ -2768,7 +2768,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
        if (context->url_params) {
                ext = switch_event_get_header(context->url_params, "ext");
        }
-       
+
        if (zstr(ext)) {
                ext = find_ext(context->cache_file);
        }
@@ -2787,7 +2787,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
                                unreachable = 1;
                        }
                }
-               
+
                if (zstr(ext) && headers && (ct = switch_event_get_header(headers, "content-type"))) {
                        newext = switch_core_mime_type2ext(ct);
                }
@@ -2803,7 +2803,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
                        status = SWITCH_STATUS_NOTFOUND;
                        goto end;
                }
-               
+
                if (!unreachable && !zstr(context->metadata)) {
                        metadata = switch_core_sprintf(context->pool, "%s:%s:%s:%s:%s",
                                                                                   url,
@@ -2818,7 +2818,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
                                switch_goto_status(SWITCH_STATUS_SUCCESS, end);
                        }
                }
-               
+
                switch_event_destroy(&headers);
        }
 
@@ -2836,9 +2836,9 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
                                                                   switch_event_get_header_nil(headers, "content-length"),
                                                                   ext
                                                                   );
-       
+
        write_meta_file(context, metadata, headers);
-       
+
        if (switch_file_exists(context->cache_file, context->pool) == SWITCH_STATUS_SUCCESS) {
                status = SWITCH_STATUS_SUCCESS;
        }
@@ -2851,7 +2851,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
        }
 
        switch_event_destroy(&headers);
-       
+
        return status;
 }
 
@@ -2916,21 +2916,21 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path,
                context->fh.samples = handle->samples;
                context->fh.samplerate = handle->samplerate;
                context->fh.prefix = handle->prefix;
-               
-               
+
+
                if (context->url_params) {
                        context->write.file_name = switch_event_get_header(context->url_params, "file");
                        context->write.profile_name = switch_event_get_header(context->url_params, "profile");
                        context->write.method = switch_event_get_header(context->url_params, "method");
                        context->write.name = switch_event_get_header(context->url_params, "name");
                }
-               
+
                if (!context->write.file_name) {
                        char *p;
                        if ((p = strrchr(context->dest_url, '/'))) {
                                p++;
                                context->write.file_name = switch_core_strdup(context->pool, p);
-                       }       
+                       }
                }
 
                if (!context->write.file_name) {
@@ -2943,16 +2943,16 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path,
                } else {
                        ext = "wav";
                }
-               
+
                if (!context->write.profile_name) context->write.profile_name = "default";
                if (!context->write.method) context->write.method = !strcasecmp(ext, "cgi") ? "post" : "put";
                if (!context->write.name) context->write.name = "recorded_file";
 
                switch_uuid_str(context->write.uuid_str, sizeof(context->write.uuid_str));
-               
+
                context->write.file = switch_core_sprintf(context->pool, "%s%s%s_%s",
                                                                                                  SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, context->write.uuid_str, context->write.file_name);
-               
+
 
                if (switch_core_file_open(&context->fh, context->write.file, handle->channels, handle->samplerate, handle->flags, NULL) != SWITCH_STATUS_SUCCESS) {
                        return SWITCH_STATUS_GENERR;
@@ -2971,11 +2971,11 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path,
                if (status != SWITCH_STATUS_SUCCESS) {
                        return status;
                }
-               
+
                if ((status = switch_core_file_open(&context->fh,
-                                                                                       context->cache_file, 
-                                                                                       handle->channels, 
-                                                                                       handle->samplerate, 
+                                                                                       context->cache_file,
+                                                                                       handle->channels,
+                                                                                       handle->samplerate,
                                                                                        handle->flags, NULL)) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid cache file %s opening url %s Discarding file.\n", context->cache_file, path);
                        unlink(context->cache_file);
@@ -3051,12 +3051,12 @@ static switch_status_t http_file_file_close(switch_file_handle_t *handle)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find suitable profile\n");
                        switch_event_destroy(&params);
                }
-                       
+
                unlink(context->write.file);
                return SWITCH_STATUS_SUCCESS;
        }
 
-       
+
        if (context->del_on_close) {
                if (context->cache_file) {
                        unlink(context->cache_file);
@@ -3075,7 +3075,7 @@ static switch_status_t http_file_file_close(switch_file_handle_t *handle)
 static switch_status_t http_file_read_video(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags)
 {
        http_file_context_t *context = handle->private_info;
-       
+
        return switch_core_file_read_video(&context->fh, frame, flags);
 }
 
@@ -3089,7 +3089,7 @@ static switch_status_t http_file_write_video(switch_file_handle_t *handle, switc
 static switch_status_t http_file_write(switch_file_handle_t *handle, void *data, size_t *len)
 {
        http_file_context_t *context = handle->private_info;
-       
+
        return switch_core_file_write(&context->fh, data, len);
 }
 
@@ -3127,7 +3127,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load)
        switch_application_interface_t *app_interface;
        switch_file_interface_t *http_file_interface;
        switch_file_interface_t *https_file_interface;
-       
+
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -3165,11 +3165,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load)
        https_file_interface->file_seek = http_file_file_seek;
        https_file_interface->file_read_video = http_file_read_video;
        https_file_interface->file_write_video = http_file_write_video;
-       
+
        switch_snprintf(globals.cache_path, sizeof(globals.cache_path), "%s%shttp_file_cache", SWITCH_GLOBAL_dirs.storage_dir, SWITCH_PATH_SEPARATOR);
        switch_dir_make_recursive(globals.cache_path, SWITCH_DEFAULT_DIR_PERMS, pool);
 
-       
+
        switch_core_hash_init(&globals.profile_hash);
        switch_core_hash_init(&globals.request_hash);
        switch_core_hash_init_case(&globals.parse_hash, SWITCH_FALSE);
@@ -3198,14 +3198,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load)
        if (do_config() != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        SWITCH_ADD_API(httapi_api_interface, "httapi",
                                   "HT-TAPI Hypertext Telephony API", httapi_api_function, HTTAPI_SYNTAX);
 
-       SWITCH_ADD_APP(app_interface, "httapi", 
-                                  "HT-TAPI Hypertext Telephony API", 
+       SWITCH_ADD_APP(app_interface, "httapi",
+                                  "HT-TAPI Hypertext Telephony API",
                                   "HT-TAPI Hypertext Telephony API", httapi_function, "{<param1>=<val1>}", SAF_SUPPORT_NOMEDIA);
-                                  
+
 
 
        switch_console_set_complete("add httapi debug_on");
@@ -3233,9 +3233,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_httapi_shutdown)
        }
 
 
-       switch_core_hash_destroy(&globals.profile_hash);        
-       switch_core_hash_destroy(&globals.parse_hash);  
-               
+       switch_core_hash_destroy(&globals.profile_hash);
+       switch_core_hash_destroy(&globals.parse_hash);
+
        while (globals.hash_root) {
                ptr = globals.hash_root;
                switch_core_hash_destroy(&ptr->hash);
index 92c88e54b99e6697af64086e3052164f184f0850..6e753d3f53b681310d959fa9962495202e484ac5 100644 (file)
@@ -359,7 +359,7 @@ static switch_status_t http_put(url_cache_t *cache, http_profile_t *profile, swi
                switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
                switch_curl_easy_setopt(curl_handle, CURLOPT_URL, full_url);
 
-               /* we want to use our own read function so we can send a portion of the file */ 
+               /* we want to use our own read function so we can send a portion of the file */
                switch_curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, read_callback);
                switch_curl_easy_setopt(curl_handle, CURLOPT_READDATA, &block_info);
 
index 77b5ee99f29cc0c70e44e745c8f076eb50a59ced..2608802fbb69ce4b92e2b02697d8ef8576fde293 100644 (file)
@@ -86,7 +86,7 @@ static void test_parse_url(void)
        parse_url(strdup("https://my-bucket-with-dash.s3-us-west-2.amazonaws.com/greeting/file/1002/Lumino.mp3"), NULL, "s3", &bucket, &object);
        ASSERT_STRING_EQUALS("my-bucket-with-dash", bucket);
        ASSERT_STRING_EQUALS("greeting/file/1002/Lumino.mp3", object);
-       
+
        parse_url(strdup("http://quotes.s3.foo.bar.s3.amazonaws.com/greeting/file/1002/Lumino.mp3"), NULL, "s3", &bucket, &object);
        ASSERT_STRING_EQUALS("quotes.s3.foo.bar", bucket);
        ASSERT_STRING_EQUALS("greeting/file/1002/Lumino.mp3", object);
index a26b193ef5a50ae2324ed64c94d0bc3439fe4da5..c950e1b3c086075d0c949ba468a5a3642c706987 100644 (file)
@@ -1,5 +1,5 @@
 <include>
-  
+
   <X-PRE-PROCESS cmd="set" data="AT_EPENT1=0 0 0 -1 -1 0 -1 0 -1 -1 0 -1"/>
   <X-PRE-PROCESS cmd="set" data="AT_EPENT2=1 1 1 -1 -1 1 -1 1 -1 -1 1 -1"/>
   <X-PRE-PROCESS cmd="set" data="AT_CPENT1=0 -1 -1 0 -1 0 0 0 -1 -1 0 -1"/>
@@ -8,9 +8,9 @@
   <X-PRE-PROCESS cmd="set" data="AT_CMAJ2=1 -1 1 1 -1 1 -1 1 1 -1 1 -1"/>
   <X-PRE-PROCESS cmd="set" data="AT_BBLUES=1 -1 1 -1 -1 1 -1 1 1 1 -1 -1"/>
   <X-PRE-PROCESS cmd="set" data="ATGPENT2=-1 1 -1 1 -1 1 -1 -1 1 -1 1 -1"/>
-  
-  <extension name="101"> 
-    <condition field="destination_number" expression="^101$"> 
+
+  <extension name="101">
+    <condition field="destination_number" expression="^101$">
       <!-- AUTOTALENT DEFAULTS -->
 
       <!--
 
 
       <action application="set"><![CDATA[ladspa_params=${AT_TUNE} ${AT_FIXED} ${AT_PULL} ${AT_EPENT2} ${AT_AMOUNT} ${AT_SMOOTH} ${AT_SHIFT} ${AT_OUTSCALE} ${AT_LFODEPTH} ${AT_LFORATE} ${AT_LFOSHAPE} ${AT_LFOSYMM} ${AT_LFOQUANT} ${AT_FCORR} ${AT_FWARP} ${AT_MIX}]]></action>
-      
+
       <action application="ladspa_run" data="r|autotalent||${ladspa_params}"/>
       <action application="ladspa_run" data="r|tap_chorusflanger||"/>
       <action application="ladspa_run" data="r|phasers_1217.so|autoPhaser|"/>
       <action application="bridge" data="sofia/internal/888@conference.freeswitch.org"/>
 
-      </condition> 
-  </extension> 
+      </condition>
+  </extension>
 
 </include>
index ac9df3d1ea802ba56af578a30fb905b2dbf2f14b..2bccfffb9c43cefe6a0fcd6d7754328a00d3a316 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
- * mod_ladspa.c -- LADSPA 
+ * mod_ladspa.c -- LADSPA
  *
  */
 #include <switch.h>
@@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_ladspa_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_ladspa_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_ladspa_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_ladspa, mod_ladspa_load, mod_ladspa_shutdown, NULL);
@@ -68,9 +68,9 @@ typedef struct {
 
 int check_range(const LADSPA_Descriptor *ldesc, int i, LADSPA_Data val)
 {
-       if (ldesc->PortRangeHints[i].LowerBound && ldesc->PortRangeHints[i].UpperBound && 
+       if (ldesc->PortRangeHints[i].LowerBound && ldesc->PortRangeHints[i].UpperBound &&
                (val < ldesc->PortRangeHints[i].LowerBound || val > ldesc->PortRangeHints[i].UpperBound)) {
-               switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Param %f out of bounds %f-%f\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Param %f out of bounds %f-%f\n",
                                                  val, ldesc->PortRangeHints[i].LowerBound, ldesc->PortRangeHints[i].UpperBound);
                return 0;
        }
@@ -79,13 +79,13 @@ int check_range(const LADSPA_Descriptor *ldesc, int i, LADSPA_Data val)
 }
 
 int find_default(const LADSPA_Descriptor *ldesc, int i, LADSPA_Data *ptr)
-                                                
+
 {
        LADSPA_Data dftval = 0;
        int fail = 0;
 
        LADSPA_PortRangeHintDescriptor port_hint = ldesc->PortRangeHints[i].HintDescriptor;
-       
+
        switch (port_hint & LADSPA_HINT_DEFAULT_MASK) {
        case LADSPA_HINT_DEFAULT_NONE:
                break;
@@ -235,15 +235,15 @@ static void dump_info(const LADSPA_Descriptor *ldesc)
 
                if (LADSPA_IS_PORT_CONTROL(ldesc->PortDescriptors[i])) {
                        if (found) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n    RANGE: %f-%f DEFAULT: %f\n", 
+                               switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n    RANGE: %f-%f DEFAULT: %f\n",
                                                                  ldesc->PortRangeHints[i].LowerBound, ldesc->PortRangeHints[i].UpperBound, dft);
                        } else {
-                               switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n    RANGE: %f-%f DEFAULT: none.\n", 
+                               switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n    RANGE: %f-%f DEFAULT: none.\n",
                                                                  ldesc->PortRangeHints[i].LowerBound, ldesc->PortRangeHints[i].UpperBound);
                        }
                }
 
-               
+
 
        }
 
@@ -261,18 +261,18 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
        switch_channel_t *channel = switch_core_session_get_channel(pvt->session);
 
        switch (type) {
-       case SWITCH_ABC_TYPE_INIT: 
+       case SWITCH_ABC_TYPE_INIT:
                {
                        switch_codec_implementation_t read_impl = { 0 };
                        LADSPA_PortDescriptor port_desc;
                        int i = 0, j = 0, k = 0, str_idx = 0;
-                       
+
                        switch_core_session_get_read_impl(pvt->session, &read_impl);
 
                        if (!(pvt->library_handle = loadLADSPAPluginLibrary(pvt->plugin_name))) {
                                return SWITCH_FALSE;
                        }
-                       
+
                        if (!(pvt->ldesc = findLADSPAPluginDescriptor(pvt->library_handle, pvt->plugin_name, pvt->label_name))) {
                                return SWITCH_FALSE;
                        }
@@ -281,15 +281,15 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                        pvt->handle = pvt->ldesc->instantiate(pvt->ldesc, read_impl.actual_samples_per_second);
 
                        dump_info(pvt->ldesc);
-                       
+
 
                        for (i = 0; i < pvt->ldesc->PortCount; i++) {
                                port_desc = pvt->ldesc->PortDescriptors[i];
-                               
+
                                if (LADSPA_IS_PORT_CONTROL(port_desc) && LADSPA_IS_PORT_INPUT(port_desc)) {
                                        LADSPA_Data dft = 0.0f;
                                        int found = find_default(pvt->ldesc, i, &dft);
-                                       
+
                                        if (found && !pvt->has_config[j]) {
                                                pvt->config[j] = dft;
                                                pvt->has_config[j] = 1;
@@ -298,14 +298,14 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                                        if (pvt->has_config[j]) {
                                                if (!check_range(pvt->ldesc, i, pvt->config[j])) {
                                                        pvt->config[j] = dft;
-                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_WARNING, "FALLING TO DEFAULT PARAM %d [%s] (%f)\n", 
-                                                                                         j+1, 
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_WARNING, "FALLING TO DEFAULT PARAM %d [%s] (%f)\n",
+                                                                                         j+1,
                                                                                          pvt->ldesc->PortNames[i],
-                                                                                         pvt->config[j]);                                                      
+                                                                                         pvt->config[j]);
                                                }
-                                               
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "ADDING PARAM %d [%s] (%f)\n", 
-                                                                                 j+1, 
+
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "ADDING PARAM %d [%s] (%f)\n",
+                                                                                 j+1,
                                                                                  pvt->ldesc->PortNames[i],
                                                                                  pvt->config[j]);
                                                pvt->ldesc->connect_port(pvt->handle, i, &pvt->config[j++]);
@@ -319,7 +319,7 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                                        if (pvt->str_idx && !zstr(pvt->str_config[str_idx])) {
 
                                                if (!strcasecmp(pvt->str_config[str_idx], "none")) {
-                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "CONNECT NOTHING to port: %s\n", 
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "CONNECT NOTHING to port: %s\n",
                                                                                          pvt->ldesc->PortNames[i]
                                                                                          );
                                                        mapped = 1;
@@ -327,20 +327,20 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                                                        char *file = pvt->str_config[str_idx] + 5;
 
                                                        if (switch_test_flag((&pvt->fh), SWITCH_FILE_OPEN)) {
-                                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), 
+                                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session),
                                                                                                  SWITCH_LOG_ERROR, "CAN'T CONNECT FILE [%s] File already mapped\n", file);
                                                        } else {
                                                                if (switch_core_file_open(&pvt->fh,
                                                                                                                  file,
                                                                                                                  read_impl.number_of_channels,
-                                                                                                                 read_impl.actual_samples_per_second, 
+                                                                                                                 read_impl.actual_samples_per_second,
                                                                                                                  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
                                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_ERROR, "Cannot open file: %s\n", file);
                                                                        return SWITCH_FALSE;
                                                                }
-                                                       
-                                                       
-                                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "CONNECT FILE [%s] to port: %s\n", 
+
+
+                                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "CONNECT FILE [%s] to port: %s\n",
                                                                                                  file,
                                                                                                  pvt->ldesc->PortNames[i]
                                                                                                  );
@@ -355,7 +355,7 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
 
                                        if (!mapped) {
                                                pvt->ldesc->connect_port(pvt->handle, i, pvt->in_buf);
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "CONNECT CHANNEL AUDIO to port: %s\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "CONNECT CHANNEL AUDIO to port: %s\n",
                                                                                  pvt->ldesc->PortNames[i]
                                                                                  );
                                        }
@@ -373,7 +373,7 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                }
 
                break;
-       
+
        case SWITCH_ABC_TYPE_CLOSE:
                {
 
@@ -387,7 +387,7 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
 
                        if (pvt->library_handle) {
                                unloadLADSPAPluginLibrary(pvt->library_handle);
-                       }                       
+                       }
                }
                break;
 
@@ -406,7 +406,7 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                        }
 
                        slin = rframe->data;
-                       
+
                        if (switch_channel_media_ready(channel)) {
                                switch_short_to_float(slin, pvt->in_buf, rframe->samples);
 
@@ -418,15 +418,15 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                                                switch_core_session_get_read_impl(pvt->session, &read_impl);
 
                                                switch_core_file_close(&pvt->fh);
-                                               
+
                                                if (switch_core_file_open(&pvt->fh,
                                                                                                  file,
                                                                                                  read_impl.number_of_channels,
-                                                                                                 read_impl.actual_samples_per_second, 
+                                                                                                 read_impl.actual_samples_per_second,
                                                                                                  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_ERROR, "Cannot open file: %s\n", file);
                                                        return SWITCH_FALSE;
-                                               }                                               
+                                               }
 
                                                olen = rframe->samples;
                                                if (switch_core_file_read(&pvt->fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
@@ -434,7 +434,7 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
                                                        return SWITCH_FALSE;
                                                }
                                        }
-                                       
+
                                        switch_short_to_float(abuf, pvt->file_buf, olen);
                                }
 
@@ -498,12 +498,12 @@ switch_status_t ladspa_session(switch_core_session_t *session, const char *flags
        if (zstr(flags)) {
                flags = "r";
        }
-       
+
        if (strchr(flags, 'w')) {
                bflags = SMBF_WRITE_REPLACE;
        }
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "FLAGS: %s PLUGIN: %s LABEL: %s PARAMS: %s\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "FLAGS: %s PLUGIN: %s LABEL: %s PARAMS: %s\n",
                                          flags, plugin_name, label, params);
 
        switch_core_session_get_read_impl(session, &read_impl);
@@ -526,7 +526,7 @@ switch_status_t ladspa_session(switch_core_session_t *session, const char *flags
        } else {
                pvt->plugin_name = switch_core_session_sprintf(session, "%s.so", plugin_name);
        }
-       
+
        dparams = switch_core_session_strdup(session, params);
 
        argc = switch_split(dparams, ' ', argv);
@@ -576,7 +576,7 @@ static void ladspa_parse(switch_core_session_t *session, const char *data)
 }
 
 #define APP_SYNTAX "<flags>|<plugin>|<label>|<params>"
-SWITCH_STANDARD_APP(ladspa_run_function) 
+SWITCH_STANDARD_APP(ladspa_run_function)
 {
        ladspa_parse(session, data);
 }
@@ -604,11 +604,11 @@ SWITCH_STANDARD_API(ladspa_api)
 
                if (!(ksession = switch_core_session_locate(uuid))) {
                        stream->write_function(stream, "-ERR non-existant UUID\n");
-                       goto done;      
-               } 
+                       goto done;
+               }
 
                if ((action = strstr(cmd, "stop"))) {
-                       stop_ladspa_session(ksession);                  
+                       stop_ladspa_session(ksession);
                        switch_core_session_rwunlock(ksession);
                        stream->write_function(stream, "+OK\n");
                        goto done;
@@ -623,7 +623,7 @@ SWITCH_STANDARD_API(ladspa_api)
                stream->write_function(stream, "+OK\n");
        } else {
                stream->write_function(stream, "-ERR Usage %s\n", API_SYNTAX);
-       }       
+       }
 
 done:
 
index d94c420058d08da1b6ae49d5ccb07b171f9e6a51..593bcf1dbf099b1a80fe572d4b780c0f04b917e9 100644 (file)
@@ -44,7 +44,7 @@ findLADSPAPluginDescriptor(void * pvLADSPAPluginLibrary,
    style) and a LADSPA_DescriptorFunction (from which
    LADSPA_Descriptors can be acquired). */
 typedef void LADSPAPluginSearchCallbackFunction
-(const char * pcFullFilename, 
+(const char * pcFullFilename,
  void * pvPluginHandle,
  LADSPA_Descriptor_Function fDescriptorFunction);
 
index 9d106d4890ff50786075f8d24b988502fc63acce..ab547f378e2dc69902a02cc6f2ca18880812eec1 100644 (file)
@@ -16,7 +16,7 @@
       <param name="id" value="2"/>
       <param name="order_by" value="reliability,quality"/>
     </profile>
-<!-- 
+<!--
   Some samples of how to do custom SQL:
 
     =============================================================
index 48feb6a7876e860e77db8e36fa8dfb21548ab1dc..e96c3252adad7a9591231018c5915cda49bfe8dc 100644 (file)
@@ -1,4 +1,4 @@
-<include>      
+<include>
        <extension name="Outbound to PSTN 11 Digits">
                <condition field="destination_number" expression="^(1[2-9][0-9]{2}[2-9]{7})$">
                        <action application="lcr" data="$1"/>
index 5641c4b44df6cbc073288c9e516949e0425b439d..1694fc931e0ffa810763204187e8487df553dfd6 100644 (file)
@@ -10,5 +10,5 @@
                <condition>
                        <action application="limit" data="db $${domain} ${sip_auth_username} ${max_calls}"/>
                </condition>
-       </extension> 
+       </extension>
 </include>
index b4adf36fdfaaf52b0dd6d1da5313258c36d7828c..096ff9504b67dbceb6e7aab3e3d6eee90549cb9c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Rupa Schomaker <rupa@rupa.com>
  *
@@ -45,7 +45,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load)
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Loading mod_limit - a shim for backwards compatability with the new limit system.  This is deprecated, remove mod_limit and instead load mod_hash and mod_db!\n");
-       
+
        /* try to load mod_hash if it isn't loaded */
        if (switch_loadable_module_exists("mod_hash") != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "mod_hash not loaded, trying to load...!\n");
@@ -53,7 +53,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to load mod_hash (%s)!\n", err);
                }
        }
-       
+
        /* try to load mod_db if it isn't loaded */
        if (switch_loadable_module_exists("mod_db") != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "mod_db not loaded, trying to load...!\n");
@@ -61,7 +61,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to load mod_db (%s)!\n", err);
                }
        }
-       
+
        /* set compat flag */
        switch_core_set_variable("switch_limit_backwards_compat_flag", "true");
 
index 2a32b08a14cbd08959ab90379344f93e506d67fa..c318901b6a443210c0f988205a94502bbc30378e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Rupa Schomaker <rupa@rupa.com>
  *
  * mod_memcache.c -- API for memcache
@@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_memcache_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_memcache_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_memcache_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_memcache, mod_memcache_load, mod_memcache_shutdown, NULL);
index 64d6c728b39d5d9f36312722ce2fb69a8dc28442..433642d8167a88d2b58a2ae9e37596b204310937 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -146,13 +146,13 @@ SWITCH_STANDARD_APP(record_mp4_function)
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "%s waiting for video.\n", switch_channel_get_name(channel));
                        count = 100;
                        if (!--sanity) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s timeout waiting for video.\n", 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s timeout waiting for video.\n",
                                                                  switch_channel_get_name(channel));
                                return;
                        }
                }
        }
-       
+
        if (!switch_channel_ready(channel)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s not ready.\n", switch_channel_get_name(channel));
                return;
@@ -312,7 +312,7 @@ static void *SWITCH_THREAD_FUNC play_video_function(switch_thread_t *thread, voi
                                sent = true;
                        }
 
-               } 
+               }
        }
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pt->session), SWITCH_LOG_DEBUG, "Video thread ended\n");
        pt->done = true;
@@ -330,7 +330,7 @@ static void *SWITCH_THREAD_FUNC play_audio_function(switch_thread_t *thread, voi
        switch_dtmf_t dtmf = {0};
        pt->done = false;
        switch_frame_t * read_frame;
-       
+
        while (!*pt->quit && switch_channel_ready(pt->channel)) {
                // event processing.
                // -- SEE switch_ivr_play_say.c:1231 && mod_dptools.c:1428 && mod_dptools.c:1919
@@ -354,7 +354,7 @@ static void *SWITCH_THREAD_FUNC play_audio_function(switch_thread_t *thread, voi
                                break;
                        }
                }
-               
+
                switch_mutex_lock(pt->mutex);
                pt->frame->datalen = pt->frame->buflen;
                ok = pt->vc->getAudioPacket(pt->frame->data, pt->frame->datalen, next);
@@ -404,13 +404,13 @@ SWITCH_STANDARD_APP(play_mp4_function)
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data);
                        return;
                }
-               
+
                if(!vc.isSupported())
                {
                        char msgbuf[1024];
                        sprintf(msgbuf, "PLAYBACK ERROR (%s): UNSUPPORTED FORMAT OR FILE NOT HINTED.", (char*) data);
                        switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, msgbuf);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT,
                                "Error reading track info. Maybe this file is not hinted.\n");
                        throw 1;
                }
@@ -478,7 +478,7 @@ SWITCH_STANDARD_APP(play_mp4_function)
                vpt.vc = &vc;
                switch_mutex_init(&vpt.mutex, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(session));
                vpt.quit = &done;
-               
+
                switch_threadattr_t * thd_attr;
                switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session));
                switch_threadattr_detach_set(thd_attr, 1);
@@ -503,7 +503,7 @@ SWITCH_STANDARD_APP(play_mp4_function)
                }
 
                switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "FILE PLAYED");
-       } catch(const std::exception & e) 
+       } catch(const std::exception & e)
        {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s\n", e.what());
                switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE,
index ae6ee81da1cb9023db504c573140679e2250c412..0904cafd6755154651bcf205f77a94aebc9aadc9 100644 (file)
@@ -12,7 +12,7 @@ under the License.
 
 The Original Code is MP4 Helper Library to the Freeswitch MP4 Module.
 
-The Initial Developer of the Original Code is 
+The Initial Developer of the Original Code is
 Paulo Rogério Panhoto <paulo@voicetechnology.com.br>.
 Portions created by the Initial Developer are Copyright (C)
 the Initial Developer. All Rights Reserved.
@@ -27,13 +27,13 @@ Contributors:
 
 namespace MP4
 {
-       
+
        Context::Context(const char * file, bool newFile)
        {
                if(newFile) create(file);
                else open(file);
        }
-       
+
        Context::~Context()
        {
                close();
@@ -45,7 +45,7 @@ namespace MP4
                if (fh == MP4_INVALID_FILE_HANDLE) throw Exception(file, "Open failed");
                getTracks(file);
        }
-       
+
        void Context::create(const char * file)
        {
                fh = MP4Create(file);
index 58665498aeba6db867c4775b8733a19350124c20..5d8e87e119eada7738f71a87199df31632ffd270 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_nibblebill.c - Nibble Billing
  * Purpose is to allow real-time debiting of credit or cash from a database while calls are in progress. I had the following goals:
  *
- * Debit credit/cash from accounts real-time 
- * Allow for billing at different rates during a single call 
- * Allow for warning callers when their balance is low (via audio, in-channel) 
- * Allow for disconnecting or re-routing calls when balance is depleted 
- * Allow for billing to function as listed above with multiple concurrent calls 
- * 
+ * Debit credit/cash from accounts real-time
+ * Allow for billing at different rates during a single call
+ * Allow for warning callers when their balance is low (via audio, in-channel)
+ * Allow for disconnecting or re-routing calls when balance is depleted
+ * Allow for billing to function as listed above with multiple concurrent calls
+ *
  * Thanks go to bandwidth.com for funding this work.
  *
  *
@@ -139,7 +139,7 @@ static switch_cache_db_handle_t *nibblebill_get_db_handle(void)
 {
        switch_cache_db_handle_t *dbh = NULL;
        char *dsn;
-       
+
        if (!zstr(globals.odbc_dsn)) {
                dsn = globals.odbc_dsn;
        } else {
@@ -149,7 +149,7 @@ static switch_cache_db_handle_t *nibblebill_get_db_handle(void)
        if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) {
                dbh = NULL;
        }
-       
+
        return dbh;
 }
 
@@ -163,7 +163,7 @@ static int nibblebill_callback(void *pArg, int argc, char **argv, char **columnN
                        cbt->balance = atof(argv[0]);
                }
        }
-       
+
        return 0;
 }
 
@@ -171,7 +171,7 @@ static switch_bool_t nibblebill_execute_sql_callback(char *sql, switch_core_db_c
 {
        switch_bool_t retval = SWITCH_FALSE;
        switch_cache_db_handle_t *dbh = NULL;
-       
+
        if (globals.odbc_dsn && (dbh = nibblebill_get_db_handle())) {
                if (switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, NULL) != SWITCH_STATUS_SUCCESS) {
                        retval = SWITCH_FALSE;
@@ -219,7 +219,7 @@ static switch_status_t nibblebill_load_config(void)
                for (param = switch_xml_child(settings, "param"); param; param = param->next) {
                        char *var = (char *) switch_xml_attr_soft(param, "name");
                        char *val = (char *) switch_xml_attr_soft(param, "value");
-                       
+
                        if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "odbc_dsn is %s\n", val);
                                switch_safe_free(globals.odbc_dsn);
@@ -260,7 +260,7 @@ static switch_status_t nibblebill_load_config(void)
                        }
                }
        }
-       
+
 
 /* Set defaults for any variables still not set */
   setdefaults:
@@ -389,7 +389,7 @@ static switch_bool_t bill_event(double billamount, const char *billaccount, swit
        } else {
                sql = dsql = switch_mprintf("UPDATE %q SET %q=%q- %f WHERE %q='%q'", globals.db_table, globals.db_column_cash,
                                                                        globals.db_column_cash, billamount, globals.db_column_account, billaccount);
-               
+
        }
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doing update query\n[%s]\n", sql);
@@ -415,7 +415,7 @@ static double get_balance(const char *billaccount, switch_channel_t *channel)
                        sql = globals.custom_sql_lookup;
                }
        } else {
-               sql = dsql = switch_mprintf("SELECT %q AS nibble_balance FROM %q WHERE %q='%q'", 
+               sql = dsql = switch_mprintf("SELECT %q AS nibble_balance FROM %q WHERE %q='%q'",
                                                                        globals.db_column_cash, globals.db_table, globals.db_column_account, billaccount);
        }
 
@@ -429,12 +429,12 @@ static double get_balance(const char *billaccount, switch_channel_t *channel)
                balance = pdata.balance;
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Retrieved current balance for account %s (balance = %f)\n", billaccount, balance);
        }
-       
+
        switch_safe_free(dsql);
        return balance;
 }
 
-/* This is where we actually charge the guy 
+/* This is where we actually charge the guy
   This can be called anytime a call is in progress or at the end of a call before the session is destroyed */
 static switch_status_t do_billing(switch_core_session_t *session)
 {
@@ -483,11 +483,11 @@ static switch_status_t do_billing(switch_core_session_t *session)
        if (!zstr(switch_channel_get_variable(channel, "nobal_amt"))) {
                nobal_amt = atof(switch_channel_get_variable(channel, "nobal_amt"));
        }
-       
+
        if (!zstr(switch_channel_get_variable(channel, "lowbal_amt"))) {
                lowbal_amt = atof(switch_channel_get_variable(channel, "lowbal_amt"));
        }
-       
+
        if (!zstr(switch_channel_get_variable(channel, "nibble_rounding"))) {
                rounding_factor = pow(10, atof(switch_channel_get_variable(channel, "nibble_rounding")));
        }
@@ -580,7 +580,7 @@ static switch_status_t do_billing(switch_core_session_t *session)
                        billamount = (atof(billrate) / 1000000 / 60) * chargedunits - nibble_data->bill_adjustments;
                        /* Account for the prepaid amount */
                        nibble_data->lastts += chargedunits;
-               } else {                
+               } else {
                        /* Convert billrate into microseconds and multiply by # of microseconds that have passed since last *successful* bill */
                        billamount = (atof(billrate) / 1000000 / 60) * ((ts - nibble_data->lastts)) - nibble_data->bill_adjustments;
                        /* Update the last time we billed */
@@ -637,9 +637,9 @@ static switch_status_t do_billing(switch_core_session_t *session)
 
                /* don't verify balance and transfer to nobal if we're done with call */
                if (switch_channel_get_state(channel) != CS_REPORTING && switch_channel_get_state(channel) != CS_HANGUP) {
-                       
+
                        balance = get_balance(billaccount, channel);
-                       
+
                        /* See if we've achieved low balance */
                        if (!nibble_data->lowbal_action_executed && balance <= lowbal_amt) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Balance of %f fell below low balance amount of %f! (Account %s)\n",
@@ -961,10 +961,10 @@ SWITCH_STANDARD_API(nibblebill_api_function)
 static switch_status_t sched_billing(switch_core_session_t *session)
 {
        switch_channel_t *channel = NULL;
-       
+
        const char *billrate = NULL;
        const char *billaccount = NULL;
-       
+
        if (!(channel = switch_core_session_get_channel(session))) {
                return SWITCH_STATUS_SUCCESS;
        }
@@ -993,7 +993,7 @@ static switch_status_t process_hangup(switch_core_session_t *session)
        switch_channel_t *channel = NULL;
 
        channel = switch_core_session_get_channel(session);
-       
+
        /* Resume any paused billings, just in case */
        /*  nibblebill_resume(session); */
 
@@ -1026,7 +1026,7 @@ switch_state_handler_table_t nibble_state_handler = {
        /* on_hibernate */ NULL,
        /* on_reset */ NULL,
        /* on_park */ NULL,
-       /* on_reporting */ NULL, 
+       /* on_reporting */ NULL,
        /* on_destroy */ NULL
 };
 
@@ -1072,7 +1072,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_nibblebill_shutdown)
        switch_event_unbind(&globals.node);
        switch_core_remove_state_handler(&nibble_state_handler);
        switch_odbc_handle_disconnect(globals.master_odbc);
-       
+
        switch_safe_free(globals.dbname);
        switch_safe_free(globals.odbc_dsn);
        switch_safe_free(globals.db_table);
index 5cccdeb51104aa4c359fc07f8beab0770ee08287..4ebf1759d939cf76f58fd2ba20f3d9a66d4a32ca 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -87,7 +87,7 @@ static int oreka_write_udp(oreka_session_t *oreka, switch_stream_handle_t *udp)
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oreka->session), SWITCH_LOG_DEBUG, "Oreka SIP Packet:\n%s", (const char *)udp->data);
        switch_socket_sendto(globals.sip_socket, globals.sip_server_addr, 0, (void *)udp->data, &udplen);
        if (udplen != udp->data_len) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oreka->session), SWITCH_LOG_ERROR, "Failed to write SIP Packet of len %zd (wrote=%zd)", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oreka->session), SWITCH_LOG_ERROR, "Failed to write SIP Packet of len %zd (wrote=%zd)",
                                udp->data_len, udplen);
        }
        return 0;
@@ -142,20 +142,20 @@ static int oreka_setup_rtp(oreka_session_t *oreka, oreka_stream_type_t type)
        }
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Allocated %s port %d for local IP %s, destination IP %s\n", type_str,
                        rtp_port, globals.local_ipv4_str, globals.sip_server_ipv4_str);
-       rtp_stream = switch_rtp_new(globals.local_ipv4_str, rtp_port, 
+       rtp_stream = switch_rtp_new(globals.local_ipv4_str, rtp_port,
                        globals.sip_server_ipv4_str, rtp_port,
                        0, /* PCMU IANA*/
                        codec_impl->samples_per_packet,
                        codec_impl->microseconds_per_packet,
                        flags, NULL, &err, switch_core_session_get_pool(oreka->session));
        if (!rtp_stream) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create %s RTP stream at %s:%d: %s\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create %s RTP stream at %s:%d: %s\n",
                                type_str, globals.local_ipv4_str, rtp_port, err);
                res = -1;
                goto done;
        }
 
-    switch_rtp_intentional_bugs(rtp_stream, RTP_BUG_SEND_LINEAR_TIMESTAMPS); 
+    switch_rtp_intentional_bugs(rtp_stream, RTP_BUG_SEND_LINEAR_TIMESTAMPS);
 
 
 done:
@@ -175,7 +175,7 @@ done:
                        oreka->write_rtp_port = rtp_port;
                }
        }
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Successfully created %s RTP stream at %s:%d at %dms@%dHz\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Successfully created %s RTP stream at %s:%d at %dms@%dHz\n",
                                type_str, globals.local_ipv4_str, rtp_port, codec_impl->microseconds_per_packet/1000, codec_impl->samples_per_second);
        return res;
 }
@@ -272,7 +272,7 @@ static int oreka_send_sip_message(oreka_session_t *oreka, oreka_recording_status
 
        /* Get caller meta data */
        caller_id_number = switch_caller_get_field_by_name(caller_profile, "caller_id_number");
-       
+
        caller_id_name = switch_caller_get_field_by_name(caller_profile, "caller_id_name");
        if (zstr(caller_id_name)) {
                caller_id_name = caller_id_number;
@@ -308,7 +308,7 @@ static int oreka_send_sip_message(oreka_session_t *oreka, oreka_recording_status
                sdp.write_function(&sdp, "s=Phone Recording (%s)\r\n", type == FS_OREKA_READ ? "RX" : "TX");
                sdp.write_function(&sdp, "i=FreeSWITCH Oreka Recorder (pid=%d)\r\n", globals.our_pid);
                sdp.write_function(&sdp, "m=audio %d RTP/AVP 0\r\n", type == FS_OREKA_READ ? oreka->read_rtp_port : oreka->write_rtp_port);
-               sdp.write_function(&sdp, "a=rtpmap:0 PCMU/%d\r\n", type == FS_OREKA_READ 
+               sdp.write_function(&sdp, "a=rtpmap:0 PCMU/%d\r\n", type == FS_OREKA_READ
                                ? oreka->read_impl.samples_per_second : oreka->write_impl.samples_per_second);
        }
 
@@ -337,7 +337,7 @@ static int oreka_send_sip_message(oreka_session_t *oreka, oreka_recording_status
        sip_header.write_function(&sip_header, "Max-Forwards: 70\r\n", method);
 
        /* Subject */
-       sip_header.write_function(&sip_header, "Subject: %s %s recording of %s\r\n", 
+       sip_header.write_function(&sip_header, "Subject: %s %s recording of %s\r\n",
                                        status == FS_OREKA_START ? "BEGIN": "END",
                                        type == FS_OREKA_READ ? "RX" : "TX", caller_id_name);
 
@@ -400,7 +400,7 @@ static switch_bool_t oreka_audio_callback(switch_media_bug_t *bug, void *user_da
        uint32_t i = 0;
        int16_t *linear_samples = NULL;
 
-    
+
 
        if (type == SWITCH_ABC_TYPE_READ_REPLACE || type == SWITCH_ABC_TYPE_WRITE_REPLACE || type == SWITCH_ABC_TYPE_READ_PING) {
         int16_t *data;
@@ -476,7 +476,7 @@ static switch_bool_t oreka_audio_callback(switch_media_bug_t *bug, void *user_da
                 switch_resample_create(&oreka->write_resampler,
                                        read_impl.actual_samples_per_second,
                                        8000,
-                                       320, SWITCH_RESAMPLE_QUALITY, 1);                
+                                       320, SWITCH_RESAMPLE_QUALITY, 1);
             }
 
 
@@ -510,7 +510,7 @@ static switch_bool_t oreka_audio_callback(switch_media_bug_t *bug, void *user_da
                         linear_samples = linear_frame->data;
                         linear_len = linear_frame->datalen;
                     }
-                    
+
                     memset(&pcmu_frame, 0, sizeof(pcmu_frame));
                     for (i = 0; i < linear_len / sizeof(int16_t); i++) {
                         pcmu_data[i] = linear_to_ulaw(linear_samples[i]);
@@ -629,9 +629,9 @@ SWITCH_STANDARD_APP(oreka_start_function)
     } else {
         flags = SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | SMBF_ANSWER_REQ;
     }
-    
+
        status = switch_core_media_bug_add(session, OREKA_BUG_NAME_READ, NULL, oreka_audio_callback, oreka, 0, flags, &bug);
-                                       
+
        if (status != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to attach oreka to media stream!\n");
                return;
@@ -719,8 +719,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_oreka_load)
        switch_get_addr(globals.sip_server_ipv4_str, sizeof(globals.sip_server_ipv4_str), globals.sip_server_addr);
        globals.our_pid = getpid();
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, 
-               "Loading mod_oreka, sip_server_addr=%s, sip_server_ipv4_str=%s, sip_server_port=%d, local_ipv4_str=%s\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
+               "Loading mod_oreka, sip_server_addr=%s, sip_server_ipv4_str=%s, sip_server_port=%d, local_ipv4_str=%s\n",
                globals.sip_server_addr_str, globals.sip_server_ipv4_str, globals.sip_server_port, globals.local_ipv4_str);
 
 #if 0
@@ -765,8 +765,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_oreka_load)
 
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-       SWITCH_ADD_APP(app_interface, "oreka_record", "Send media to Oreka recording server", "Send media to Oreka recording server", 
-       oreka_start_function, "[stop]", SAF_NONE); 
+       SWITCH_ADD_APP(app_interface, "oreka_record", "Send media to Oreka recording server", "Send media to Oreka recording server",
+       oreka_start_function, "[stop]", SAF_NONE);
        return SWITCH_STATUS_SUCCESS;
 }
 
index 7d4d76f1480f6a831fd02913df359e7bba8d9e19..a4d43d545d1898a52fcfb7f017484dc37a60a266 100644 (file)
@@ -47,7 +47,7 @@ struct config_vsas
        int pec;
        int expr;
        int direction;
-       
+
        struct config_vsas *pNext;
 };
 
@@ -55,7 +55,7 @@ struct config_client
 {
        char* name;
        char* value;
-       
+
        struct config_client *pNext;
 };
 
@@ -77,7 +77,7 @@ void free_radius_auth_value_pair(VALUE_PAIR *send, VALUE_PAIR *received, rc_hand
 
        if (received)
                rc_avpair_free(received);
-               
+
        if (rh)
                rc_destroy(rh);
        rh = NULL;
@@ -136,17 +136,17 @@ char* extract_out_variable(char* outvar)
 CONFIG_VSAS* GetVSAS(char* key)
 {
        CONFIG_VSAS* PCONFIGVSAS = CONFIGVSAS;
-       
+
        while(PCONFIGVSAS)
        {
                if (strcmp(key, PCONFIGVSAS->name) == 0)
                {
                        return PCONFIGVSAS;
                }
-               
+
                PCONFIGVSAS = PCONFIGVSAS->pNext;
        }
-       
+
        return NULL;
 }
 
@@ -157,13 +157,13 @@ char* GetValue(switch_channel_t *channel, CONFIG_VSAS* VSAS, char* value)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal Error : VSAS is null object.\n");
                return "";
        }
-       
+
        if (VSAS->value == NULL)
        {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal Error : VSAS->value is null object.\n");
                return "";
        }
-       
+
        if (VSAS->expr == 1)
        {
                const char* v = switch_channel_get_variable(channel, VSAS->value);
@@ -278,30 +278,30 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
 
        memset(msg, 0, STR_LENGTH * 10);
        memset(username_realm, 0, STR_LENGTH);
-       
+
        send = NULL;
-       
+
 
 
        do
        {
-               
+
 #if EMBENDED_CONFIG
 
                CONFIG_CLIENT* PCONFIGCLIENT = CONFIGCLIENT;
-               
+
                rh = rc_new();
-               if (rh == NULL) 
+               if (rh == NULL)
                {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Failed to allocate initial structure.\n");
                        result = ERROR_RC;
                        break;
                }
-               
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "allocate initial structure.\n");
-       
+
                /* Initialize the config structure */
-       
+
                rh = rc_config_init(rh);
                if (rh == NULL)
                {
@@ -309,47 +309,47 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                        result = ERROR_RC;
                        break;
                }
-               
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"initialzed configuration.\n");
-       
+
                while(PCONFIGCLIENT)
                {
-                       //if (rc_add_config(rh, "auth_order", "radius", "config", 0) != 0) 
+                       //if (rc_add_config(rh, "auth_order", "radius", "config", 0) != 0)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "set %s := %s.\n", PCONFIGCLIENT->name, PCONFIGCLIENT->value);
-                       if (rc_add_config(rh, PCONFIGCLIENT->name, PCONFIGCLIENT->value, "config", 0) != 0) 
+                       if (rc_add_config(rh, PCONFIGCLIENT->name, PCONFIGCLIENT->value, "config", 0) != 0)
                        {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Unable to set %s := %s.\n", PCONFIGCLIENT->name, PCONFIGCLIENT->value);
-                               
+
                                result = ERROR_RC;
                                break;
                        }
-                       
+
                        PCONFIGCLIENT = PCONFIGCLIENT->pNext;
                }
-               
+
                if (result == ERROR_RC)
                        break;
 
-               
+
 #else
                if ((rh = rc_read_config(!rc_config_file ? RC_CONFIG_FILE : rc_config_file)) == NULL)
                {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading radius config file\n");
-                       
+
                        result = ERROR_RC;
                        break;
                }
-               
+
 #endif
 
                if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0)
                {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading radius dictionary\n");
-                       
+
                        result = ERROR_RC;
                        break;
                }
-               
+
                default_realm = rc_conf_str(rh, "default_realm");
                if (default_realm == NULL)
                {
@@ -357,7 +357,7 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                        result = ERROR_RC;
                        break;
                }
-               
+
                strncpy(username_realm, username, sizeof(username_realm));
 
                if ((strchr(username_realm, '@') == NULL) && default_realm &&
@@ -366,8 +366,8 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                        strncat(username_realm, "@", sizeof(username_realm)-strlen(username_realm)-1);
                        strncat(username_realm, default_realm, sizeof(username_realm)-strlen(username_realm)-1);
                }
-               
-       
+
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                        "... radius: User-Name: %s\n", username);
                if (rc_avpair_add(rh, &send, PW_USER_NAME, username_realm, -1, 0)== NULL)
@@ -376,7 +376,7 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                        result = ERROR_RC;
                        break;
                }
-               
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                        "... radius: User-Password: %s\n", password);
                if (rc_avpair_add(rh, &send, PW_USER_PASSWORD, password, -1, 0) == NULL)
@@ -385,7 +385,7 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                        result = ERROR_RC;
                        break;
                }
-               
+
                if (!called_number || strcmp(called_number, "") == 0)
                {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
@@ -403,41 +403,41 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                        }
                }
 
-               
+
                PCONFIGVSAS = CONFIGVSAS;
-       
+
                while(PCONFIGVSAS)
                {
                        if (PCONFIGVSAS->direction == 1)
                        {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle attribute: %s\n", PCONFIGVSAS->name     );
-                               
+
                                memset(value, 0, STR_LENGTH);
                                GetValue(channel, PCONFIGVSAS, value);
-                               
+
                                if (PCONFIGVSAS->pec != 0)
                                        attrid = PCONFIGVSAS->id | (PCONFIGVSAS->pec << 16);
                                else
                                        attrid = PCONFIGVSAS->id ;
-                                       
+
                                pda = rc_dict_getattr(rh, attrid);
-                               
+
                                if (pda == NULL)
                                {
                                        result = ERROR_RC;
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown attribute: key:%s, not found in dictionary\n", PCONFIGVSAS->name);
-                                       break;  
+                                       break;
                                }
-                               
+
                                if (PCONFIGVSAS->pec != 0 && rc_dict_getvend(rh, PCONFIGVSAS->pec) == NULL)
                                {
                                        result = ERROR_RC;
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown vendor specific id: key:%s, id:%dnot found in dictionary\n", PCONFIGVSAS->name, PCONFIGVSAS->pec);
-                                       break;  
+                                       break;
                                }
-                               
+
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "... dictionary data: id:%d, vendor id:%d, attr type:%d, attr name:%s (%d)\n", PCONFIGVSAS->id, PCONFIGVSAS->pec, pda->type, pda->name, attrid);
-                               
+
                                switch(pda->type)
                                {
                                        case PW_TYPE_STRING:
@@ -449,13 +449,13 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                                                        break;
                                                }
                                                break;
-                                               
+
                                        //case PW_TYPE_DATE:
                                        case PW_TYPE_INTEGER:
                                                integer = atoi(value);
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "... radius: key:%s, value:%s (%d) as integer\n", PCONFIGVSAS->name, PCONFIGVSAS->value, integer);
-                                               
-                                               
+
+
                                                if (rc_avpair_add(rh, &send, PCONFIGVSAS->id, &integer, -1, PCONFIGVSAS->pec) == NULL)
                                                {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "An Error occured during rc_avpair_add : %s\n", PCONFIGVSAS->name);
@@ -466,52 +466,52 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                                        case PW_TYPE_IPADDR:
                                                integer = rc_get_ipaddr(value);
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "... radius: key:%s, value:%s (%d) as ipaddr\n", PCONFIGVSAS->name, PCONFIGVSAS->value, integer);
-                                               
-                                               
+
+
                                                if (rc_avpair_add(rh, &send, PCONFIGVSAS->id, &integer, -1, PCONFIGVSAS->pec) == NULL)
                                                {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "An Error occured during rc_avpair_add : %s\n", PCONFIGVSAS->name);
                                                        result = ERROR_RC;
                                                        break;
                                                }
-                                               break;                                          
-                                               
+                                               break;
+
                                        default:
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown attribute type: key:%s, type %d\n", PCONFIGVSAS->name, pda->type);
                                                break;
                                }
                        }
-                       
+
                        PCONFIGVSAS = PCONFIGVSAS->pNext;
                }
 
-               
+
                if (result != ERROR_RC)
                {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sending radius packet ...\n"   );
                        result = rc_auth(rh, 0, send, &received, msg);
-               
-       
+
+
                        if (result == OK_RC)
                        {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                        "RADIUS Authentication OK\n");
-                                       
+
                                        strcpy(auth_result, "OK");
                        }
                        else
                        {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                                       " RADIUS Authentication failure (RC=%d)\n", 
+                                       " RADIUS Authentication failure (RC=%d)\n",
                                        result);
-                                       
+
                                        strcpy(auth_result, "NOK");
                        }
-                       
-                       
-                       
+
+
+
                        PCONFIGVSAS = CONFIGVSAS;
-               
+
                        while(PCONFIGVSAS)
                        {
                                if (PCONFIGVSAS->direction == 0)
@@ -521,7 +521,7 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                                        {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\tattribute (%s) found in radius packet\n", PCONFIGVSAS->name);
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\tset variable %s := %s\n", PCONFIGVSAS->value, service_vp->strvalue);
-                                               
+
                                                switch_channel_set_variable(channel, PCONFIGVSAS->value, service_vp->strvalue);
                                        }
                                        else
@@ -529,7 +529,7 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\tNo found out attribute id: %d, pec:%d, (%s)\n", PCONFIGVSAS->id, PCONFIGVSAS->pec, PCONFIGVSAS->name );
                                        }
                                }
-                               
+
                                PCONFIGVSAS = PCONFIGVSAS->pNext;
                        }
                }
@@ -538,18 +538,18 @@ int radius_auth(switch_channel_t *channel, char* called_number, char* username,
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "abort sending radius packet.\n"        );
                        break;
                }
-       
+
        } while(1 == 0);
 
        if (result == ERROR_RC)
        {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                               "An error occured during RADIUS Authentication(RC=%d)\n", 
+                               "An error occured during RADIUS Authentication(RC=%d)\n",
                                result);
        }
-       
+
        free_radius_auth_value_pair(send, received, rh);
-       
+
        return result;
 }
 
@@ -558,23 +558,23 @@ SWITCH_STANDARD_APP(auth_function)
        char* in_called_number = NULL;
        char *in_username = NULL;
        char *in_password = NULL;
-       
+
        char *out_auth_result = NULL;
        /*char *out_biling_model = NULL;
        char *out_credit_amount = NULL;
        char *out_currency = NULL;
        char *out_preffered_lang = NULL;*/
-       
+
        char auth_result[STR_LENGTH + 1];
-       /*char biling_model[STR_LENGTH + 1]; 
+       /*char biling_model[STR_LENGTH + 1];
        char credit_amount[STR_LENGTH + 1];
        char currency[STR_LENGTH + 1];
        char preffered_lang[STR_LENGTH + 1];*/
 
        switch_channel_t *channel = switch_core_session_get_channel(session);
-               
+
        memset(auth_result, 0, STR_LENGTH);
-       /*memset(biling_model, 0, STR_LENGTH); 
+       /*memset(biling_model, 0, STR_LENGTH);
        memset(credit_amount, 0, STR_LENGTH);
        memset(currency, 0, STR_LENGTH);
        memset(preffered_lang, 0, STR_LENGTH);*/
@@ -586,14 +586,14 @@ SWITCH_STANDARD_APP(auth_function)
        }
        else
        {
-               
+
                char *in_called_number_expanded = NULL;
                char *in_username_expanded = NULL;
                char *in_password_expanded = NULL;
 
 
                in_called_number = switch_core_session_strdup(session, data);
-               
+
                in_username = strchr(in_called_number, ',');
 
                if (in_username)
@@ -604,7 +604,7 @@ SWITCH_STANDARD_APP(auth_function)
                                in_username = NULL;
                        }
                }
-               
+
                in_password = strchr(in_username, ',');
 
                if (in_password)
@@ -626,7 +626,7 @@ SWITCH_STANDARD_APP(auth_function)
                                out_auth_result = NULL;
                        }
                }
-               
+
                /*out_biling_model = strchr(out_auth_result, ',');
 
                if (out_biling_model)
@@ -637,7 +637,7 @@ SWITCH_STANDARD_APP(auth_function)
                                out_biling_model = NULL;
                        }
                }
-               
+
                out_credit_amount = strchr(out_biling_model, ',');
 
                if (out_credit_amount)
@@ -648,7 +648,7 @@ SWITCH_STANDARD_APP(auth_function)
                                out_credit_amount = NULL;
                        }
                }
-               
+
                out_currency = strchr(out_credit_amount, ',');
 
                if (out_currency)
@@ -659,7 +659,7 @@ SWITCH_STANDARD_APP(auth_function)
                                out_currency = NULL;
                        }
                }
-               
+
                out_preffered_lang = strchr(out_currency, ',');
 
                if (out_preffered_lang)
@@ -673,7 +673,7 @@ SWITCH_STANDARD_APP(auth_function)
 
                if (in_called_number)
                        in_called_number = extract_in_variable(in_called_number);
-                       
+
                in_username = extract_in_variable(in_username);
                in_password = extract_in_variable(in_password);
                out_auth_result = extract_out_variable(out_auth_result);
@@ -691,7 +691,7 @@ SWITCH_STANDARD_APP(auth_function)
 
                if (in_called_number)
                        in_called_number_expanded = switch_channel_expand_variables(channel, in_called_number);
-                       
+
                in_username_expanded = switch_channel_expand_variables(channel, in_username);
                in_password_expanded = switch_channel_expand_variables(channel, in_password);
 
@@ -701,20 +701,20 @@ SWITCH_STANDARD_APP(auth_function)
                {
                        switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "An error occured during radius authorization.\n");
                }
-               
+
 
                switch_channel_set_variable(channel, out_auth_result, auth_result);
-               
+
                /*switch_channel_set_variable(channel, out_biling_model, biling_model);
                switch_channel_set_variable(channel, out_credit_amount, credit_amount);
                switch_channel_set_variable(channel, out_currency, currency);
                switch_channel_set_variable(channel, out_preffered_lang, preffered_lang);*/
-               
+
                if (in_called_number && in_called_number_expanded && in_called_number_expanded != in_called_number)
                {
                        switch_safe_free(in_called_number_expanded);
                }
-               
+
                if (in_username_expanded && in_username_expanded != in_username)
                {
                        switch_safe_free(in_username_expanded);
@@ -739,14 +739,14 @@ switch_status_t load_config()
        switch_xml_t cfg, xml, settings, param;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        switch_event_t *params = NULL;
-       
+
        char *name;
        char *id;
        char *value;
        char *pec;
        char *expr;
        char* direction;
-                       
+
        CONFIGVSAS = NULL;
        CONFIGCLIENT = NULL;
 
@@ -756,7 +756,7 @@ switch_status_t load_config()
                "profile_rad_auth");
 
        //vsas
-       
+
        if (!(xml = switch_xml_open_cfg(cf, &cfg, params)))
        {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
@@ -764,7 +764,7 @@ switch_status_t load_config()
                status = SWITCH_STATUS_FALSE;
                return status;
        }
-       
+
        if ((settings = switch_xml_child(cfg, "settings")))
        {
                for (param = switch_xml_child(settings, "param"); param; param
@@ -772,18 +772,18 @@ switch_status_t load_config()
                {
                        name = (char *) switch_xml_attr_soft(param, "name");
                        value = (char *) switch_xml_attr_soft(param, "value");
-                       
+
                        if (strcmp(name, "radius_config") == 0)
                        {
                                if (rc_config_file == NULL)
                                        rc_config_file = malloc(STR_LENGTH + 1);
                                strcpy(rc_config_file, value);
-                               
+
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "radius config: %s\n", value);
                        }
                }
        }
-       
+
        if ((settings = switch_xml_child(cfg, "vsas")))
        {
                for (param = switch_xml_child(settings, "param"); param; param
@@ -799,19 +799,19 @@ switch_status_t load_config()
                                PCONFIGVSAS->pNext = malloc(sizeof(CONFIG_VSAS));
                                PCONFIGVSAS = PCONFIGVSAS->pNext;
                        }
-                       
+
                        name = (char *) switch_xml_attr_soft(param, "name");
                        id = (char *) switch_xml_attr_soft(param, "id");
                        value = (char *) switch_xml_attr_soft(param, "value");
                        pec = (char *) switch_xml_attr_soft(param, "pec");
                        expr = (char *) switch_xml_attr_soft(param, "expr");
                        direction = (char *) switch_xml_attr_soft(param, "direction");
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "config attr: %s, %s, %s, %s, %s, %s\n", name, id, value, pec, expr, direction);
-                       
+
                        PCONFIGVSAS->name = (char*) malloc(STR_LENGTH + 1);
                        PCONFIGVSAS->value = (char*) malloc(STR_LENGTH + 1);
-                       
+
                        strncpy(PCONFIGVSAS->name, name, STR_LENGTH);
                        strncpy(PCONFIGVSAS->value, value, STR_LENGTH);
                        PCONFIGVSAS->id = atoi(id);
@@ -824,8 +824,8 @@ switch_status_t load_config()
                        PCONFIGVSAS->pNext = NULL;
                }
        }
-       
-       
+
+
        if ((settings = switch_xml_child(cfg, "client")))
        {
                for (param = switch_xml_child(settings, "param"); param; param
@@ -841,15 +841,15 @@ switch_status_t load_config()
                                PCONFIGCLIENT->pNext = malloc(sizeof(CONFIG_CLIENT));
                                PCONFIGCLIENT = PCONFIGCLIENT->pNext;
                        }
-                       
+
                        name = (char *) switch_xml_attr_soft(param, "name");
                        value = (char *) switch_xml_attr_soft(param, "value");
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "config client: %s, %s\n", name, value);
-                       
+
                        PCONFIGCLIENT->name = (char*) malloc(STR_LENGTH + 1);
                        PCONFIGCLIENT->value = (char*) malloc(STR_LENGTH + 1);
-                       
+
                        strncpy(PCONFIGCLIENT->name, name, STR_LENGTH);
                        strncpy(PCONFIGCLIENT->value, value, STR_LENGTH);
 
@@ -869,11 +869,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rad_authload)
        switch_application_interface_t *app_interface;
 
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       
+
        SWITCH_ADD_APP(app_interface, "auth_function", NULL, NULL, auth_function, "in <USERNAME>, in <PASSWORD>, out <AUTH_RESULT>, out <BILING_MODEL>, out <CREDIT_AMOUNT>, out <CURRENCY>, out <PREFFERED_LANG>", SAF_SUPPORT_NOMEDIA);
 
        load_config();
-       
+
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                "mod rad_auth services is loaded.\n");
 
@@ -885,51 +885,51 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_rad_authruntime)
        return SWITCH_STATUS_TERM;
 }
 
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rad_authshutdown)  
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rad_authshutdown)
 {
        CONFIG_VSAS* PCONFIGVSAS = CONFIGVSAS;
        CONFIG_CLIENT* PCONFIGCLIENT = CONFIGCLIENT;
-       
+
        CONFIG_VSAS* tmpVSAS = NULL;
        CONFIG_CLIENT* tmpCLIENT = NULL;
-       
+
        while(PCONFIGVSAS)
        {
                if (PCONFIGVSAS->name)
                        free(PCONFIGVSAS->name);
                PCONFIGVSAS->name = NULL;
-               
+
                if (PCONFIGVSAS->value)
                        free(PCONFIGVSAS->value);
-               PCONFIGVSAS->value = NULL;              
-               
+               PCONFIGVSAS->value = NULL;
+
                tmpVSAS = PCONFIGVSAS;
                PCONFIGVSAS = PCONFIGVSAS->pNext;
-               
+
                free(tmpVSAS);
        }
-       
+
        CONFIGVSAS = NULL;
-       
-       
+
+
        while(PCONFIGCLIENT)
        {
                if (PCONFIGCLIENT->name)
                        free(PCONFIGCLIENT->name);
                PCONFIGCLIENT->name = NULL;
-               
+
                if (PCONFIGCLIENT->value)
                        free(PCONFIGCLIENT->value);
-               PCONFIGCLIENT->value = NULL;            
-               
+               PCONFIGCLIENT->value = NULL;
+
                tmpCLIENT = PCONFIGCLIENT;
                PCONFIGCLIENT = PCONFIGCLIENT->pNext;
-               
+
                free(tmpCLIENT);
        }
-       
+
        CONFIGCLIENT = NULL;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index e14aaac8759b4b3e9399fbb0e9c590538461f2b1..9903ff519e6d1de5b70c3934f63f6c163b522fa1 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  *
@@ -174,7 +174,7 @@ static void event_handler(switch_event_t *event)
        char *buf;
 
        if (switch_event_serialize(event, &buf, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
-               random_add_entropy(rfd, buf, strlen(buf));  
+               random_add_entropy(rfd, buf, strlen(buf));
                free(buf);
        }
 
@@ -184,23 +184,23 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_random_runtime)
 {
 
        unsigned char data[1024] = {0};
-       
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Thread starting using random_device_file %s\n", modname, random_device_file); 
+
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Thread starting using random_device_file %s\n", modname, random_device_file);
 
        if ((rfd = open(random_device_file, O_RDWR)) < 0) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Error opening random_device_file %s\n", modname, random_device_file); 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Error opening random_device_file %s\n", modname, random_device_file);
                RUNNING = 0;
        }
 
        rng_read(rfd, data, 4);
-       
+
        while(RUNNING) {
                int16_t data[64];
                int i = 0;
                int len = sizeof(data) / 2;
 
                switch_generate_sln_silence(data, len, 1, 1);
-               random_add_entropy(rfd, data, len);     
+               random_add_entropy(rfd, data, len);
 
                while(i < len && !data[i]) i++;
 
@@ -214,7 +214,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_random_runtime)
                close(rfd);
        }
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Thread ending\n", modname); 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Thread ending\n", modname);
 
        return SWITCH_STATUS_TERM;
 }
index c889b83f819e4dddcf74af3fbc25ff7af67c13e1..0eba45dafa2e5cf4204883143f19e99b7ff7a486 100644 (file)
@@ -97,11 +97,11 @@ typedef struct _cr_buffer {
   int size;
 } cr_buffer;
 
-typedef struct _cr_multibulk { 
-  char **bulks; 
+typedef struct _cr_multibulk {
+  char **bulks;
   int *idxs;
   int size;
-  int len; 
+  int len;
 } cr_multibulk;
 
 typedef struct _cr_reply {
@@ -157,12 +157,12 @@ static int cr_moremem(cr_buffer *buf, int size)
   return 0;
 }
 
-/* Allocate at least `size' more multibulk storage, keeping content of 
+/* Allocate at least `size' more multibulk storage, keeping content of
  * previously allocated memory untouched.
  * Returns:
  *   0  on success
  *  -1  on error, i.e. more memory not available */
-static int cr_morebulk(cr_multibulk *mb, int size) 
+static int cr_morebulk(cr_multibulk *mb, int size)
 {
   char **cptr;
   int *iptr;
@@ -171,7 +171,7 @@ static int cr_morebulk(cr_multibulk *mb, int size)
   n = (size / CR_MULTIBULK_SIZE + 1) * CR_MULTIBULK_SIZE;
   total = mb->size + n;
 
-  DEBUG("allocate %d x CR_MULTIBULK_SIZE, total %d (%lu bytes)", 
+  DEBUG("allocate %d x CR_MULTIBULK_SIZE, total %d (%lu bytes)",
         n, total, total * ((sizeof(char *)+sizeof(int))));
   cptr = realloc(mb->bulks, total * sizeof(char *));
 
@@ -209,7 +209,7 @@ static int cr_appendstr(cr_buffer *buf, const char *str, int space)
     DEBUG("truncated, get more memory and try again");
     if (cr_moremem(buf, rc - avail + 1))
       return CREDIS_ERR_NOMEM;
-    
+
     avail = buf->size - buf->len;
     rc = snprintf(buf->data + buf->len, avail, format, str);
   }
@@ -218,8 +218,8 @@ static int cr_appendstr(cr_buffer *buf, const char *str, int space)
   return 0;
 }
 
-/* Appends an array of strings `strv' to the end of buffer `buf', each 
- * separated with a space. If `newline' is not 0 "\r\n" is added last 
+/* Appends an array of strings `strv' to the end of buffer `buf', each
+ * separated with a space. If `newline' is not 0 "\r\n" is added last
  * to buffer.
  * Returns:
  *   0  on success
@@ -241,7 +241,7 @@ int cr_appendstrarray(cr_buffer *buf, int strc, const char **strv, int newline)
   return 0;
 }
 
-/* Receives at most `size' bytes from socket `fd' to `buf'. Times out after 
+/* Receives at most `size' bytes from socket `fd' to `buf'. Times out after
  * `msecs' milliseconds if no data has yet arrived.
  * Returns:
  *  >0  number of read bytes on success
@@ -267,11 +267,11 @@ static int cr_receivedata(int fd, unsigned int msecs, char *buf, int size)
   else if (rc == 0)
     return -2;
   else
-    return -1;  
+    return -1;
 }
 
-/* Sends `size' bytes from `buf' to socket `fd' and times out after `msecs' 
- * milliseconds if not all data has been sent. 
+/* Sends `size' bytes from `buf' to socket `fd' and times out after `msecs'
+ * milliseconds if not all data has been sent.
  * Returns:
  *  >0  number of bytes sent; if less than `size' it means that timeout occurred
  *  -1  on error */
@@ -280,8 +280,8 @@ static int cr_senddata(int fd, unsigned int msecs, char *buf, int size)
   fd_set fds;
   struct timeval tv;
   int rc, sent=0;
-  
-  /* NOTE: On Linux, select() modifies timeout to reflect the amount 
+
+  /* NOTE: On Linux, select() modifies timeout to reflect the amount
    * of time not slept, on other systems it is likely not the same */
   tv.tv_sec = msecs/1000;
   tv.tv_usec = (msecs%1000)*1000;
@@ -301,13 +301,13 @@ static int cr_senddata(int fd, unsigned int msecs, char *buf, int size)
     else if (rc == 0) /* timeout */
       break;
     else
-      return -1;  
+      return -1;
   }
 
   return sent;
 }
 
-/* Buffered read line, returns pointer to zero-terminated string 
+/* Buffered read line, returns pointer to zero-terminated string
  * and length of that string. `start' specifies from which byte
  * to start looking for "\r\n".
  * Returns:
@@ -325,8 +325,8 @@ static int cr_readln(REDIS rhnd, int start, char **line, int *idx)
   /* do we need more data before we expect to find "\r\n"? */
   if ((more = buf->idx + start + 2 - buf->len) < 0)
     more = 0;
-  
-  while (more > 0 || 
+
+  while (more > 0 ||
          (nl = cr_findnl(buf->data + buf->idx + start, buf->len - (buf->idx + start))) == NULL) {
     avail = buf->size - buf->len;
     if (avail < CR_BUFFER_WATERMARK || avail < more) {
@@ -344,7 +344,7 @@ static int cr_readln(REDIS rhnd, int start, char **line, int *idx)
     }
     else if (rc == 0)
       return 0; /* EOF reached, connection terminated */
-    else 
+    else
       return -1; /* error */
 
     /* do we need more data before we expect to find "\r\n"? */
@@ -360,13 +360,13 @@ static int cr_readln(REDIS rhnd, int start, char **line, int *idx)
   len = (int)(nl - *line);
   buf->idx = (int)((nl - buf->data) + 2); /* skip "\r\n" */
 
-  DEBUG("size=%d, len=%d, idx=%d, start=%d, line=%s", 
+  DEBUG("size=%d, len=%d, idx=%d, start=%d, line=%s",
         buf->size, buf->len, buf->idx, start, *line);
 
   return len;
 }
 
-static int cr_receivemultibulk(REDIS rhnd, char *line) 
+static int cr_receivemultibulk(REDIS rhnd, char *line)
 {
   int bnum, blen, i, rc=0, idx;
 
@@ -385,7 +385,7 @@ static int cr_receivemultibulk(REDIS rhnd, char *line)
   for (i = 0; bnum > 0 && (rc = cr_readln(rhnd, 0, &line, NULL)) > 0; i++, bnum--) {
     if (*(line++) != CR_BULK)
       return CREDIS_ERR_PROTOCOL;
-    
+
     blen = atoi(line);
     if (blen == -1)
       rhnd->reply.multibulk.idxs[i] = -1;
@@ -396,7 +396,7 @@ static int cr_receivemultibulk(REDIS rhnd, char *line)
       rhnd->reply.multibulk.idxs[i] = idx;
     }
   }
-  
+
   if (bnum != 0) {
     DEBUG("bnum != 0, bnum=%d, rc=%d", bnum, rc);
     return CREDIS_ERR_PROTOCOL;
@@ -413,7 +413,7 @@ static int cr_receivemultibulk(REDIS rhnd, char *line)
   return 0;
 }
 
-static int cr_receivebulk(REDIS rhnd, char *line) 
+static int cr_receivebulk(REDIS rhnd, char *line)
 {
   int blen;
 
@@ -430,25 +430,25 @@ static int cr_receivebulk(REDIS rhnd, char *line)
   return CREDIS_ERR_PROTOCOL;
 }
 
-static int cr_receiveinline(REDIS rhnd, char *line) 
+static int cr_receiveinline(REDIS rhnd, char *line)
 {
   rhnd->reply.line = line;
   return 0;
 }
 
-static int cr_receiveint(REDIS rhnd, char *line) 
+static int cr_receiveint(REDIS rhnd, char *line)
 {
   rhnd->reply.integer = atoi(line);
   return 0;
 }
 
-static int cr_receiveerror(REDIS rhnd, char *line) 
+static int cr_receiveerror(REDIS rhnd, char *line)
 {
   rhnd->reply.line = line;
   return CREDIS_ERR_PROTOCOL;
 }
 
-static int cr_receivereply(REDIS rhnd, char recvtype) 
+static int cr_receivereply(REDIS rhnd, char recvtype)
 {
   char *line, prefix=0;
 
@@ -458,7 +458,7 @@ static int cr_receivereply(REDIS rhnd, char recvtype)
 
   if (cr_readln(rhnd, 0, &line, NULL) > 0) {
     prefix = *(line++);
+
     if (prefix != recvtype && prefix != CR_ERROR)
       return CREDIS_ERR_PROTOCOL;
 
@@ -473,13 +473,13 @@ static int cr_receivereply(REDIS rhnd, char recvtype)
       return cr_receivebulk(rhnd, line);
     case CR_MULTIBULK:
       return cr_receivemultibulk(rhnd, line);
-    }   
+    }
   }
 
   return CREDIS_ERR_RECV;
 }
 
-static void cr_delete(REDIS rhnd) 
+static void cr_delete(REDIS rhnd)
 {
   if (rhnd->reply.multibulk.bulks != NULL)
     free(rhnd->reply.multibulk.bulks);
@@ -493,7 +493,7 @@ static void cr_delete(REDIS rhnd)
     free(rhnd);
 }
 
-REDIS cr_new(void) 
+REDIS cr_new(void)
 {
   REDIS rhnd;
 
@@ -503,7 +503,7 @@ REDIS cr_new(void)
       (rhnd->reply.multibulk.bulks = malloc(sizeof(char *)*CR_MULTIBULK_SIZE)) == NULL ||
       (rhnd->reply.multibulk.idxs = malloc(sizeof(int)*CR_MULTIBULK_SIZE)) == NULL) {
     cr_delete(rhnd);
-    return NULL;   
+    return NULL;
   }
 
   rhnd->buf.size = CR_BUFFER_SIZE;
@@ -575,7 +575,7 @@ REDIS credis_connect(const char *host, int port, int timeout)
 {
   credis_socket_t fd = CREDIS_SOCK_INVALID;
   int yes = 1;
-  struct sockaddr_in sa;  
+  struct sockaddr_in sa;
   REDIS rhnd;
   int valid = 0;
 
@@ -617,7 +617,7 @@ REDIS credis_connect(const char *host, int port, int timeout)
   rhnd->port = port;
   rhnd->fd = fd;
   rhnd->timeout = timeout;
+
   return rhnd;
 
  error:
@@ -627,7 +627,7 @@ REDIS credis_connect(const char *host, int port, int timeout)
 
 int credis_set(REDIS rhnd, const char *key, const char *val)
 {
-  return cr_sendfandreceive(rhnd, CR_INLINE, "SET %s %d\r\n%s\r\n", 
+  return cr_sendfandreceive(rhnd, CR_INLINE, "SET %s %d\r\n%s\r\n",
                             key, strlen(val), val);
 }
 
@@ -644,7 +644,7 @@ int credis_get(REDIS rhnd, const char *key, char **val)
 
 int credis_getset(REDIS rhnd, const char *key, const char *set_val, char **get_val)
 {
-  int rc = cr_sendfandreceive(rhnd, CR_BULK, "GETSET %s %d\r\n%s\r\n", 
+  int rc = cr_sendfandreceive(rhnd, CR_BULK, "GETSET %s %d\r\n%s\r\n",
                               key, strlen(set_val), set_val);
 
   if (rc == 0)
@@ -654,7 +654,7 @@ int credis_getset(REDIS rhnd, const char *key, const char *set_val, char **get_v
   return rc;
 }
 
-int credis_ping(REDIS rhnd) 
+int credis_ping(REDIS rhnd)
 {
   return cr_sendfandreceive(rhnd, CR_INLINE, "PING\r\n");
 }
@@ -664,7 +664,7 @@ int credis_auth(REDIS rhnd, const char *password)
   return cr_sendfandreceive(rhnd, CR_INLINE, "AUTH %s\r\n", password);
 }
 
-int cr_multikeybulkcommand(REDIS rhnd, const char *cmd, int keyc, 
+int cr_multikeybulkcommand(REDIS rhnd, const char *cmd, int keyc,
                            const char **keyv, char ***valv)
 {
   cr_buffer *buf = &(rhnd->buf);
@@ -683,7 +683,7 @@ int cr_multikeybulkcommand(REDIS rhnd, const char *cmd, int keyc,
   return rc;
 }
 
-int cr_multikeystorecommand(REDIS rhnd, const char *cmd, const char *destkey, 
+int cr_multikeystorecommand(REDIS rhnd, const char *cmd, const char *destkey,
                             int keyc, const char **keyv)
 {
   cr_buffer *buf = &(rhnd->buf);
@@ -707,7 +707,7 @@ int credis_mget(REDIS rhnd, int keyc, const char **keyv, char ***valv)
 
 int credis_setnx(REDIS rhnd, const char *key, const char *val)
 {
-  int rc = cr_sendfandreceive(rhnd, CR_INT, "SETNX %s %d\r\n%s\r\n", 
+  int rc = cr_sendfandreceive(rhnd, CR_INT, "SETNX %s %d\r\n%s\r\n",
                               key, strlen(val), val);
 
   if (rc == 0)
@@ -722,10 +722,10 @@ static int cr_incr(REDIS rhnd, int incr, int decr, const char *key, int *new_val
   int rc = 0;
 
   if (incr == 1 || decr == 1)
-    rc = cr_sendfandreceive(rhnd, CR_INT, "%s %s\r\n", 
+    rc = cr_sendfandreceive(rhnd, CR_INT, "%s %s\r\n",
                             incr>0?"INCR":"DECR", key);
   else if (incr > 1 || decr > 1)
-    rc = cr_sendfandreceive(rhnd, CR_INT, "%s %s %d\r\n", 
+    rc = cr_sendfandreceive(rhnd, CR_INT, "%s %s %d\r\n",
                             incr>0?"INCRBY":"DECRBY", key, incr>0?incr:decr);
 
   if (rc == 0 && new_val != NULL)
@@ -822,7 +822,7 @@ int credis_randomkey(REDIS rhnd, char **key)
 {
   int rc = cr_sendfandreceive(rhnd, CR_INLINE, "RANDOMKEY\r\n");
 
-  if (rc == 0) 
+  if (rc == 0)
     *key = rhnd->reply.line;
 
   return rc;
@@ -830,13 +830,13 @@ int credis_randomkey(REDIS rhnd, char **key)
 
 int credis_rename(REDIS rhnd, const char *key, const char *new_key_name)
 {
-  return cr_sendfandreceive(rhnd, CR_INLINE, "RENAME %s %s\r\n", 
+  return cr_sendfandreceive(rhnd, CR_INLINE, "RENAME %s %s\r\n",
                             key, new_key_name);
 }
 
 int credis_renamenx(REDIS rhnd, const char *key, const char *new_key_name)
 {
-  int rc = cr_sendfandreceive(rhnd, CR_INT, "RENAMENX %s %s\r\n", 
+  int rc = cr_sendfandreceive(rhnd, CR_INT, "RENAMENX %s %s\r\n",
                               key, new_key_name);
 
   if (rc == 0)
@@ -850,14 +850,14 @@ int credis_dbsize(REDIS rhnd)
 {
   int rc = cr_sendfandreceive(rhnd, CR_INT, "DBSIZE\r\n");
 
-  if (rc == 0) 
+  if (rc == 0)
     rc = rhnd->reply.integer;
 
   return rc;
 }
 
 int credis_expire(REDIS rhnd, const char *key, int secs)
-{ 
+{
   int rc = cr_sendfandreceive(rhnd, CR_INT, "EXPIRE %s %d\r\n", key, secs);
 
   if (rc == 0)
@@ -879,7 +879,7 @@ int credis_ttl(REDIS rhnd, const char *key)
 
 int cr_push(REDIS rhnd, int left, const char *key, const char *val)
 {
-  return cr_sendfandreceive(rhnd, CR_INLINE, "%s %s %d\r\n%s\r\n", 
+  return cr_sendfandreceive(rhnd, CR_INLINE, "%s %s %d\r\n%s\r\n",
                             left==1?"LPUSH":"RPUSH", key, strlen(val), val);
 }
 
@@ -897,7 +897,7 @@ int credis_llen(REDIS rhnd, const char *key)
 {
   int rc = cr_sendfandreceive(rhnd, CR_INT, "LLEN %s\r\n", key);
 
-  if (rc == 0) 
+  if (rc == 0)
     rc = rhnd->reply.integer;
 
   return rc;
@@ -907,7 +907,7 @@ int credis_lrange(REDIS rhnd, const char *key, int start, int end, char ***valv)
 {
   int rc;
 
-  if ((rc = cr_sendfandreceive(rhnd, CR_MULTIBULK, "LRANGE %s %d %d\r\n", 
+  if ((rc = cr_sendfandreceive(rhnd, CR_MULTIBULK, "LRANGE %s %d %d\r\n",
                                key, start, end)) == 0) {
     *valv = rhnd->reply.multibulk.bulks;
     rc = rhnd->reply.multibulk.len;
@@ -918,7 +918,7 @@ int credis_lrange(REDIS rhnd, const char *key, int start, int end, char ***valv)
 
 int credis_ltrim(REDIS rhnd, const char *key, int start, int end)
 {
-  return cr_sendfandreceive(rhnd, CR_INLINE, "LTRIM %s %d %d\r\n", 
+  return cr_sendfandreceive(rhnd, CR_INLINE, "LTRIM %s %d %d\r\n",
                             key, start, end);
 }
 
@@ -945,7 +945,7 @@ int credis_lrem(REDIS rhnd, const char *key, int count, const char *val)
 
 static int cr_pop(REDIS rhnd, int left, const char *key, char **val)
 {
-  int rc = cr_sendfandreceive(rhnd, CR_BULK, "%s %s\r\n", 
+  int rc = cr_sendfandreceive(rhnd, CR_BULK, "%s %s\r\n",
                               left==1?"LPOP":"RPOP", key);
 
   if (rc == 0)
@@ -1061,13 +1061,13 @@ int credis_info(REDIS rhnd, REDIS_INFO *info)
                        &(info->total_connections_received),
                        &(info->total_commands_processed),
                        role);
-    
+
     if (items != CR_NUMBER_OF_ITEMS)
       return CREDIS_ERR_PROTOCOL; /* not enough input items returned */
-    
+
     info->role = ((role[0]=='m')?CREDIS_SERVER_MASTER:CREDIS_SERVER_SLAVE);
   }
-  
+
   return rc;
 }
 
@@ -1086,7 +1086,7 @@ int credis_slaveof(REDIS rhnd, const char *host, int port)
 
 static int cr_setaddrem(REDIS rhnd, const char *cmd, const char *key, const char *member)
 {
-  int rc = cr_sendfandreceive(rhnd, CR_INT, "%s %s %d\r\n%s\r\n", 
+  int rc = cr_sendfandreceive(rhnd, CR_INT, "%s %s %d\r\n%s\r\n",
                               cmd, key, strlen(member), member);
 
   if (rc == 0)
@@ -1117,10 +1117,10 @@ int credis_spop(REDIS rhnd, const char *key, char **member)
   return rc;
 }
 
-int credis_smove(REDIS rhnd, const char *sourcekey, const char *destkey, 
+int credis_smove(REDIS rhnd, const char *sourcekey, const char *destkey,
                  const char *member)
 {
-  int rc = cr_sendfandreceive(rhnd, CR_INT, "SMOVE %s %s %s\r\n", 
+  int rc = cr_sendfandreceive(rhnd, CR_INT, "SMOVE %s %s %s\r\n",
                               sourcekey, destkey, member);
 
   if (rc == 0)
@@ -1130,7 +1130,7 @@ int credis_smove(REDIS rhnd, const char *sourcekey, const char *destkey,
   return rc;
 }
 
-int credis_scard(REDIS rhnd, const char *key) 
+int credis_scard(REDIS rhnd, const char *key)
 {
   int rc = cr_sendfandreceive(rhnd, CR_INT, "SCARD %s\r\n", key);
 
index 9760ccc8fdbcedb90094bd57634280cf3e109e22..d2f920bb5bca34642841579c6777c6b388fbc357 100644 (file)
 extern "C" {
 #endif
 
-/* Functions below should map quite nicely to Redis 1.02 command set. 
- * Refer to the official Redis documentation for further explanation of 
+/* Functions below should map quite nicely to Redis 1.02 command set.
+ * Refer to the official Redis documentation for further explanation of
  * each command. See credis examples that show how functions can be used.
- * Here is a brief example that connects to a Redis server and sets value 
- * of key `fruit' to `banana': 
+ * Here is a brief example that connects to a Redis server and sets value
+ * of key `fruit' to `banana':
  *
  *    REDIS rh = credis_connect("localhost", 6789, 2000);
  *    credis_set(rh, "fruit", "banana");
  *    credis_close(rh);
  *
  * In general, functions return 0 on success or a negative value on
- * error. Refer to CREDIS_ERR_* codes. The return code -1 is typically 
- * used when for instance a key is not found. 
+ * error. Refer to CREDIS_ERR_* codes. The return code -1 is typically
+ * used when for instance a key is not found.
  *
- * IMPORTANT! Memory buffers are allocated, used and managed by credis 
- * internally. Subsequent calls to credis functions _will_ destroy the 
- * data to which returned values reference to. If for instance the 
- * returned value by a call to credis_get() is to be used later in the 
- * program, a strdup() is highly recommended. However, each `REDIS' 
- * handle has its own state and manages its own memory buffer 
+ * IMPORTANT! Memory buffers are allocated, used and managed by credis
+ * internally. Subsequent calls to credis functions _will_ destroy the
+ * data to which returned values reference to. If for instance the
+ * returned value by a call to credis_get() is to be used later in the
+ * program, a strdup() is highly recommended. However, each `REDIS'
+ * handle has its own state and manages its own memory buffer
  * independently. That means that one of two handles can be destroyed
  * while the other keeps its connection and data.
- * 
+ *
  * TODO
- *  - Currently only support for zero-terminated strings, not for storing 
+ *  - Currently only support for zero-terminated strings, not for storing
  *    abritary binary data as bulk data. Basically an API issue since it
  *    is partially supported internally.
  *  - Support for Redis >= 1.1 protocol
@@ -108,7 +108,7 @@ typedef struct _cr_info {
  * Connection handling
  */
 
-/* setting host to NULL will use "localhost". setting port to 0 will use 
+/* setting host to NULL will use "localhost". setting port to 0 will use
  * default port 6379 */
 REDIS credis_connect(const char *host, int port, int timeout);
 
@@ -120,8 +120,8 @@ int credis_auth(REDIS rhnd, const char *password);
 
 int credis_ping(REDIS rhnd);
 
-/* 
- * Commands operating on string values 
+/*
+ * Commands operating on string values
  */
 
 int credis_set(REDIS rhnd, const char *key, const char *val);
@@ -156,14 +156,14 @@ int credis_del(REDIS rhnd, const char *key);
 /* returns type, refer to CREDIS_TYPE_* defines */
 int credis_type(REDIS rhnd, const char *key);
 
-/* TODO for Redis >= 1.1 
+/* TODO for Redis >= 1.1
  * MSET key1 value1 key2 value2 ... keyN valueN set a multiple keys to multiple values in a single atomic operation
  * MSETNX key1 value1 key2 value2 ... keyN valueN set a multiple keys to multiple values in a single atomic operation if none of
- * DEL key1 key2 ... keyN remove multiple keys 
+ * DEL key1 key2 ... keyN remove multiple keys
  */
 
 /*
- * Commands operating on key space 
+ * Commands operating on key space
  */
 
 int credis_keys(REDIS rhnd, const char *pattern, char **keyv, int len);
@@ -178,16 +178,16 @@ int credis_renamenx(REDIS rhnd, const char *key, const char *new_key_name);
 /* returns size of db */
 int credis_dbsize(REDIS rhnd);
 
-/* returns -1 if the timeout was not set; either due to key already has 
+/* returns -1 if the timeout was not set; either due to key already has
    an associated timeout or key does not exist */
 int credis_expire(REDIS rhnd, const char *key, int secs);
 
-/* returns time to live seconds or -1 if key does not exists or does not 
+/* returns time to live seconds or -1 if key does not exists or does not
  * have expire set */
 int credis_ttl(REDIS rhnd, const char *key);
 
 /*
- * Commands operating on lists 
+ * Commands operating on lists
  */
 
 int credis_rpush(REDIS rhnd, const char *key, const char *element);
@@ -216,8 +216,8 @@ int credis_lpop(REDIS rhnd, const char *key, char **val);
 /* returns -1 if the key doesn't exists */
 int credis_rpop(REDIS rhnd, const char *key, char **val);
 
-/* TODO for Redis >= 1.1 
- * RPOPLPUSH srckey dstkey 
+/* TODO for Redis >= 1.1
+ * RPOPLPUSH srckey dstkey
  *
  * TODO for Redis >= 1.3.1
  * BLPOP key1 key2 ... keyN timeout
@@ -225,7 +225,7 @@ int credis_rpop(REDIS rhnd, const char *key, char **val);
  */
 
 /*
- * Commands operating on sets 
+ * Commands operating on sets
  */
 
 /* returns -1 if the given member was already a member of the set */
@@ -241,7 +241,7 @@ int credis_sismember(REDIS rhnd, const char *key, const char *member);
 int credis_spop(REDIS rhnd, const char *key, char **member);
 
 /* returns -1 if the member doesn't exists in the source set */
-int credis_smove(REDIS rhnd, const char *sourcekey, const char *destkey, 
+int credis_smove(REDIS rhnd, const char *sourcekey, const char *destkey,
                  const char *member);
 
 /* returns cardinality (number of members) or 0 if the given key doesn't exists */
@@ -276,12 +276,12 @@ int credis_smembers(REDIS rhnd, const char *key, char ***members);
  */
 
 /*
- * Multiple databases handling commands 
+ * Multiple databases handling commands
  */
 
 int credis_select(REDIS rhnd, int index);
 
-/* returns -1 if the key was not moved; already present at target 
+/* returns -1 if the key was not moved; already present at target
  * or not found on current db */
 int credis_move(REDIS rhnd, const char *key, int index);
 
@@ -290,14 +290,14 @@ int credis_flushdb(REDIS rhnd);
 int credis_flushall(REDIS rhnd);
 
 /*
- * Sorting 
+ * Sorting
  */
 
 /* returns number of elements returned in vector `elementv' */
 int credis_sort(REDIS rhnd, const char *query, char ***elementv);
 
-/* 
- * Persistence control commands 
+/*
+ * Persistence control commands
  */
 
 int credis_save(REDIS rhnd);
@@ -310,7 +310,7 @@ int credis_lastsave(REDIS rhnd);
 int credis_shutdown(REDIS rhnd);
 
 /*
- * Remote server control commands 
+ * Remote server control commands
  */
 
 int credis_info(REDIS rhnd, REDIS_INFO *info);
index eff6691c69201ddf01cb7abbc122bacd380bff84..7f140fe7d603572c9dee6b5286911400fa9c9330 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * Kevin Morizur <kmorizur@avgs.ca> 
+ * Kevin Morizur <kmorizur@avgs.ca>
  * Mathieu Rene <mrene@avgs.ca>
  *
  * mod_redis.c -- Redis limit backend
@@ -45,7 +45,7 @@ static struct{
 
 static switch_xml_config_item_t instructions[] = {
        /* parameter name        type                 reloadable   pointer                         default value     options structure */
-       SWITCH_CONFIG_ITEM_STRING_STRDUP("host", CONFIG_RELOAD, &globals.host, NULL, "localhost", "Hostname for redis server"), 
+       SWITCH_CONFIG_ITEM_STRING_STRDUP("host", CONFIG_RELOAD, &globals.host, NULL, "localhost", "Hostname for redis server"),
        SWITCH_CONFIG_ITEM("port", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &globals.port, (void *) 6379, NULL,NULL, NULL),
        SWITCH_CONFIG_ITEM("timeout", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &globals.timeout, (void *) 10000, NULL,NULL, NULL),
        SWITCH_CONFIG_ITEM("ignore_connect_fail", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.ignore_connect_fail, SWITCH_FALSE, NULL, "true|false", "Set to true in order to continue when redis is not contactable"),
@@ -58,10 +58,10 @@ typedef struct {
        switch_mutex_t *mutex;
 } limit_redis_private_t;
 
-static switch_status_t redis_factory(REDIS *redis) 
+static switch_status_t redis_factory(REDIS *redis)
 {
        if (!((*redis) = credis_connect(globals.host, globals.port, globals.timeout))) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't connect to redis server at %s:%d timeout:%d\n", globals.host, globals.port, globals.timeout);         
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't connect to redis server at %s:%d timeout:%d\n", globals.host, globals.port, globals.timeout);
                return SWITCH_STATUS_FALSE;
        }
        return SWITCH_STATUS_SUCCESS;
@@ -83,7 +83,7 @@ SWITCH_LIMIT_INCR(limit_incr_redis)
        char *rediskey = NULL;
        char *uuid_rediskey = NULL;
        uint8_t increment = 1;
-       switch_status_t status = SWITCH_STATUS_SUCCESS; 
+       switch_status_t status = SWITCH_STATUS_SUCCESS;
        REDIS redis;
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "mod_redis is deprecated and will be removed in FS 1.8. Check out mod_hiredis.\n");
@@ -110,11 +110,11 @@ SWITCH_LIMIT_INCR(limit_incr_redis)
                switch_mutex_init(&pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
                switch_channel_set_private(channel, "limit_redis", pvt);
        }
-       
+
        if (!(switch_core_hash_find_locked(pvt->hash, rediskey, pvt->mutex))) {
                switch_core_hash_insert_locked(pvt->hash, rediskey, rediskey, pvt->mutex);
        }
-       
+
        if (increment) {
                if (credis_incr(redis, rediskey, &val) != 0) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't increment value corresponding to %s\n", rediskey);
@@ -127,7 +127,7 @@ SWITCH_LIMIT_INCR(limit_incr_redis)
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", rediskey);
                                        switch_goto_status(SWITCH_STATUS_GENERR, end);
                                } else {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s exceeds maximum rate of %d\n", 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s exceeds maximum rate of %d\n",
                                                rediskey, max);
                                        switch_goto_status(SWITCH_STATUS_FALSE, end);
                                }
@@ -136,7 +136,7 @@ SWITCH_LIMIT_INCR(limit_incr_redis)
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't increment value corresponding to %s\n", uuid_rediskey);
                                        switch_goto_status(SWITCH_STATUS_FALSE, end);
                                }
-                       }       
+                       }
                } else  {
                        if (credis_incr(redis, uuid_rediskey, &uuid_val) != 0) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't increment value corresponding to %s\n", uuid_rediskey);
@@ -154,7 +154,7 @@ end:
        }
        return status;
 }
-       
+
 /* !\brief Releases usage of a limit_redis-controlled ressource  */
 SWITCH_LIMIT_RELEASE(limit_release_redis)
 {
@@ -165,12 +165,12 @@ SWITCH_LIMIT_RELEASE(limit_release_redis)
        char *uuid_rediskey = NULL;
        int status = SWITCH_STATUS_SUCCESS;
        REDIS redis;
-       
+
        if (!pvt || !pvt->hash) {
         switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No hashtable for channel %s\n", switch_channel_get_name(channel));
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        if (redis_factory(&redis) != SWITCH_STATUS_SUCCESS) {
                 if ( globals.ignore_connect_fail ) {
                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ignore_connect_fail=true, so ignoring the fact that redis was not contactabl and continuing with the call\n" );
@@ -192,9 +192,9 @@ SWITCH_LIMIT_RELEASE(limit_release_redis)
                        const void *p_key;
                        char *p_uuid_key = NULL;
                        switch_ssize_t keylen;
-                       
+
                        switch_core_hash_this(hi, &p_key, &keylen, &p_val);
-                       
+
                        if (credis_decr(redis, (const char*)p_key, &val) != 0) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", (char *)p_key);
                                switch_goto_status(SWITCH_STATUS_FALSE, end);
@@ -210,8 +210,8 @@ SWITCH_LIMIT_RELEASE(limit_release_redis)
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "Limit incr redis : uuid_rediskey : %s uuid_val : %d\n",
                                         p_uuid_key, uuid_val);*/
                }
-       
-       } else {        
+
+       } else {
                rediskey = switch_core_session_sprintf(session, "%s_%s", realm, resource);
                uuid_rediskey = switch_core_session_sprintf(session, "%s_%s_%s", switch_core_get_switchname(), realm, resource);
                switch_core_hash_delete(pvt->hash, (const char *) rediskey);
@@ -224,7 +224,7 @@ SWITCH_LIMIT_RELEASE(limit_release_redis)
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", uuid_rediskey);
                        switch_goto_status(SWITCH_STATUS_FALSE, end);
                }
-               
+
 /*
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Limit release redis : rediskey : %s val : %d\n", rediskey,val);
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Limit incr redis : uuid_rediskey : %s uuid_val : %d\n", uuid_rediskey,uuid_val);
@@ -244,23 +244,23 @@ SWITCH_LIMIT_USAGE(limit_usage_redis)
        char *str;
        REDIS redis;
        int usage;
-       
+
        if (redis_factory(&redis) != SWITCH_STATUS_SUCCESS) {
                return 0;
        }
 
        redis_key = switch_mprintf("%s_%s", realm, resource);
-  
+
        if (credis_get(redis, redis_key, &str) != 0){
                usage = 0;
        } else {
-               usage = atoi(str);              
+               usage = atoi(str);
        }
-       
+
        if (redis) {
                credis_close(redis);
        }
-       
+
        switch_safe_free(redis_key);
        return usage;
 }
@@ -272,23 +272,23 @@ SWITCH_LIMIT_RESET(limit_reset_redis)
                char *rediskey = switch_mprintf("%s_*", switch_core_get_switchname());
                int dec = 0, val = 0, keyc;
                char *uuids[2000];
-       
+
                if ((keyc = credis_keys(redis, rediskey, uuids, switch_arraylen(uuids))) > 0) {
                        int i = 0;
                        int hostnamelen = (int)strlen(switch_core_get_switchname())+1;
-                       
+
                        for (i = 0; i < keyc && uuids[i]; i++){
                                const char *key = uuids[i] + hostnamelen;
                                char *value;
-                       
+
                                if ((int)strlen(uuids[i]) <= hostnamelen) {
                                        continue; /* Sanity check */
                                }
-                       
+
                                credis_get(redis, key, &value);
                                dec = atoi(value);
                                credis_decrby(redis, key, dec, &val);
-                       
+
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DECR %s by %d. value is now %d\n", key, dec, val);
                        }
                }
@@ -312,7 +312,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_redis_load)
        switch_limit_interface_t *limit_interface = NULL;
 
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       
+
        if (switch_xml_config_parse_module_settings("redis.conf", SWITCH_FALSE, instructions) != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_FALSE;
        }
@@ -321,9 +321,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_redis_load)
 
        /* If FreeSWITCH was restarted and we still have active calls, decrement them so our global count stays valid */
        limit_reset_redis();
-       
+
        SWITCH_ADD_LIMIT(limit_interface, "redis", limit_incr_redis, limit_release_redis, limit_usage_redis, limit_reset_redis, limit_status_redis, NULL);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index c1e1e2803d66586e4bb19f3c0a8268c29277dcf2..0c2a8642531f20756e1d5f4726da08082e5a1d77 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  *
@@ -84,7 +84,7 @@ static uint32_t match_count(char *str, uint32_t max)
 
 
 /*
-  dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+  dtmf handler function you can hook up to be executed when a digit is dialed during playback
   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
 */
 static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
@@ -351,8 +351,8 @@ SWITCH_STANDARD_APP(rss_function)
                        if ((p = strchr(cmd, '#'))) {
                                *p = '\0';
 #ifdef MATCH_COUNT
-                               /* Hmmm... I know there are no more matches so I don't *need* them to press pound but 
-                                  I already told them to press it.  Will this confuse people or not?  Let's make em press 
+                               /* Hmmm... I know there are no more matches so I don't *need* them to press pound but
+                                  I already told them to press it.  Will this confuse people or not?  Let's make em press
                                   pound unless this define is enabled for now.
                                 */
                        } else if (match_count(cmd, feed_index) > 1) {
index 38bf4ac0990c0c31dcd43ee2e94262ca89abfad9..b1f800043b38ad57c8490785ff49c70b090c438e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  *
@@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skel_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_skel_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_skel, mod_skel_load, mod_skel_shutdown, NULL);
@@ -65,7 +65,7 @@ static switch_status_t config_callback_siptrace(switch_xml_config_item_t *data,
        /*
           if ((callback_type == CONFIG_LOG || callback_type == CONFIG_RELOAD) && changed) {
           nua_set_params(((sofia_profile_t*)data->functiondata)->nua, TPTAG_LOG(value), TAG_END());
-          } 
+          }
         */
 
        return SWITCH_STATUS_SUCCESS;
@@ -188,7 +188,7 @@ SWITCH_STANDARD_API(skel_function)
                        switch_snprintf(name, sizeof(name), "test-header-%d", x);
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, name, "value-%d", x);
                }
-               
+
 
                /* Nothing up my sleeve, here is the event */
 
@@ -218,8 +218,8 @@ static void mycb(switch_core_session_t *session, switch_channel_callstate_t call
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
 
-       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT, 
-                                         "%s device: %s\nState: %s Dev State: %s/%s Total:%u Offhook:%u Active:%u Held:%u Hungup:%u Dur: %u %s\n", 
+       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT,
+                                         "%s device: %s\nState: %s Dev State: %s/%s Total:%u Offhook:%u Active:%u Held:%u Hungup:%u Dur: %u %s\n",
                                          switch_channel_get_name(channel),
                                          drec->device_id,
                                          switch_channel_callstate2str(callstate),
index 9f10ef98a51e5d7f88b03cc9086cafe35895d5c8..3bdcf3f4b82272fef67d0d163f87e5a48ecbc656 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Raymond Chandler <intralanman@freeswitch.org>
  *
- * mod_sms.c -- Abstract SMS 
+ * mod_sms.c -- Abstract SMS
  *
  */
 #include <switch.h>
@@ -70,7 +70,7 @@ static void send_report(switch_event_t *event, const char * Status) {
        }
 }
 
-static void event_handler(switch_event_t *event) 
+static void event_handler(switch_event_t *event)
 {
        const char *dest_proto = switch_event_get_header(event, "dest_proto");
        const char *check_failure = switch_event_get_header(event, "Delivery-Failure");
@@ -115,7 +115,7 @@ typedef enum {
                } else {                                                                                                                \
                        tzoff = NULL;                                                                                           \
                }                                                                                                                               \
-       } while(tzoff)                                                                                                          
+       } while(tzoff)
 
 static int parse_exten(switch_event_t *event, switch_xml_t xexten, switch_event_t **extension)
 {
@@ -400,7 +400,7 @@ static switch_event_t *chatplan_hunt(switch_event_t *event)
        }
 
        xexten = switch_xml_child(xcontext, "extension");
-       
+
        while (xexten) {
                int proceed = 0;
                const char *cont = switch_xml_attr(xexten, "continue");
@@ -415,7 +415,7 @@ static switch_event_t *chatplan_hunt(switch_event_t *event)
                                                  to, context, exten_name, cont ? cont : "false");
 
                proceed = parse_exten(event, xexten, &extension);
-               
+
                if (proceed && !switch_true(cont)) {
                        break;
                }
@@ -445,7 +445,7 @@ static switch_status_t chat_send(switch_event_t *message_event)
                forwards = 70;
        } else {
                forwards = atoi(var);
-               
+
                if (forwards) {
                        forwards--;
                }
@@ -463,11 +463,11 @@ static switch_status_t chat_send(switch_event_t *message_event)
 
        if ((exten = chatplan_hunt(message_event))) {
                switch_event_header_t *hp;
-               
+
                for (hp = exten->headers; hp; hp = hp->next) {
                        status = switch_core_execute_chat_app(message_event, hp->name, hp->value);
                        if (!SWITCH_READ_ACCEPTABLE(status)) {
-                               status = SWITCH_STATUS_SUCCESS; 
+                               status = SWITCH_STATUS_SUCCESS;
                                break;
                        }
                }
@@ -542,7 +542,7 @@ SWITCH_STANDARD_CHAT_APP(set_function)
        if ((val = strchr(var, '='))) {
                *val++ = '\0';
        }
+
        if (zstr(val)) {
                switch_event_del_header(message, var);
        } else {
@@ -618,7 +618,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sms_load)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
                return SWITCH_STATUS_GENERR;
        }
-       
+
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -632,7 +632,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sms_load)
        SWITCH_ADD_CHAT_APP(chat_app_interface, "send", "send the message as-is", "send the message as-is", send_function, "", SCAF_NONE);
        SWITCH_ADD_CHAT_APP(chat_app_interface, "fire", "fire the message", "fire the message", fire_function, "", SCAF_NONE);
        SWITCH_ADD_CHAT_APP(chat_app_interface, "system", "execute a system command", "execute a sytem command", system_function, "", SCAF_NONE);
-                                               
+
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
@@ -645,7 +645,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sms_shutdown)
        switch_event_unbind_callback(event_handler);
 
        switch_event_free_subclass(MY_EVENT_DELIVERY_REPORT);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index d43202451536af1e13f6eb6717a3448c9b1381e8..3c4f7c69cfeaf04667442f00a67e02682a2dd891 100644 (file)
@@ -96,11 +96,11 @@ static void *SWITCH_THREAD_FUNC mod_sms_flowroute_profile_event_thread(switch_th
                fprintf(stderr, "Unable to listen on socket [%d]\n", err);
                return 0;
        }
-       
+
        sock = h2o_evloop_socket_create(profile->h2o_context.loop, fd, H2O_SOCKET_FLAG_DONT_READ);
        sock->data = (void *) profile;
        h2o_socket_read_start(sock, on_accept);
-       
+
        while ( profile->running ) {
                //              switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile[%s] event thread loop\n", profile->name);
                h2o_timeout_init(profile->h2o_context.loop, &timeout, 1000); /* 1 second loop */
@@ -115,7 +115,7 @@ static void *SWITCH_THREAD_FUNC mod_sms_flowroute_profile_event_thread(switch_th
        h2o_socket_close(sock);
        return 0;
 }
-       
+
 switch_status_t mod_sms_flowroute_profile_destroy(mod_sms_flowroute_profile_t **old_profile)
 {
        mod_sms_flowroute_profile_t *profile = NULL;
@@ -124,9 +124,9 @@ switch_status_t mod_sms_flowroute_profile_destroy(mod_sms_flowroute_profile_t **
        if ( !old_profile || !*old_profile ) {
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        profile = *old_profile;
-       
+
        switch_core_hash_delete(mod_sms_flowroute_globals.profile_hash, profile->name);
 
        profile->running = 0;
@@ -139,7 +139,7 @@ switch_status_t mod_sms_flowroute_profile_destroy(mod_sms_flowroute_profile_t **
        switch_safe_free(profile->h2o_context.loop);
        h2o_context_dispose(&(profile->h2o_context));
        h2o_config_dispose(&(profile->h2o_globalconf));
-       
+
        switch_core_destroy_memory_pool(&(profile->pool));
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile[%s] destroyed\n", profile->name);
 
@@ -162,14 +162,14 @@ static int mod_sms_flowroute_profile_request_handler(h2o_handler_t *handler, h2o
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid request received[%.*s]", (int) request->entity.len, request->entity.base);
                goto done;
        }
-       
+
        switch_event_create(&evt, SWITCH_EVENT_MESSAGE);
-       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "to", cJSON_GetObjectCstr(parsed, "to")); 
-       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "body", cJSON_GetObjectCstr(parsed, "body")); 
-       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "from", cJSON_GetObjectCstr(parsed, "from")); 
-       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "record_id", cJSON_GetObjectCstr(parsed, "id")); 
-       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "context", "default"); 
-       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "proto", "sms_flowroute"); 
+       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "to", cJSON_GetObjectCstr(parsed, "to"));
+       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "body", cJSON_GetObjectCstr(parsed, "body"));
+       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "from", cJSON_GetObjectCstr(parsed, "from"));
+       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "record_id", cJSON_GetObjectCstr(parsed, "id"));
+       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "context", "default");
+       switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "proto", "sms_flowroute");
 
     switch_core_chat_send("GLOBAL_SMS", evt);
        switch_event_destroy(&evt);
@@ -181,7 +181,7 @@ static int mod_sms_flowroute_profile_request_handler(h2o_handler_t *handler, h2o
        h2o_send(request, &body, 1, 1);
 
  done:
-       
+
        cJSON_Delete(parsed);
        switch_safe_free(content);
        return 0;
@@ -191,11 +191,11 @@ switch_status_t mod_sms_flowroute_profile_create(mod_sms_flowroute_profile_t **n
                                                                                                 char *access_key, char *secret_key, char *host)
 {
        mod_sms_flowroute_profile_t *profile = NULL;
-       switch_memory_pool_t *pool = NULL;      
+       switch_memory_pool_t *pool = NULL;
        switch_threadattr_t *thd_attr;
        char auth[256] = {0};
        unsigned int auth_size = 0;
-       
+
        switch_core_new_memory_pool(&pool);
 
        profile = switch_core_alloc(pool, sizeof(mod_sms_flowroute_profile_t));
@@ -217,7 +217,7 @@ switch_status_t mod_sms_flowroute_profile_create(mod_sms_flowroute_profile_t **n
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile[%s] error processing url[%s]\n", profile->name, profile->host);
                goto err;
        }
-       
+
        h2o_config_init(&(profile->h2o_globalconf));
        profile->h2o_hostconf = h2o_config_register_host(&(profile->h2o_globalconf), h2o_iovec_init(H2O_STRLIT("mod_sms_flowroute")), 2048);
 
@@ -225,7 +225,7 @@ switch_status_t mod_sms_flowroute_profile_create(mod_sms_flowroute_profile_t **n
        profile->h2o_pathconf = h2o_config_register_path(profile->h2o_hostconf, "/", 0);
        profile->h2o_handler = h2o_create_handler(profile->h2o_pathconf, sizeof(h2o_handler_t));
        profile->h2o_handler->on_req = mod_sms_flowroute_profile_request_handler;
-       
+
        h2o_context_init(&(profile->h2o_context), h2o_evloop_create(), &(profile->h2o_globalconf));
 
        profile->queue = h2o_multithread_create_queue(profile->h2o_context.loop);
@@ -237,7 +237,7 @@ switch_status_t mod_sms_flowroute_profile_create(mod_sms_flowroute_profile_t **n
        switch_threadattr_create(&thd_attr, pool);
        switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
        switch_thread_create(&(profile->profile_thread), thd_attr, mod_sms_flowroute_profile_event_thread, (void *) profile, pool);
-       
+
        switch_core_hash_insert(mod_sms_flowroute_globals.profile_hash, name, (void *) profile);
        *new_profile = profile;
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile[%s] created\n", profile->name);
@@ -366,12 +366,12 @@ switch_status_t mod_sms_flowroute_profile_send_message(mod_sms_flowroute_profile
        if ( !to ) {
                to = switch_event_get_header(event, "destination_addr");
        }
-       
+
        from = switch_event_get_header(event, "from");
        if ( !from ) {
                from = switch_event_get_header(event, "source_addr");
        }
-       
+
        cJSON_AddItemToObject(body, "to", cJSON_CreateString(to));
        cJSON_AddItemToObject(body, "from", cJSON_CreateString(from));
        cJSON_AddItemToObject(body, "body", cJSON_CreateString((const char *) switch_event_get_body(event)));
@@ -390,7 +390,7 @@ switch_status_t mod_sms_flowroute_profile_send_message(mod_sms_flowroute_profile
                                                        profile->auth_b64_size, profile->auth_b64,
                                                        (int) profile->url_parsed.authority.len, profile->url_parsed.authority.base,
                                                        (int)strlen(text), text);
-       
+
        if ( profile->debug ) {
                char *msg_txt = NULL;
                switch_event_serialize(event, &msg_txt, SWITCH_FALSE);
@@ -417,7 +417,7 @@ switch_status_t mod_sms_flowroute_profile_send_message(mod_sms_flowroute_profile
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] send_message resulted in failure status %d\n", profile->name, msg->status);
                goto err;
        }
-       
+
        h2o_timeout_dispose(msg->ctx.loop, msg->ctx.io_timeout);
        switch_mutex_destroy(msg->mutex);
        switch_safe_free(msg->req.base);
@@ -427,10 +427,10 @@ switch_status_t mod_sms_flowroute_profile_send_message(mod_sms_flowroute_profile
  err:
        if ( msg && msg->mutex ) {
                switch_mutex_destroy(msg->mutex);
-       }       
+       }
        h2o_timeout_dispose(msg->ctx.loop, msg->ctx.io_timeout);
        switch_safe_free(msg->req.base);
-       switch_safe_free(msg);  
+       switch_safe_free(msg);
        return SWITCH_STATUS_GENERR;
 }
 
@@ -442,7 +442,7 @@ switch_status_t mod_sms_flowroute_interface_chat_send(switch_event_t *event)
        if (zstr(profile_name)) {
                profile_name = "default";
        }
-       
+
        profile = switch_core_hash_find(mod_sms_flowroute_globals.profile_hash, profile_name);
 
        if (!profile) {
@@ -481,7 +481,7 @@ SWITCH_STANDARD_APP(mod_sms_flowroute_app_send_function)
        if (switch_event_create(&message, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) {
                return;
        }
-       
+
        /* Copy over recognized channel vars. Then call the chat send function */
        /* Cycle through all of the channel headers, and ones with 'sms_flowroute_' prefix copy over without the prefix */
        for ( chan_var = switch_channel_variable_first(channel); chan_var; chan_var = chan_var->next) {
@@ -489,7 +489,7 @@ SWITCH_STANDARD_APP(mod_sms_flowroute_app_send_function)
                        switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, chan_var->name + 14, chan_var->value);
                }
        }
-       
+
        /* Unlock the channel variables */
        switch_channel_variable_last(channel);
        mod_sms_flowroute_chat_send_function(message, data);
@@ -530,7 +530,7 @@ SWITCH_STANDARD_API(mod_sms_flowroute_send_api)
        if (switch_event_create(&message, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) {
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
-       
+
        switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, "destination_addr", argv[1]);
        switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, "source_addr", argv[2]);
        switch_event_set_body(message, argv[3]);
@@ -542,10 +542,10 @@ SWITCH_STANDARD_API(mod_sms_flowroute_send_api)
  done:
        switch_safe_free(cmd_dup);
        return status;
-                                                                       
+
 }
 
-switch_status_t mod_sms_flowroute_do_config() 
+switch_status_t mod_sms_flowroute_do_config()
 {
        char *conf = "sms_flowroute.conf";
        switch_xml_t xml, cfg, profiles, profile, params, param;
@@ -556,7 +556,7 @@ switch_status_t mod_sms_flowroute_do_config()
        }
 
        if ( (profiles = switch_xml_child(cfg, "profiles")) != NULL) {
-               for (profile = switch_xml_child(profiles, "profile"); profile; profile = profile->next) {               
+               for (profile = switch_xml_child(profiles, "profile"); profile; profile = profile->next) {
                        mod_sms_flowroute_profile_t *new_profile = NULL;
                        int debug = 0, port = 0;
                        char *access_key = NULL, *secret_key = NULL, *host = NULL;
@@ -594,7 +594,7 @@ switch_status_t mod_sms_flowroute_do_config()
 
        switch_xml_free(xml);
        return SWITCH_STATUS_SUCCESS;
-       
+
  err:
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Configuration failed\n");
        if(xml){
@@ -613,12 +613,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sms_flowroute_load)
 
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       
+
        memset(&mod_sms_flowroute_globals, 0, sizeof(mod_sms_flowroute_globals_t));
        mod_sms_flowroute_globals.pool = pool;
        mod_sms_flowroute_globals.debug = 0;
        switch_core_hash_init(&(mod_sms_flowroute_globals.profile_hash));
-       
+
        if ( mod_sms_flowroute_do_config() != SWITCH_STATUS_SUCCESS ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load due to bad configs\n");
                return SWITCH_STATUS_TERM;
@@ -627,14 +627,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sms_flowroute_load)
        /*      SSL_load_error_strings();
        SSL_library_init();
        OpenSSL_add_all_algorithms();*/
-       
+
 
        SWITCH_ADD_CHAT(mod_sms_flowroute_chat_interface, "sms_flowroute", mod_sms_flowroute_interface_chat_send);
        SWITCH_ADD_API(mod_sms_flowroute_api_interface, "sms_flowroute_send", "mod_sms_flowroute send", mod_sms_flowroute_send_api, NULL);
        SWITCH_ADD_API(mod_sms_flowroute_api_interface, "sms_flowroute_debug", "mod_sms_flowroute toggle debug", mod_sms_flowroute_debug_api, NULL);
-       SWITCH_ADD_CHAT_APP(mod_sms_flowroute_chat_app_interface, "sms_flowroute_send", "send message to profile", "send message to profile", 
+       SWITCH_ADD_CHAT_APP(mod_sms_flowroute_chat_app_interface, "sms_flowroute_send", "send message to profile", "send message to profile",
                                                mod_sms_flowroute_chat_send_function, "", SCAF_NONE);
-       SWITCH_ADD_APP(mod_sms_flowroute_app_interface, "sms_flowroute_send", NULL, NULL, mod_sms_flowroute_app_send_function, 
+       SWITCH_ADD_APP(mod_sms_flowroute_app_interface, "sms_flowroute_send", NULL, NULL, mod_sms_flowroute_app_send_function,
                                   "sms_flowroute_send", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 
        /* indicate that the module should continue to be loaded */
index 1816c7a8fb8761a0adce435d3402070f49678051..47651299dc8ebd366d750b164462817ff7823a79 100644 (file)
@@ -54,7 +54,7 @@ typedef struct {
 
   unsigned char auth_b64[512];
   int auth_b64_size;
-  
+
   h2o_url_t url_parsed;
   h2o_socketpool_t *sockpool;
 
index adc900ea3db217ab282fcf24c54c49243769c8ff..36f54ecb7a82be845956fea85060b7626ea0dd6f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -35,7 +35,7 @@
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_snapshot_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_snapshot_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_snapshot, mod_snapshot_load, NULL, NULL);
@@ -193,7 +193,7 @@ static switch_status_t do_snap(switch_core_session_t *session)
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Bug is not attached.\n", switch_channel_get_name(channel));
        return SWITCH_STATUS_FALSE;
-       
+
 }
 
 #define SNAP_SYNTAX "start <sec> <read|write>"
index aac6e8cc7b3e290f4da3653287fd5144235e00fc..5917713471459dd85cd6abe4354d363e65ce1982 100644 (file)
@@ -1,4 +1,4 @@
-<include>              
+<include>
        <extension name="snom-demo-1">
                <condition field="destination_number" expression="^9000$">
                        <!-- <key> <light> <label> <user> <host> <profile> <action_name> <action> -->
index ffec25f7a85ddc8824beeebe6efbc97ede1945a2..af460e7523319bc3cdecd174b19afae9cb65d40b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_snom.c -- SNOM Specific Features
index ebf641a351bab34358aced99c6dbb5e5d8451924..52bd5ebf176192663a29055401b08408aaf16c83 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * William King <william.king@quentustech.com>
  * Seven Du <dujinfang@gmail.com>
  *
  * mod_sonar.c -- Sonar ping timer
  *
- * 
+ *
  */
 
 /*
@@ -54,7 +54,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sonar_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_sonar_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_sonar_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_sonar, mod_sonar_load, mod_sonar_shutdown, NULL);
@@ -95,7 +95,7 @@ switch_bool_t sonar_ping_callback(switch_core_session_t *session, const char *ap
        ph->max = MAX(ph->max, diff);
        ph->min = MIN(ph->min, diff);
        ph->samples[ph->received++] = diff;
-       
+
        return SWITCH_TRUE;
 }
 
@@ -123,16 +123,16 @@ SWITCH_STANDARD_APP(sonar_app)
        } else if (loops > 1024) {
                loops = 1024;
        }
-       
+
        switch_channel_answer(channel);
        switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL);
        switch_channel_set_private(channel, "__sonar_ping__", &ph);
 
-       switch_ivr_tone_detect_session(session, 
+       switch_ivr_tone_detect_session(session,
                                                                   "soar_ping", "1004",
-                                                                  "r", 0, 
+                                                                  "r", 0,
                                                                   1, NULL, NULL, sonar_ping_callback);
-       
+
        switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL);
 
        ph.min = 999999;
@@ -147,7 +147,7 @@ SWITCH_STANDARD_APP(sonar_app)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Lost sonar ping\n");
                }
        }
-       
+
        switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL);
        switch_ivr_stop_tone_detect_session(session);
 
@@ -223,7 +223,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sonar_load)
                return SWITCH_STATUS_TERM;
        }
 
-       
+
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -240,7 +240,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sonar_shutdown)
 {
 
        switch_event_free_subclass("sonar::ping");
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index decc7ae848d62dd967e0d89c85d15c484b3c8109..734a09ba4e78be8c6c3ac27ad93101abc4d6e19a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_soundtouch.cpp -- Example of writeable media bugs
@@ -293,7 +293,7 @@ SWITCH_STANDARD_APP(soundtouch_start_function)
                                n++;
                        } else if (strchr(argv[x], 's')) {
                                /*12.0f taken from soundtouch conversion to octaves*/
-                               sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) ); 
+                               sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) );
                                n++;
                        } else if (strchr(argv[x], 't')) {
                                sth->tempo = normalize_soundtouch_value('t', atof(argv[x]));
@@ -405,7 +405,7 @@ SWITCH_STANDARD_API(soundtouch_api_function)
                        n++;
                } else if (strchr(argv[x], 's')) {
                        /*12.0f taken from soundtouch conversion to octaves*/
-                       sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) ); 
+                       sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) );
                        n++;
                } else if (strchr(argv[x], 't')) {
                        sth->tempo = normalize_soundtouch_value('t', atof(argv[x]));
@@ -450,9 +450,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_soundtouch_load)
        switch_api_interface_t *api_interface;
 
        /* connect my internal structure to the blank pointer passed to me */
-       *module_interface = switch_loadable_module_create_module_interface(pool, modname); 
+       *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-       SWITCH_ADD_APP(app_interface, "soundtouch", "Alter the audio stream", "Alter the audio stream pitch/rate/tempo", 
+       SWITCH_ADD_APP(app_interface, "soundtouch", "Alter the audio stream", "Alter the audio stream pitch/rate/tempo",
                    soundtouch_start_function, "[send_leg] [hook_dtmf] [-]<X>s [-]<X>o <X>p <X>r <X>t", SAF_NONE);
 
        SWITCH_ADD_API(api_interface, "soundtouch", "soundtouch", soundtouch_api_function, SOUNDTOUCH_API_SYNTAX);
index da5d2f3fe95cfe559ff47ff090c0f937ac23e9cd..5979819f42fa8cf1f5ad9ad0b73504b71a79befe 100644 (file)
@@ -1,7 +1,7 @@
 <configuration name="spandsp.conf" description="SpanDSP config">
     <modem-settings>
 <!--
-    total-modems set to N will create that many soft-modems.  
+    total-modems set to N will create that many soft-modems.
     If you use them with Hylafax you need the following for each one numbered 0..N:
 
     1) A line like this in /etc/inittab:
index 4e4319bfb804e8c5ce3691536fb8478d3b5f9998..7d8c0d1e63612efca1d246724cbaea2c9b8aefa1 100644 (file)
@@ -222,7 +222,7 @@ SWITCH_STANDARD_APP(t38_gateway_function)
        }
 
        switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_POSSIBLE);
-               
+
        if (zstr(direction) || strcasecmp(direction, "self")) {
                direction = "peer";
        }
@@ -809,7 +809,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SPANDSP_EVENT_RXFAXRESULT);
                return SWITCH_STATUS_TERM;
        }
-       
+
        memset(&spandsp_globals, 0, sizeof(spandsp_globals));
        spandsp_globals.pool = pool;
 
@@ -900,7 +900,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spandsp_shutdown)
        switch_event_free_subclass(SPANDSP_EVENT_RXFAXPAGERESULT);
        switch_event_free_subclass(SPANDSP_EVENT_TXFAXRESULT);
        switch_event_free_subclass(SPANDSP_EVENT_RXFAXRESULT);
-       
+
        mod_spandsp_fax_shutdown();
        mod_spandsp_dsp_shutdown();
 #if defined(MODEM_SUPPORT)
index 0f5c316667d70a6dc3ba52aa1ab82ed696072bd8..a4c6ba22236fb857814f3b53369ac75c9f0eb3d3 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
index 18c3977a8c8719047b915f6dce4d40942781bd78..4e755b7901a6be0aafa9492a4b6cfb0e359347c9 100644 (file)
@@ -402,7 +402,7 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
        switch_core_session_t *session = switch_core_media_bug_get_session(bug);
        switch_codec_implementation_t read_impl = { 0 };
 
-       
+
        switch (type) {
        case SWITCH_ABC_TYPE_INIT: {
                pvt->dtmf_detect = dtmf_rx_init(NULL, NULL, NULL);
@@ -432,7 +432,7 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
                        int samples = frame->samples;
 
                        switch_core_session_get_read_impl(session, &read_impl);
-                       
+
                        if (read_impl.number_of_channels != 1 || read_impl.actual_samples_per_second != 8000) {
                                memcpy(data, frame->data, frame->datalen);
                                dp = data;
@@ -452,14 +452,14 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
                                                                                           read_impl.actual_samples_per_second,
                                                                                           8000,
                                                                                           8 * (read_impl.microseconds_per_packet / 1000) * 2,
-                                                                                          SWITCH_RESAMPLE_QUALITY, 
+                                                                                          SWITCH_RESAMPLE_QUALITY,
                                                                                           1) != SWITCH_STATUS_SUCCESS) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate resampler\n");
                                                return SWITCH_FALSE;
                                        }
                                }
 
-                               
+
 
                                switch_resample_process(pvt->resampler, dp, (int) datalen / 2 / 1);
                                memcpy(dp, pvt->resampler->to, pvt->resampler->to_len * 2 * 1);
index e1276fc1017d938c1bee5c1af48414ffe0a6ac75..940c0caee24b06488a27cacfcf0524db7b4227eb 100644 (file)
@@ -1362,7 +1362,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
                switch_channel_var_true(channel, "fax_enable_t38_insist")) {
                switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_POSSIBLE);
        }
-       
+
        pvt = pvt_init(session, app_mode);
        switch_channel_set_private(channel, "_fax_pvt", pvt);
 
@@ -1618,7 +1618,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
        spanfax_destroy(pvt);
 
        switch_channel_clear_app_flag_key("T38", channel, CF_APP_T38_POSSIBLE);
-       
+
        /* restore the original codecs over the channel */
 
        switch_core_session_set_read_codec(session, NULL);
@@ -2093,7 +2093,7 @@ switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app,
 
                switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_POSSIBLE);
                switch_channel_set_app_flag_key("T38", other_channel, CF_APP_T38_POSSIBLE);
-               
+
                switch_channel_set_flag(channel, CF_REDIRECT);
                switch_channel_set_state(channel, CS_RESET);
 
@@ -2291,7 +2291,7 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
        switch_codec_implementation_t read_impl = { 0 };
        switch_core_session_get_read_impl(session, &read_impl);
 
-       
+
        if (timeout) {
                to = switch_epoch_time_now(NULL) + timeout;
        }
@@ -2306,7 +2306,7 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
        }
 
        switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_POSSIBLE);
-       
+
        if (app) {
                cont->app = switch_core_session_strdup(session, app);
        }
index dbdd8d82565608b31a6f414652601ef7cd37fe44..21c4296871ffdb859cefecef7f951b996a59430b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -27,7 +27,7 @@
  * Brian West <brian@freeswitch.org>
  * Anthony Minessale II <anthm@freeswitch.org>
  * Steve Underwood <steveu@coppice.org>
- * mod_spandsp_modem.c -- t31 Soft Modem 
+ * mod_spandsp_modem.c -- t31 Soft Modem
  *
  */
 
@@ -106,7 +106,7 @@ static int t31_at_tx_handler(void *user_data, const uint8_t *buf, size_t len)
 #endif
 
        if (wrote != len) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to pass the full buffer onto the device file. " 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to pass the full buffer onto the device file. "
                                                  "%"SWITCH_SSIZE_T_FMT " bytes of " "%"SWITCH_SIZE_T_FMT " written: %s\n", wrote, len, strerror(errno));
 
                if (wrote == -1) wrote = 0;
@@ -138,7 +138,7 @@ static int t31_call_control_handler(t31_state_t *s, void *user_data, int op, con
        return ret;
 }
 
-static modem_state_t modem_get_state(modem_t *modem) 
+static modem_state_t modem_get_state(modem_t *modem)
 {
        modem_state_t state;
 
@@ -149,18 +149,18 @@ static modem_state_t modem_get_state(modem_t *modem)
        return state;
 }
 
-static void _modem_set_state(modem_t *modem, modem_state_t state, const char *file, const char *func, int line) 
+static void _modem_set_state(modem_t *modem, modem_state_t state, const char *file, const char *func, int line)
 {
 
        switch_mutex_lock(modem->mutex);
-       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG,"Modem %s [%s] - Changing state to %s\n", modem->devlink, 
+       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG,"Modem %s [%s] - Changing state to %s\n", modem->devlink,
                                          modem_state2name(modem->state), modem_state2name(state));
        modem->state = state;
        switch_mutex_unlock(modem->mutex);
 }
 #define modem_set_state(_modem, _state) _modem_set_state(_modem, _state, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-char *modem_state2name(int state) 
+char *modem_state2name(int state)
 {
        if (state > MODEM_STATE_LAST || state < 0) {
                state = MODEM_STATE_LAST;
@@ -169,7 +169,7 @@ char *modem_state2name(int state)
        return MODEM_STATE[state].name;
 }
 
-int modem_close(modem_t *modem) 
+int modem_close(modem_t *modem)
 {
        int r = 0;
        switch_status_t was_running = switch_test_flag(modem, MODEM_FLAG_RUNNING);
@@ -295,7 +295,7 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
 
 #ifndef WIN32
        snprintf(modem->devlink, sizeof(modem->devlink), "%s/FS%d", spandsp_globals.modem_directory, modem->slot);
-       
+
        unlink(modem->devlink);
 
        if (symlink(modem->stty, modem->devlink)) {
@@ -329,7 +329,7 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
        }
        modem->threadAbort = CreateEvent(NULL, TRUE, FALSE, NULL);
 #endif
-       
+
        if (!(modem->t31_state = t31_init(NULL, t31_at_tx_handler, modem, t31_call_control_handler, modem, t38_tx_packet_handler, modem))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot initialize the T.31 modem\n");
                modem_close(modem);
@@ -414,8 +414,8 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
 static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
 
 
-/* 
-   State methods they get called when the state changes to the specific state 
+/*
+   State methods they get called when the state changes to the specific state
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
 */
@@ -471,11 +471,11 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
                                t31_call_event(tech_pvt->modem->t31_state, AT_CALL_EVENT_ALERTING);
                                rt = ring_ticks;
                        }
-                       
+
                        switch_yield(rest);
                        to_ticks--;
                }
-               
+
                if (to_ticks < 1 || modem_get_state(tech_pvt->modem) != MODEM_STATE_ANSWERED) {
                        t31_call_event(tech_pvt->modem->t31_state, AT_CALL_EVENT_NO_ANSWER);
                        switch_channel_hangup(channel, SWITCH_CAUSE_NO_ANSWER);
@@ -487,7 +487,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
        }
 
        switch_channel_set_state(channel, CS_ROUTING);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -528,7 +528,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
 
        //channel = switch_core_session_get_channel(session);
        //switch_assert(channel != NULL);
-       
+
        if ((tech_pvt = switch_core_session_get_private(session))) {
 
                switch_core_timer_destroy(&tech_pvt->timer);
@@ -675,7 +675,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
 
        tech_pvt->read_frame.flags = SFF_NONE;
        switch_core_timer_next(&tech_pvt->timer);
-       
+
        do {
                r = t31_tx(tech_pvt->modem->t31_state, data + samples_read, samples_wanted - samples_read);
                if (r < 0) break;
@@ -715,7 +715,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
        if (t31_rx(tech_pvt->modem->t31_state, frame->data, frame->datalen / 2)) {
                status = SWITCH_STATUS_FALSE;
        }
-       
+
        return status;
 }
 
@@ -862,7 +862,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_ERROR, "Cannot find a modem.\n");
                        cause = SWITCH_CAUSE_USER_BUSY; goto fail;
                }
-               
+
                switch_core_session_add_stream(*new_session, NULL);
 
                if ((tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) != 0) {
@@ -944,7 +944,7 @@ static switch_status_t create_session(switch_core_session_t **new_session, modem
        char name[1024];
        switch_caller_profile_t *caller_profile;
        char *ani = NULL, *p, *digits = NULL;
-       
+
        if (!(session = switch_core_session_request(modem_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Failure.\n");
                goto end;
@@ -953,7 +953,7 @@ static switch_status_t create_session(switch_core_session_t **new_session, modem
        switch_core_session_add_stream(session, NULL);
        channel = switch_core_session_get_channel(session);
        tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(*tech_pvt));
-       
+
        p = switch_core_session_strdup(session, modem->digits);
 
        if (*p == '*') {
@@ -964,7 +964,7 @@ static switch_status_t create_session(switch_core_session_t **new_session, modem
                        ani = NULL;
                }
        }
-       
+
        if (zstr(digits)) {
                digits = p;
        }
@@ -985,14 +985,14 @@ static switch_status_t create_session(switch_core_session_t **new_session, modem
        caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
                                                                                           modem->devlink,
                                                                                           spandsp_globals.modem_dialplan,
-                                                                                          "FSModem", 
+                                                                                          "FSModem",
                                                                                           ani,
-                                                                                          NULL, 
+                                                                                          NULL,
                                                                                           ani,
-                                                                                          NULL, 
-                                                                                          NULL, 
-                                                                                          "mod_spandsp", 
-                                                                                          spandsp_globals.modem_context, 
+                                                                                          NULL,
+                                                                                          NULL,
+                                                                                          "mod_spandsp",
+                                                                                          spandsp_globals.modem_context,
                                                                                           digits);
 
        caller_profile->source = switch_core_strdup(caller_profile->pool, "mod_spandsp");
@@ -1027,7 +1027,7 @@ static int control_handler(modem_t *modem, const char *num, int op)
 {
        switch_core_session_t *session = NULL;
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Control Handler op:%d state:[%s] %s\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Control Handler op:%d state:[%s] %s\n",
                                          op, modem_state2name(modem_get_state(modem)), modem->devlink);
 
        switch (op) {
@@ -1045,7 +1045,7 @@ static int control_handler(modem_t *modem, const char *num, int op)
                        wake_modem_thread(modem);
 
                        switch_set_string(modem->digits, num);
-                       
+
                        if (create_session(&session, modem) != SWITCH_STATUS_SUCCESS) {
                                t31_call_event(modem->t31_state, AT_CALL_EVENT_HANGUP);
                        } else {
@@ -1059,11 +1059,11 @@ static int control_handler(modem_t *modem, const char *num, int op)
                modem_set_state(modem, MODEM_STATE_OFFHOOK);
                break;
        case AT_MODEM_CONTROL_ONHOOK:
-       case AT_MODEM_CONTROL_HANGUP: 
+       case AT_MODEM_CONTROL_HANGUP:
                {
                        if (modem_get_state(modem) != MODEM_STATE_RINGING) {
                                int set_state = 1;
-                               
+
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                                                  "Modem %s [%s] - Hanging up\n", modem->devlink, modem_state2name(modem_get_state(modem)));
                                switch_clear_flag(modem, MODEM_FLAG_XOFF);
@@ -1073,10 +1073,10 @@ static int control_handler(modem_t *modem, const char *num, int op)
 
                                if (!zstr(modem->uuid_str)) {
                                        switch_core_session_t *session;
-                                       
+
                                        if ((session = switch_core_session_force_locate(modem->uuid_str))) {
                                                switch_channel_t *channel = switch_core_session_get_channel(session);
-                                               
+
                                                if (switch_channel_up(channel)) {
                                                        switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
                                                        set_state = 0;
@@ -1148,7 +1148,7 @@ static int modem_wait_sock(int sock, uint32_t ms, modem_poll_t flags)
 {
        struct pollfd pfds[2] = { { 0 } };
        int s = 0, r = 0;
-       
+
        pfds[0].fd = sock;
 
        if ((flags & MODEM_POLL_READ)) {
@@ -1162,7 +1162,7 @@ static int modem_wait_sock(int sock, uint32_t ms, modem_poll_t flags)
        if ((flags & MODEM_POLL_ERROR)) {
                pfds[0].events |= POLLERR;
        }
-       
+
        s = poll(pfds, 1, ms);
 
        if (s < 0) {
@@ -1208,7 +1208,7 @@ static int modem_wait_sock(modem_t *modem, int ms, modem_poll_t flags)
        if (result == 0)
        {
                if (GetLastError() != ERROR_IO_PENDING) {
-                       /* something went horribly wrong with WaitCommEvent(), so 
+                       /* something went horribly wrong with WaitCommEvent(), so
                        clear all errors and try again */
                        DWORD comerrors;
                        ClearCommError(modem->master, &comerrors, 0);
@@ -1278,7 +1278,7 @@ static void *SWITCH_THREAD_FUNC modem_thread(switch_thread_t *thread, void *obj)
                                continue;
                        }
 
-#ifndef WIN32          
+#ifndef WIN32
                        r = read(modem->master, buf, avail);
 #else
                        o.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -1318,7 +1318,7 @@ static void *SWITCH_THREAD_FUNC modem_thread(switch_thread_t *thread, void *obj)
        return NULL;
 }
 
-static void launch_modem_thread(modem_t *modem) 
+static void launch_modem_thread(modem_t *modem)
 {
        switch_thread_t *thread;
        switch_threadattr_t *thd_attr = NULL;
@@ -1350,7 +1350,7 @@ static void deactivate_modems(void)
 {
        int max = globals.SOFT_MAX_MODEMS;
        int x;
-       
+
        switch_mutex_lock(globals.mutex);
 
        for (x = 0; x < max; x++) {
@@ -1409,7 +1409,7 @@ switch_status_t modem_global_init(switch_loadable_module_interface_t **module_in
        globals.pool = pool;
 
        globals.SOFT_MAX_MODEMS = spandsp_globals.modem_count;
-       
+
        switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, pool);
 
        modem_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
index 8ed0dd01dd6c9f7e5c78f2205a9ea57158ddf07d..58cc2f6055953ffc3e020e72e8545f2b4d1277dc 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
 
 
 typedef enum {
-       MODEM_STATE_INIT,       
-       MODEM_STATE_ONHOOK,     
-       MODEM_STATE_OFFHOOK,    
+       MODEM_STATE_INIT,
+       MODEM_STATE_ONHOOK,
+       MODEM_STATE_OFFHOOK,
        MODEM_STATE_ACQUIRED,
        MODEM_STATE_RINGING,
        MODEM_STATE_ANSWERED,
index 6644a6ed7492856e2fdb317df41e405d6358e91d..4244c1a51991a8db2465092cca918105f0b8c3fa 100644 (file)
@@ -1,5 +1,5 @@
 //#define UDPTL_DEBUG
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2009, Steve Underwood <steveu@coppice.org>
  *
@@ -16,7 +16,7 @@
  * License.
  *
  * Contributor(s):
- * 
+ *
  * Steve Underwood <steveu@coppice.org>
  *
  * udptl.c -- UDPTL handling for T.38
@@ -252,7 +252,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
                                           FEC mode after sending some redundant packets, and this may then be important. */
                                        x = (seq_no - i) & UDPTL_BUF_MASK;
                                        if (lengths[i - 1] > 0)
-                                               memcpy(s->rx[x].buf, bufs[i - 1], lengths[i - 1]);                                              
+                                               memcpy(s->rx[x].buf, bufs[i - 1], lengths[i - 1]);
                                        s->rx[x].buf_len = lengths[i - 1];
                                        s->rx[x].fec_len[0] = 0;
                                        s->rx[x].fec_span = 0;
index 39740353d11b33d40c7519386c67b540a16edfce..9d42f6bdb92804bb58920d0b10da5b35520a0a09 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2009, Steve Underwood <steveu@coppice.org>
  *
@@ -15,7 +15,7 @@
  * License.
  *
  * Contributor(s):
- * 
+ *
  * Steve Underwood <steveu@coppice.org>
  *
  * udptl.h -- UDPTL handling for T.38
index 646fc012eaae8177b027757e26c9a990a1ce941f..0200ee9bdf25d576c54adf9e25aa2ff716942324 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Csaba Zelei <csaba.zelei@eworldcom.net>
  *
- * Thanks for eWorld Com Ltd. for funding the module. 
+ * Thanks for eWorld Com Ltd. for funding the module.
  *
  * mod_spy.c -- UserSpy Module
  *
@@ -83,7 +83,7 @@ static switch_status_t spy_on_hangup(switch_core_session_t *session)
        switch_core_hash_insert(globals.spy_hash, data, spy);
 
        switch_thread_rwlock_unlock(globals.spy_hash_lock);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -213,16 +213,16 @@ static switch_status_t process_event(switch_event_t *event)
                                while (spy) {
                                        if ((session = switch_core_session_locate(spy->uuid))) {
                                                switch_channel_t *channel = switch_core_session_get_channel(session);
-                                               
+
                                                my_uuid = switch_event_get_header(event, "Unique-ID");
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UserSpy retrieved uuid %s for key %s, activating eavesdrop\n", my_uuid, key);
-                                               
+
                                                switch_channel_set_variable(channel, "spy_uuid", my_uuid);
                                                found++;
-                                               
+
                                                switch_channel_set_state(channel, CS_EXCHANGE_MEDIA);
                                                switch_channel_set_flag(channel, CF_BREAK);
-                                               
+
                                                switch_core_session_rwunlock(session);
                                        }
                                        spy = spy->next;
@@ -238,8 +238,8 @@ static switch_status_t process_event(switch_event_t *event)
        if (!found) {
                status = SWITCH_STATUS_FALSE;
        }
-       
-       
+
+
  done:
        switch_thread_rwlock_unlock(globals.spy_hash_lock);
        return status;
@@ -254,7 +254,7 @@ static void event_handler(switch_event_t *event)
                switch_core_session_t *peer_session = NULL;
                switch_channel_t *peer_channel = NULL;
                switch_event_t *peer_event = NULL;
-               
+
                if (!peer_uuid) {
                        return;
                }
@@ -265,7 +265,7 @@ static void event_handler(switch_event_t *event)
                }
 
                peer_channel = switch_core_session_get_channel(peer_session);
-               
+
                if (switch_event_create(&peer_event, SWITCH_EVENT_CHANNEL_BRIDGE) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't create bridge event for peer channel %s\n", peer_uuid);
                        goto end;
index 3c82fc075262ac6a48e916bbb401ebe288b681cf..fbc268a88dc928b1ed7db841ef7f7bd203b78072 100644 (file)
@@ -136,7 +136,7 @@ void        FFTReal::do_fft (flt_t f [], const flt_t x []) const
 
                                        df2 [0] = sf_0 + sf_2;
                                        df2 [2] = sf_0 - sf_2;
-                                       
+
                                        coef_index += 4;
                                }
                                while (coef_index < _length);
@@ -236,7 +236,7 @@ void        FFTReal::do_fft (flt_t f [], const flt_t x []) const
 
                const flt_t                     b_0 = x [0] + x [2];
                const flt_t                     b_2 = x [1] + x [3];
-               
+
                f [0] = b_0 + b_2;
                f [2] = b_0 - b_2;
        }
index d0a0363b937b6bfceac313f0edcfc2b5f2c2a3b8..791ad06f893c3daf3874b7e6b28fbbc576329bad 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_stress.cpp -- Detect Voice Stress
@@ -81,19 +81,19 @@ static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, s
             } else {
                 return SWITCH_FALSE;
             }
-            
+
             sth->data = (float *) switch_core_session_alloc(sth->session, sizeof(*sth->data) * sth->frame_size);
             sth->result = (float *) switch_core_session_alloc(sth->session, sizeof(*sth->result) * sth->frame_size);
             sth->pow_spectrum = (float *) switch_core_session_alloc(sth->session, sizeof(*sth->pow_spectrum) * sth->frame_size);
             sth->audio = (int16_t *) switch_core_session_alloc(sth->session, sizeof(*sth->audio) * sth->frame_size);
-            
+
             sth->fft = new FFTReal (sth->frame_size);
             switch_buffer_create_dynamic(&sth->audio_buffer, sth->frame_size, sth->frame_size * 3, 0);
 
             sth->bind = (float) sth->rate / sth->frame_size;
             sth->start = (int) (8.0 / sth->bind);
             sth->end = (int) (14.0 / sth->bind);
-            
+
                }
                break;
        case SWITCH_ABC_TYPE_CLOSE:
@@ -109,7 +109,7 @@ static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, s
        case SWITCH_ABC_TYPE_WRITE_REPLACE:
                {
                        switch_frame_t *frame;
-            
+
                        if (sth->read) {
                                frame = switch_core_media_bug_get_read_replace_frame(bug);
                        } else {
@@ -119,7 +119,7 @@ static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, s
             if (!switch_test_flag(frame, SFF_CNG)) {
                 switch_buffer_write(sth->audio_buffer, frame->data, frame->datalen);
             }
-            
+
             sth->stress = 0.0;
 
             if (switch_buffer_inuse(sth->audio_buffer) >= sth->frame_size * sizeof(int16_t)) {
@@ -129,7 +129,7 @@ static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, s
 
                 bytes = switch_buffer_read(sth->audio_buffer, sth->audio, sth->frame_size * sizeof(int16_t));
                 samples = bytes / sizeof(int16_t);
-                
+
                 switch_short_to_float(sth->audio, sth->data, samples);
                 sth->fft->do_fft(sth->result, sth->data);
 
@@ -140,7 +140,7 @@ static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, s
                 sth->avg_tremor_pwr = 0.0;
                 sth->avg_total_pwr = 0.0;
                 sth->total_pwr = 0.0;
-                
+
                 for (i = sth->start; i <= sth->end; ++i) {
                     sth->avg_tremor_pwr += sth->pow_spectrum[i];
                 }
@@ -150,7 +150,7 @@ static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, s
                     sth->total_pwr += sth->pow_spectrum[i];
                 }
                 sth->avg_total_pwr = sth->total_pwr / samples;
-                
+
                 if (sth->total_pwr < threshold) {
                     sth->tremor_ratio = 0.0;
                 } else {
@@ -227,7 +227,7 @@ SWITCH_STANDARD_APP(stress_start_function)
        }
 
        sth->session = session;
-    
+
        if ((status = switch_core_media_bug_add(session, "stress", NULL, stress_callback, sth, 0,
                                                                                        sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
@@ -244,7 +244,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_stress_load)
 
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-       SWITCH_ADD_APP(app_interface, "stress", "Analyze the stream for voice stress", "Analyze the stream for voice stress", 
+       SWITCH_ADD_APP(app_interface, "stress", "Analyze the stream for voice stress", "Analyze the stream for voice stress",
                    stress_start_function, "[read|write|stop]", SAF_NONE);
 
        /* indicate that the module should continue to be loaded */
index d1a18f35e3d86f7c5ed4a258a68a5b98b718d70e..3e7402c30d7d5b2a3ed1b0bd3d220c19babc5152 100644 (file)
@@ -143,7 +143,7 @@ static void translate_number(char *number, char *profile, char **translated, swi
                                goto end;
                        }
                        memset(substituted, 0, len);
-                       
+
                        switch_perform_substitution(re, proceed, rule->replace, number, substituted, len, ovector);
 
                        if ((switch_string_var_check_const(substituted) || switch_string_has_escaped_data(substituted))) {
index 5c711ff75136068e46d1efdf0ffe5f96d06d3c9b..bcfe76d655b39bd81cb0dd2c4b4da7ec8bff650f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * William King <william.king@quentustech.com>
  * Emmanuel Schmidbauer <eschmidbauer@gmail.com>
@@ -38,7 +38,7 @@
 /* Prototypes */
 SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_valet_parking, mod_valet_parking_load, NULL, NULL);
@@ -135,7 +135,7 @@ static void check_timeouts(void)
                        switch_mutex_lock(lot->mutex);
 
                top:
-               
+
                        for (i_hi = switch_core_hash_first_iter( lot->hash, i_hi); i_hi; i_hi = switch_core_hash_next(&i_hi)) {
                                switch_core_hash_this(i_hi, &i_var, NULL, &i_val);
                                i_ext = (char *) i_var;
@@ -175,7 +175,7 @@ static int find_longest(valet_lot_t *lot, int min, int max)
                token = (valet_token_t *) i_val;
                cur = (now - token->start_time);
                i = atoi(token->ext);
-               
+
                if (cur > longest && i >= min && i <= max) {
                        longest = cur;
                        longest_ext = i;
@@ -247,7 +247,7 @@ static valet_token_t *next_id(switch_core_session_t *session, valet_lot_t *lot,
        return token;
 }
 
-static int valet_lot_count(valet_lot_t *lot) 
+static int valet_lot_count(valet_lot_t *lot)
 {
        switch_hash_index_t *i_hi;
        const void *i_var;
@@ -266,7 +266,7 @@ static int valet_lot_count(valet_lot_t *lot)
                        continue;
                }
                count++;
-       }       
+       }
        switch_mutex_unlock(lot->mutex);
 
        return count;
@@ -281,19 +281,19 @@ static void valet_send_presence(const char *lot_name, valet_lot_t *lot, valet_to
        switch_event_t *event;
        int count;
 
-       
+
        dup_lot_name = strdup(lot_name);
        lot_name = dup_lot_name;
 
        if ((domain_name = strchr(dup_lot_name, '@'))) {
                *domain_name++ = '\0';
        }
-       
+
        if (zstr(domain_name)) {
                dup_domain_name = switch_core_get_domain(SWITCH_TRUE);
                domain_name = dup_domain_name;
        }
-       
+
        if (zstr(domain_name)) {
                domain_name = "cluecon.com";
        }
@@ -306,7 +306,7 @@ static void valet_send_presence(const char *lot_name, valet_lot_t *lot, valet_to
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", lot_name);
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", lot_name, domain_name);
 
-                       
+
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d caller%s)", count, count == 1 ? "" : "s");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -324,7 +324,7 @@ static void valet_send_presence(const char *lot_name, valet_lot_t *lot, valet_to
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", lot_name);
                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", lot_name, domain_name);
 
-                       
+
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Empty");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@@ -335,9 +335,9 @@ static void valet_send_presence(const char *lot_name, valet_lot_t *lot, valet_to
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound");
                        switch_event_fire(&event);
-               }               
+               }
        }
-       
+
 
 
        if (in) {
@@ -371,12 +371,12 @@ static void valet_send_presence(const char *lot_name, valet_lot_t *lot, valet_to
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound");
                        switch_event_fire(&event);
-               }               
+               }
        }
 
        switch_safe_free(dup_domain_name);
        switch_safe_free(dup_lot_name);
-                                               
+
 }
 
 struct read_frame_data {
@@ -394,7 +394,7 @@ static switch_status_t read_frame_callback(switch_core_session_t *session, switc
                rf->to = -1;
                return SWITCH_STATUS_FALSE;
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -529,10 +529,10 @@ SWITCH_STANDARD_APP(valet_parking_function)
 
                        if (token && !token->bridged) {
                                switch_core_session_t *b_session;
-                       
+
                                if (token->timeout) {
                                        const char *var = switch_channel_get_variable(channel, "valet_ticket");
-                               
+
                                        if (!zstr(var)) {
                                                if (!strcmp(var, token->uuid)) {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Valet ticket %s accepted.\n", var);
@@ -557,7 +557,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
                                                switch_core_session_rwunlock(b_session);
                                                token->timeout = 0;
                                                token->bridged = 1;
-                                               
+
                                                switch_ivr_uuid_bridge(token->uuid, switch_core_session_get_uuid(session));
 
                                                return;
@@ -592,7 +592,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
                if (!strcasecmp(music, "silence")) {
                        music = "silence_stream://-1";
                }
-               
+
                if ((orbit_exten = switch_channel_get_variable(channel, "valet_parking_orbit_exten"))) {
                        orbit_exten_str = switch_core_session_sprintf(session, "set:valet_parking_orbit_exten=%s,", orbit_exten);
                }
@@ -606,11 +606,11 @@ SWITCH_STANDARD_APP(valet_parking_function)
                }
 
                if ((timeout = switch_channel_get_variable(channel, "valet_parking_timeout"))) {
-                       timeout_str = switch_core_session_sprintf(session, "set:valet_parking_timeout=%s,", timeout);                   
+                       timeout_str = switch_core_session_sprintf(session, "set:valet_parking_timeout=%s,", timeout);
                }
 
                dest = switch_core_session_sprintf(session, "%s%s%s%s"
-                                                                                  "set:valet_ticket=%s,set:valet_hold_music='%s',sleep:1000,valet_park:%s %s", 
+                                                                                  "set:valet_ticket=%s,set:valet_hold_music='%s',sleep:1000,valet_park:%s %s",
                                                                                   timeout_str,
                                                                                   orbit_exten_str,
                                                                                   orbit_dialplan_str,
@@ -626,7 +626,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
                                switch_core_session_t *b_session;
 
                                if ((b_session = switch_core_session_locate(uuid))) {
-                                       token->timeout = switch_epoch_time_now(NULL) + TOKEN_FREQ;              
+                                       token->timeout = switch_epoch_time_now(NULL) + TOKEN_FREQ;
                                        if (play_announce) {
                                                switch_ivr_sleep(session, 1500, SWITCH_TRUE, NULL);
                                                switch_ivr_phrase_macro(session, "valet_announce_ext", tmp, NULL, NULL);
@@ -668,11 +668,11 @@ SWITCH_STANDARD_APP(valet_parking_function)
                                to_val = tmp;
                        }
                }
-       
+
                if (to_val) {
                        switch_codec_implementation_t read_impl;
                        switch_core_session_get_read_impl(session, &read_impl);
-                       
+
                        rf.to = (1000 / (read_impl.microseconds_per_packet / 1000)) * to_val;
                        rf.dp = switch_channel_get_variable(channel, "valet_parking_orbit_dialplan");
                        rf.context = switch_channel_get_variable(channel, "valet_parking_orbit_context");
@@ -786,7 +786,7 @@ static void pres_event_handler(switch_event_t *event)
        char *dup_to = NULL, *lot_name, *dup_lot_name = NULL, *domain_name;
        valet_lot_t *lot;
        int found = 0;
-       
+
        if (!to || strncasecmp(to, "park+", 5) || !strchr(to, '@')) {
                return;
        }
@@ -839,7 +839,7 @@ static void pres_event_handler(switch_event_t *event)
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated");
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound");
                                switch_event_fire(&event);
-                       }               
+                       }
                }
        } else {
                switch_console_callback_match_t *matches = NULL;
@@ -858,18 +858,18 @@ static void pres_event_handler(switch_event_t *event)
                                switch_console_push_match(&matches, nvar);
                        }
                }
-               switch_mutex_unlock(globals.mutex);             
-               
+               switch_mutex_unlock(globals.mutex);
+
                if (matches) {
                        valet_token_t *token;
-                       
+
                        for (m = matches->head; !found && m; m = m->next) {
                                lot = valet_find_lot(m->val, SWITCH_FALSE);
                                switch_mutex_lock(lot->mutex);
 
                                if ((token = (valet_token_t *) switch_core_hash_find(lot->hash, lot_name)) && !token->timeout) {
                                        found++;
-                                       
+
                                        if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", VALET_PROTO);
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", lot_name);
index e1932cc0d15be1da1abc991d9465efabe6e7c7a2..b5f6f9a6006dd57092cca5c5aeb2ce2fa57229ce 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2008, Eric des Courtis <eric.des.courtis@benbria.com>
  *
@@ -18,7 +18,7 @@
  * Copyright (C) Benbria. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Eric des Courtis <eric.des.courtis@benbria.com>
  *
  * Special thanks to the following companies for their help:
@@ -35,7 +35,7 @@
  * mod_vmd.c -- Voicemail Detection Module
  *
  * This module detects voicemail beeps at any frequency in O(1) time.
- * 
+ *
  */
 
 #include <switch.h>
 
 /*! \brief Conversion of frequency to Hz
  *
- * \f$F = \frac{f}{{2}{\pi}}\f$ 
+ * \f$F = \frac{f}{{2}{\pi}}\f$
  */
 #define TO_HZ(f) ((F * f) / (2.0 * M_PI))
 
 /* Number of points in discreet energy separation. */
 #define P (5)
 
-/* Maximum signed value of int16_t 
+/* Maximum signed value of int16_t
  * DEPRECATED */
 #define ADJUST (32768)
-/* Same as above times two 
+/* Same as above times two
  * DEPRECATED */
 #define ADJUST_MAX (65536)
 
@@ -179,7 +179,7 @@ static double median(double *m, int n);
 #define PRINT2(a, b) do{ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, a, b); }while(0)
 */
 
-/*! \brief The callback function that is called when new audio data becomes available 
+/*! \brief The callback function that is called when new audio data becomes available
  *
  * @author Eric des Courtis
  * @param bug A reference to the media bug.
@@ -217,7 +217,7 @@ static switch_bool_t vmd_callback(switch_media_bug_t *bug, void *user_data, swit
        return SWITCH_TRUE;
 }
 
-/*! \brief Process and convert data to be used by the find_beep() function 
+/*! \brief Process and convert data to be used by the find_beep() function
  *
  * @author Eric des Courtis
  * @param vmd_info The session information associated with the call.
@@ -247,17 +247,17 @@ static switch_bool_t process_data(vmd_session_info_t *vmd_info, switch_frame_t *
        if (vmd_info->data != NULL) free(vmd_info->data);
        vmd_info->data = (int16_t *)malloc(len);
        if (vmd_info->data == NULL) return SWITCH_FALSE;
-    } 
+    }
 
     (void)memcpy(vmd_info->data, data, len);
     for(i = 2; i < frame->samples; i++){
-       vmd_info->data[i] = 
-           0.0947997 * data[i] 
-           - 
-           0.0947997 * data[i - 2] 
-           - 
-           1.4083405 * vmd_info->data[i - 1] 
-           + 
+       vmd_info->data[i] =
+           0.0947997 * data[i]
+           -
+           0.0947997 * data[i - 2]
+           -
+           1.4083405 * vmd_info->data[i - 1]
+           +
            0.8104005 * vmd_info->data[i - 2];
     }
 */
@@ -274,7 +274,7 @@ static switch_bool_t process_data(vmd_session_info_t *vmd_info, switch_frame_t *
        return SWITCH_TRUE;
 }
 
-/*! \brief Find voicemail beep in the audio stream 
+/*! \brief Find voicemail beep in the audio stream
  *
  * @author Eric des Courtis
  * @param vmd_info The session information associated with the call.
@@ -373,7 +373,7 @@ static void find_beep(vmd_session_info_t *vmd_info, switch_frame_t *frame)
        }
 }
 
-/*! \brief Find the median of an array of doubles 
+/*! \brief Find the median of an array of doubles
  *
  * @param m Array of frequency samples.
  * @param n Number of samples in the array.
@@ -442,7 +442,7 @@ static double median(double *m, int n)
        return mingtguess;
 }
 
-/*! \brief Convert many points for Signed L16 to relative floating point 
+/*! \brief Convert many points for Signed L16 to relative floating point
  *
  * @author Eric des Courtis
  * @param i_pts Array of P 16 bit integer audio samples.
@@ -460,9 +460,9 @@ static void convert_pts(int16_t *i_pts, double *d_pts, int16_t max)
 }
 
 /*! \brief Amplitude estimator for DESA-2
- *  
+ *
  *  The function is defined as \f$A = \sqrt{\frac{\psi{(x)}}{\sin{\Omega^2}}}\f$
- *  
+ *
  *  @author Eric des Courtis
  *  @param x An array of 5 evenly spaced audio samples \f$x_0, x_1, x_2, x_3, x_4\f$.
  *  @return The estimated amplitude.
@@ -477,11 +477,11 @@ double ampl_estimator(double *x)
        return sqrt(PSI(x) / sin(freq_sq));
 }
 
-/*! \brief The DESA-2 algorithm 
+/*! \brief The DESA-2 algorithm
  *
- *  The function is defined as \f$f = \frac{1}{2}\arccos{\frac{{{x^2_2} - 
- *  {x_0}{x_4}} - {{x^2_1} - 
- *  {x_0}{x_2}} - {{x^2_3} - 
+ *  The function is defined as \f$f = \frac{1}{2}\arccos{\frac{{{x^2_2} -
+ *  {x_0}{x_4}} - {{x^2_1} -
+ *  {x_0}{x_2}} - {{x^2_3} -
  *  {x_2}{x_4}}}
  *  {{2}({x^2_2} - {x_1}{x_3})}}\f$
  *
@@ -499,7 +499,7 @@ double freq_estimator(double *x)
                );
 }
 
-/*! \brief FreeSWITCH module loading function 
+/*! \brief FreeSWITCH module loading function
  *
  * @author Eric des Courtis
  * @return Load success or failure.
@@ -644,7 +644,7 @@ SWITCH_STANDARD_API(vmd_api_main)
        /* Separate the arguments */
        argc = switch_separate_string(ccmd, ' ', argv, VMD_PARAMS);
 
-       /* If we don't have the expected number of parameters 
+       /* If we don't have the expected number of parameters
         * display usage */
        if (argc != VMD_PARAMS) {
                stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
@@ -710,7 +710,7 @@ SWITCH_STANDARD_API(vmd_api_main)
                vmd_info->points[i].ampl = 0.0;
        }
 
-       /* Add a media bug that allows me to intercept the 
+       /* Add a media bug that allows me to intercept the
         * reading leg of the audio stream */
        status = switch_core_media_bug_add(vmd_session, "vmd", NULL, vmd_callback, vmd_info, 0, SMBF_READ_REPLACE, &bug);
 
index 9e5e67ffa343916973be84c95445398adc3fb6a3..eac0b3821222c23c366679e15cd28bda13034ab5 100644 (file)
@@ -71,4 +71,4 @@
       <!--<param name="record-copyright" value="Your Copyright"/>-->
     </profile>
   </profiles>
-</configuration> 
+</configuration>
index 27089ada4f842b3a8c6196f08b3c38eb9deaa3ab..6e14ca509508cf35c976ed924e425df4b59c41ac 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * John Wehle (john@feith.com)
@@ -211,7 +211,7 @@ switch_cache_db_handle_t *vm_get_db_handle(vm_profile_t *profile)
 
        switch_cache_db_handle_t *dbh = NULL;
        char *dsn;
-       
+
        if (!zstr(profile->odbc_dsn)) {
                dsn = profile->odbc_dsn;
        } else {
@@ -221,7 +221,7 @@ switch_cache_db_handle_t *vm_get_db_handle(vm_profile_t *profile)
        if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) {
                dbh = NULL;
        }
-       
+
        return dbh;
 }
 
@@ -537,7 +537,7 @@ static switch_status_t vm_config_validate_samplerate(switch_xml_config_item_t *i
 }
 
 /*!
- * \brief Sets the profile's configuration instructions 
+ * \brief Sets the profile's configuration instructions
  */
 vm_profile_t *profile_set_config(vm_profile_t *profile)
 {
@@ -546,7 +546,7 @@ vm_profile_t *profile_set_config(vm_profile_t *profile)
        profile->config_str_pool.pool = profile->pool;
 
        /*
-          SWITCH _CONFIG_SET_ITEM(item, "key", type, flags, 
+          SWITCH _CONFIG_SET_ITEM(item, "key", type, flags,
           pointer, default, options, help_syntax, help_description)
         */
 
@@ -689,7 +689,7 @@ vm_profile_t *profile_set_config(vm_profile_t *profile)
                                                   &profile->db_password_override, SWITCH_FALSE, NULL, NULL, NULL);
        SWITCH_CONFIG_SET_ITEM(profile->config[i++], "allow-empty-password-auth", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE,
                                                   &profile->allow_empty_password_auth, SWITCH_TRUE, NULL, NULL, NULL);
-       SWITCH_CONFIG_SET_ITEM(profile->config[i++], "auto-playback-recordings", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &profile->auto_playback_recordings, SWITCH_FALSE, NULL, NULL, NULL); 
+       SWITCH_CONFIG_SET_ITEM(profile->config[i++], "auto-playback-recordings", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &profile->auto_playback_recordings, SWITCH_FALSE, NULL, NULL, NULL);
        SWITCH_CONFIG_SET_ITEM(profile->config[i++], "send-full-vm-header", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &profile->send_full_vm_header, SWITCH_FALSE, NULL, NULL, NULL);
 
        switch_assert(i < VM_PROFILE_CONFIGITEM_COUNT);
@@ -917,7 +917,7 @@ static switch_status_t control_playback(switch_core_session_t *session, void *in
 
                        if (!cc->noexit
                                && (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key
-                                       || dtmf->digit == *cc->profile->prev_msg_key || dtmf->digit == *cc->profile->next_msg_key 
+                                       || dtmf->digit == *cc->profile->prev_msg_key || dtmf->digit == *cc->profile->next_msg_key
                                        || dtmf->digit == *cc->profile->repeat_msg_key
                                        || dtmf->digit == *cc->profile->terminator_key || dtmf->digit == *cc->profile->skip_info_key
                                        || dtmf->digit == *cc->profile->forward_key)) {
@@ -1601,16 +1601,16 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
                msg.string_arg = cid_buf;
                msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending display update [%s] to %s\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending display update [%s] to %s\n",
                                                  cid_buf, switch_channel_get_name(channel));
                switch_core_session_receive_message(session, &msg);
-               
+
                if (!zstr(cbt->cid_number) && (switch_true(switch_channel_get_variable(channel, "vm_announce_cid")))) {
                        TRY_CODE(switch_ivr_phrase_macro(session, VM_SAY_PHONE_NUMBER_MACRO, cbt->cid_number, NULL, NULL));
                }
-               
+
                args.input_callback = cancel_on_dtmf;
-               
+
                switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s:%s%s%s", profile->repeat_msg_key, profile->save_file_key,
                                                profile->delete_file_key, profile->email_key, profile->callback_key,
                                                profile->forward_key, cbt->email ? ":" : "", cbt->email ? cbt->email : "");
@@ -1726,7 +1726,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
                                        TRY_CODE(switch_ivr_read
                                                         (session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key, 0));
 
-                                       cmd = switch_core_session_sprintf(session, "%s@%s@%s %s %s '%s'", vm_cc, cbt->domain, profile->name, 
+                                       cmd = switch_core_session_sprintf(session, "%s@%s@%s %s %s '%s'", vm_cc, cbt->domain, profile->name,
                                                                                                          new_file_path, cbt->cid_number, cbt->cid_name);
 
                                        switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
@@ -1734,9 +1734,9 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
 
                                        status = switch_xml_locate_user_merged("id:number-alias", vm_cc, cbt->domain, NULL, &x_user, my_params);
                                        switch_event_destroy(&my_params);
-                               
+
                                        if (status != SWITCH_STATUS_SUCCESS) {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                                                                                  "Failed to forward message - Cannot locate user %s@%s\n", vm_cc, cbt->domain);
                                                TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL));
                                                continue;
@@ -1914,7 +1914,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
 static void update_mwi(vm_profile_t *profile, const char *id, const char *domain_name, const char *myfolder, mwi_reason_t reason)
 {
        const char *yn = "no";
-       const char *update_reason = mwi_reason2str(reason); 
+       const char *update_reason = mwi_reason2str(reason);
        int total_new_messages = 0;
        int total_saved_messages = 0;
        int total_new_urgent_messages = 0;
@@ -2043,7 +2043,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
                                if (vm_auto_play && !switch_true(vm_auto_play)) {
                                        auto_play = 0;
                                }
-                               
+
                                folder_args.input_callback = cancel_on_dtmf;
                                folder_args.buf = &global_buf;
                                folder_args.buflen = sizeof(global_buf);
@@ -2084,7 +2084,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
                                                continue;
                                        }
                                }
-                               
+
                                if (auto_play && !heard_auto_new && total_new_messages + total_new_urgent_messages > 0) {
                                        heard_auto_new = 1;
                                        play_msg_type = MSG_NEW;
@@ -2158,7 +2158,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
                                        } else if (cbt.move == VM_MOVE_SAME) {
                                                cur_message -= 1;
                                        }
-                                       
+
                                        if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
                                                break;
                                        }
@@ -2280,7 +2280,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
 
                                                TRY_CODE(create_file(session, profile, VM_RECORD_GREETING_MACRO, file_path, &message_len, SWITCH_TRUE, NULL, NULL));
                                                switch_file_rename(tmp_file_path, file_path, switch_core_session_get_pool(session));
-                                               
+
                                                sql =
                                                        switch_mprintf("update voicemail_prefs set greeting_path='%q' where username='%q' and domain='%q'", file_path, myid,
                                                                                   domain_name);
@@ -2311,7 +2311,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
                                                fail = 0;
                                                switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", VM_ENTER_PASS_MACRO, profile->terminator_key);
                                                TRY_CODE(switch_ivr_read(session, 0, 255, macro, NULL, buf, sizeof(buf), 10000, profile->terminator_key, 0));
-                                       
+
 
                                                switch_event_create_subclass(&params, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT);
                                                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Action", "change-password");
@@ -2319,23 +2319,23 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
                                                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-User", myid);
                                                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Domain", domain_name);
                                                switch_channel_event_set_data(channel, params);
-                                               
+
                                                if (zstr(buf) && !profile->allow_empty_password_auth) {
                                                        fail = 1;
                                                }
                                                if (switch_xml_locate_user("id", myid, domain_name, switch_channel_get_variable(channel, "network_addr"),
                                                                                                   &xx_domain_root, &xx_domain, &xx_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
                                                        switch_xml_t x_result;
-                                                       
+
                                                        if ((x_result = switch_xml_child(xx_user, "result"))) {
                                                                if (!switch_true(switch_xml_attr_soft(x_result, "success"))) {
                                                                        fail = 1;
                                                                }
                                                        }
-                                                       
+
                                                        switch_xml_free(xx_domain_root);
                                                }
-                                               
+
                                                if (fail) {
                                                        /* add feedback for user - let him/her know that the password they tried to change to is not allowed */
                                                        switch_ivr_phrase_macro(session, VM_CHANGE_PASS_FAIL_MACRO, NULL, NULL, NULL);
@@ -2718,9 +2718,9 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
                                                                  const char *read_flags,
                                                                  switch_event_t *params,
                                                                  switch_memory_pool_t *pool,
-                                                                 const char *caller_id_name, 
-                                                                 const char *caller_id_number, 
-                                                                 const char *forwarded_by, 
+                                                                 const char *caller_id_name,
+                                                                 const char *caller_id_number,
+                                                                 const char *forwarded_by,
                                                                  switch_bool_t copy, const char *use_uuid, switch_core_session_t *session)
 {
        char *file_path = NULL, *dir_path = NULL;
@@ -2964,7 +2964,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_account", myid);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_domain", domain_name);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_caller_id_number", caller_id_number);
-               switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_formatted_caller_id_number", formatted_cid_num);         
+               switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_formatted_caller_id_number", formatted_cid_num);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_caller_id_name", caller_id_name);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_file_path", file_path);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_read_flags", read_flags);
@@ -3055,7 +3055,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
                        if (zstr(vm_notify_email)) {
                                vm_notify_email = vm_email;
                        }
-       
+
                        if (zstr(profile->notify_email_headers)) {
                                headers = switch_mprintf("From: FreeSWITCH mod_voicemail <%s@%s>\n"
                                                                                 "Subject: Voicemail from %s %s\nX-Priority: %d", myid, domain_name, caller_id_name, caller_id_number, priority);
@@ -3172,7 +3172,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
        char *forwarded_by = NULL;
        char *read_flags = NORMAL_FLAG_STRING;
        char *dup_domain = NULL;
-       
+
        if (zstr(data)) {
                status = SWITCH_STATUS_FALSE;
                goto end;
@@ -3302,8 +3302,8 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
 
                                                        switch_xml_merge_user(ut, x_domain, group);
                                                        switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
-                                                       status = deliver_vm(profile, ut, domain, path, 0, read_flags, 
-                                                                                               my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, 
+                                                       status = deliver_vm(profile, ut, domain, path, 0, read_flags,
+                                                                                               my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE,
                                                                                                session ? switch_core_session_get_uuid(session) : NULL, session);
                                                        switch_event_destroy(&my_params);
                                                }
@@ -3326,7 +3326,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
 
                                                        switch_xml_merge_user(ut, x_domain, group);
                                                        switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
-                                                       status = deliver_vm(profile, ut, domain, path, 0, read_flags, 
+                                                       status = deliver_vm(profile, ut, domain, path, 0, read_flags,
                                                                                                my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE,
                                                                                                session ? switch_core_session_get_uuid(session) : NULL, session);
                                                        switch_event_destroy(&my_params);
@@ -3341,7 +3341,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
                        if ((status = switch_xml_locate_user_in_domain(user, x_domain, &ut, &x_group)) == SWITCH_STATUS_SUCCESS) {
                                switch_xml_merge_user(ut, x_domain, x_group);
                                switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
-                               status = deliver_vm(profile, ut, domain, path, 0, read_flags, 
+                               status = deliver_vm(profile, ut, domain, path, 0, read_flags,
                                                                        my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE,
                                                                        session ? switch_core_session_get_uuid(session) : NULL, session);
                                switch_event_destroy(&my_params);
@@ -3370,7 +3370,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
        char sql[256];
        prefs_callback_t cbt;
        switch_uuid_t tmp_uuid;
-       char tmp_uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; 
+       char tmp_uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
        char *file_path = NULL;
        char *dir_path = NULL;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -3582,7 +3582,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
                                int argc;
                                char *argv[4];
                                char *mycmd;
-                               
+
                                if ((!zstr(operator_ext) && (mycmd = switch_core_session_strdup(session, operator_ext))) ||
                                    (!zstr(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext)))) {
                                        argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -4026,7 +4026,7 @@ static void actual_message_query_handler(switch_event_t *event)
                        if ((profile = (vm_profile_t *) switch_core_hash_find(globals.profile_hash, domain))) {
                                parse_profile();
                        } else {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
                                                                  "Cound not find a profile for domain: [%s] Returning 0 messages\nWhen message-query-exact-match is enabled you must have a dedicated vm profile per distinct domain name you wish to use.\n", domain);
                        }
                } else {
@@ -4358,7 +4358,7 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
        holder->stream->write_function(holder->stream, "<font face=tahoma><div class=title><b>Message from %s %s</b></div><hr noshade size=1>\n",
                                                                   argv[5], argv[6]);
        holder->stream->write_function(holder->stream, "Priority: %s<br>\n" "Created: %s<br>\n" "Last Heard: %s<br>\n" "Duration: %s<br>\n",
-                                                                  //"<a href=%s>Delete This Message</a><br><hr noshade size=1>", 
+                                                                  //"<a href=%s>Delete This Message</a><br><hr noshade size=1>",
                                                                   strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", create_date, heard, duration_str);
 
        switch_snprintf(title_b4, sizeof(title_b4), "%s <%s> %s", argv[5], argv[6], rss_date);
@@ -4616,7 +4616,7 @@ static int api_del_callback(void *pArg, int argc, char **argv, char **columnName
 {
 
        unlink(argv[3]);
-       
+
     return 0;
 }
 
@@ -4635,7 +4635,7 @@ SWITCH_STANDARD_API(voicemail_delete_api_function)
        }
 
        id = strdup(cmd);
-       
+
        if (!id) {
                stream->write_function(stream, "Allocation Error\n");
                return SWITCH_STATUS_SUCCESS;
@@ -4658,16 +4658,16 @@ SWITCH_STANDARD_API(voicemail_delete_api_function)
 
 
        if (domain && profile_name && (profile = get_profile(profile_name))) {
-               
+
                if (uuid) {
                        sql = switch_mprintf("select username, domain, in_folder, file_path from voicemail_msgs where uuid='%q'", uuid);
                } else {
                        sql = switch_mprintf("select username, domain, in_folder, file_path from voicemail_msgs where username='%q' and domain='%q'", id, domain);
                }
-               
+
                vm_execute_sql_callback(profile, profile->mutex, sql, api_del_callback, profile);
                switch_safe_free(sql);
-               
+
                if (uuid) {
                        sql = switch_mprintf("delete from voicemail_msgs where uuid='%q'", uuid);
                } else {
@@ -4676,9 +4676,9 @@ SWITCH_STANDARD_API(voicemail_delete_api_function)
 
                vm_execute_sql(profile, sql, profile->mutex);
                switch_safe_free(sql);
-               
+
                update_mwi(profile, id, domain, "inbox", MWI_REASON_DELETE);
-       
+
                stream->write_function(stream, "%s", "+OK\n");
                profile_rwunlock(profile);
        } else {
@@ -4713,7 +4713,7 @@ SWITCH_STANDARD_API(voicemail_read_api_function)
                stream->write_function(stream, "Allocation failure\n");
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        if ((p = strchr(id, '@'))) {
                *p++ = '\0';
                domain = e = p;
@@ -4746,7 +4746,7 @@ SWITCH_STANDARD_API(voicemail_read_api_function)
 
 
        if (mread > -1 && domain && profile_name && (profile = get_profile(profile_name))) {
-               
+
                if (mread) {
                        if (uuid) {
                                sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where uuid='%q'", (long) switch_epoch_time_now(NULL), uuid);
@@ -4763,9 +4763,9 @@ SWITCH_STANDARD_API(voicemail_read_api_function)
 
                vm_execute_sql(profile, sql, profile->mutex);
                switch_safe_free(sql);
-               
+
                update_mwi(profile, id, domain, "inbox", MWI_REASON_READ);
-       
+
                stream->write_function(stream, "%s", "+OK\n");
 
                profile_rwunlock(profile);
@@ -4800,7 +4800,7 @@ static int api_list_callback(void *pArg, int argc, char **argv, char **columnNam
        } else {
                stream->write_function(stream, "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n", argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9]);
        }
-       
+
     return 0;
 }
 
@@ -4819,7 +4819,7 @@ SWITCH_STANDARD_API(voicemail_list_api_function)
        }
 
        id = strdup(cmd);
-       
+
        if (!id) {
                stream->write_function(stream, "Allocation Error\n");
                return SWITCH_STATUS_SUCCESS;
@@ -4848,11 +4848,11 @@ SWITCH_STANDARD_API(voicemail_list_api_function)
        if (domain && profile_name && (profile = get_profile(profile_name))) {
                if (uuid) {
                        sql = switch_mprintf("select created_epoch, read_epoch, username, domain, in_folder, file_path, uuid, cid_name, cid_number, message_len, "
-                                                                "'%q' from voicemail_msgs where username='%q' and domain='%q' and uuid='%q'", 
+                                                                "'%q' from voicemail_msgs where username='%q' and domain='%q' and uuid='%q'",
                                                                 format, id, domain, uuid);
                } else {
                        sql = switch_mprintf("select created_epoch, read_epoch, username, domain, in_folder, file_path, uuid, cid_name, cid_number, message_len, "
-                                                                "'%q' from voicemail_msgs where username='%q' and domain='%q'", 
+                                                                "'%q' from voicemail_msgs where username='%q' and domain='%q'",
                                                                 format, id, domain);
                }
 
@@ -4862,7 +4862,7 @@ SWITCH_STANDARD_API(voicemail_list_api_function)
 
                vm_execute_sql_callback(profile, profile->mutex, sql, api_list_callback, stream);
                switch_safe_free(sql);
-       
+
                if (!strcasecmp(format, "xml")) {
                        stream->write_function(stream, "</voicemail>\n");
                }
@@ -5234,10 +5234,10 @@ not implemented yet
 
        profile_rwunlock(profile);
 
-       /* TODO If no slot requested, returned currently selected and figure out the slot number from the file name. 
+       /* TODO If no slot requested, returned currently selected and figure out the slot number from the file name.
         * IF slot provided, check if file exist, check if it currently selected */
        if (zstr(res)) {
-               stream->write_function(stream, "-ERR No greeting found\n");     
+               stream->write_function(stream, "-ERR No greeting found\n");
        } else {
                switch_event_t *my_params = NULL;
                char *ebuf = NULL;
@@ -5682,7 +5682,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_undelete_function)
        sql = switch_mprintf("UPDATE voicemail_msgs SET flags='' WHERE username='%q' AND domain='%q' AND uuid = '%q'", id, domain, uuid);
        vm_execute_sql(profile, sql, profile->mutex);
        profile_rwunlock(profile);
-       
+
        stream->write_function(stream, "-OK\n");
 done:
        switch_core_destroy_memory_pool(&pool);
@@ -5754,10 +5754,10 @@ SWITCH_STANDARD_API(vm_fsdb_auth_login_function)
 
                        if (!strcasecmp(var, "vm-enabled")) {
                                vm_enabled = !switch_false(val);
-                       }                                       
+                       }
                        if (!strcasecmp(var, "vm-password")) {
                                user_xml_password = val;
-                       }  
+                       }
                }
 
                sql = switch_mprintf("SELECT password FROM voicemail_prefs WHERE username = '%q' AND domain = '%q'", id, domain);
@@ -5865,7 +5865,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_forward_function)
                                switch_uuid_format(tmp_uuid_str, &tmp_uuid);
 
                                new_file_path = switch_core_sprintf(pool, "%s%smsg_%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, tmp_uuid_str);
-                               
+
                                if (vm_merge_media_files(test, new_file_path) != SWITCH_STATUS_SUCCESS) {
                                        stream->write_function(stream, "-ERR Error Merging the file\n");
                                        switch_event_destroy(&cbt.my_params);
@@ -6099,7 +6099,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function)
                if (zstr(profile->email_headers)) {
                        headers = switch_core_sprintf(pool,
                                        "From: FreeSWITCH mod_voicemail <%s@%s>\nSubject: Voicemail from %s %s\nX-Priority: %d",
-                                       id, domain, switch_event_get_header(cbt.my_params, "VM-Message-Caller-Name"), 
+                                       id, domain, switch_event_get_header(cbt.my_params, "VM-Message-Caller-Name"),
                                        switch_event_get_header(cbt.my_params, "VM-Message-Caller-Number"), priority);
                } else {
                        headers = switch_event_expand_headers(cbt.my_params, profile->email_headers);
index 502578ee644691eee36507b978d267c5e5bf0df2..489232b7459c0d21a55f66bc12e52fb3c8c2748a 100644 (file)
                                <key dtmf="4" action="rerecord" variable="VM-Key-ReRecord-File" />
                                <key dtmf="#" action="skip_instruction" />
                        </keys>
-                       </menu>                 
+                       </menu>
 
                        <menu name="std_forward_ask_prepend">
                        <phrases>
index b2b7d401161e48fe8abd7a5f9be23b1418bd5f6c..504795f09926a6e56be013e3624ca6c3a5b0e840 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
@@ -60,7 +60,7 @@ void menu_init(vmivr_profile_t *profile, vmivr_menu_t *menu) {
                        switch_event_merge(menu_default, menu->event_settings);
                        switch_event_destroy(&menu->event_settings);
                }
-               
+
                switch_event_create(&menu->event_settings, SWITCH_EVENT_REQUEST_PARAMS);
                switch_event_merge(menu->event_settings, profile->event_settings);
                switch_event_merge(menu->event_settings, menu_default);
@@ -188,7 +188,7 @@ vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile
        if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile_name))) {
                if (!(profile = switch_core_session_alloc(session, sizeof(vmivr_profile_t)))) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
-                       goto end;       
+                       goto end;
                }
 
                profile->name = profile_name;
index 8eb124a48b056de367268d175b0f39b666e87588..bab57ba5b5356ddb9436929dc69e3ffa7ef5a374 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
index 5b7f97529b02315106b73e1e496951c234c75230..3ebcba849055e4579ab83cfd0844a20dda8513e7 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
@@ -51,7 +51,7 @@ static int match_dtmf(switch_core_session_t *session, ivre_data_t *loc) {
                        if (is_invalid[j])
                                continue;
 
-                       test[0] = loc->dtmf_stored[i];  
+                       test[0] = loc->dtmf_stored[i];
                        if (loc->dtmf_accepted[j][i] == 'N' && atoi(test) >= 2 && atoi(test) <= 9)
                                cMatch = SWITCH_TRUE;
                        if (loc->dtmf_accepted[j][i] == 'X' && atoi(test) >= 0 && atoi(test) <= 9) {
@@ -69,7 +69,7 @@ static int match_dtmf(switch_core_session_t *session, ivre_data_t *loc) {
 
                        if (i == strlen(loc->dtmf_accepted[j]) - 1 && loc->dtmf_accepted[j][strlen(loc->dtmf_accepted[j])-1] == '.') {
                                loc->completeMatch = loc->dtmf_accepted[j];
-                       } 
+                       }
                        if (i == loc->dtmf_received - 1 && loc->dtmf_received == strlen(loc->dtmf_accepted[j]) && loc->dtmf_accepted[j][strlen(loc->dtmf_accepted[j])-1] != '.') {
                                loc->completeMatch = loc->dtmf_accepted[j];
                                continue;
@@ -105,7 +105,7 @@ static switch_status_t cb_on_dtmf(switch_core_session_t *session, void *input, s
                case SWITCH_INPUT_TYPE_DTMF:
                        {
                                switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
-                               switch_bool_t audio_was_stopped = loc->audio_stopped;   
+                               switch_bool_t audio_was_stopped = loc->audio_stopped;
                                loc->audio_stopped = SWITCH_TRUE;
 
                                if (loc->dtmf_received >= sizeof(loc->dtmf_stored)) {
index cca9c246589813dab87848b14ddb6e78ab29f7fc..de7321a3ff24e4a7275c524e3ad1cca65ddc870b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
index 8906c756a924912a9e1144ff6a335e58d2ab56ac..a34c291f7412d0120e952ba1c25563e0e2822df3 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
@@ -110,7 +110,7 @@ void vmivr_menu_main(switch_core_session_t *session, vmivr_profile_t *profile) {
                        menu.ivre_d.result = RES_FOUND;
                        action = action_on_new_message;
                        action_on_new_message_occured = SWITCH_TRUE;
-                       
+
                } else {
                        ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, menu.ivr_entry_timeout);
                }
@@ -199,7 +199,7 @@ void vmivr_menu_navigator(switch_core_session_t *session, vmivr_profile_t *profi
                        goto done;
                }
        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "API message list return invalid result : %s(%s)\n", profile->api_msg_list, cmd); 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "API message list return invalid result : %s(%s)\n", profile->api_msg_list, cmd);
                goto done;
        }
 
@@ -227,7 +227,7 @@ void vmivr_menu_navigator(switch_core_session_t *session, vmivr_profile_t *profi
                if (msg_undeleted) {
                        msg_undeleted = SWITCH_FALSE;
                        ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "ack"), "undeleted", menu.phrase_params, NULL, 0);
-               } 
+               }
                if (msg_saved) {
                        msg_saved = SWITCH_FALSE;
                        ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "ack"), "saved", menu.phrase_params, NULL, 0);
@@ -309,14 +309,14 @@ action:
                                                vmivr_api_execute(session, profile->api_msg_delete, cmd);
 
                                                msg_deleted = SWITCH_TRUE;
-                                               
+
                                                if (action_on_delete) {
                                                        action = action_on_delete;
-                                                       goto action;    
+                                                       goto action;
                                                } else {
                                                        skip_header = skip_playback = SWITCH_TRUE;
                                                }
-                                       } else { 
+                                       } else {
                                                cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, switch_event_get_header(menu.phrase_params, "VM-Message-UUID"));
                                                vmivr_api_execute(session, profile->api_msg_undelete, cmd);
 
@@ -405,7 +405,7 @@ void vmivr_menu_forward(switch_core_session_t *session, vmivr_profile_t *profile
                                        forward_msg = SWITCH_FALSE;
                                } else if (!strcasecmp(action, "prepend")) { /* Prepend record msg */
                                        vmivr_menu_t sub_menu = { "std_record_message" };
-                                       
+
                                        const char *tmp_filepath = NULL;
                                        const char *record_format = NULL;
 
@@ -413,7 +413,7 @@ void vmivr_menu_forward(switch_core_session_t *session, vmivr_profile_t *profile
 
                                        /* Initialize Menu Configs */
                                        menu_init(profile, &sub_menu);
-                                       
+
                                        record_format = switch_event_get_header(sub_menu.event_settings, "Record-Format");
 
                                        tmp_filepath = generate_random_file_name(session, "voicemail_ivr", record_format);
@@ -787,7 +787,7 @@ switch_status_t vmivr_menu_record(switch_core_session_t *session, vmivr_profile_
                const char *rec_silence_threshold = switch_event_get_header(menu->event_settings, "Record-Silence-Threshold");
                const char *rec_silence_samplerate = switch_event_get_header(menu->event_settings, "Record-Sample-Rate");
                const char *rec_maximum_length = switch_event_get_header(menu->event_settings, "Record-Maximum-Length");
-               const char *rec_minimum_length = switch_event_get_header(menu->event_settings, "Record-Minimum-Length"); 
+               const char *rec_minimum_length = switch_event_get_header(menu->event_settings, "Record-Minimum-Length");
                switch_size_t record_length = 0;
 
                /* Prepare Recording File Handle */
index a299d31dc767e1f5d91564ce8c196449e055d826..0e0c3298894d9daca9b493654334d59eddc3eec3 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
index 006fde5fa8b9e6c35b1b28f638f940d87907d3b0..cafe24d2df13a3a5389413bd89d2e90b72094133 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
@@ -39,7 +39,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_voicemail_ivr_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_voicemail_ivr_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_voicemail_ivr_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_voicemail_ivr, mod_voicemail_ivr_load, mod_voicemail_ivr_shutdown, NULL);
@@ -54,7 +54,7 @@ SWITCH_STANDARD_APP(voicemail_ivr_function)
        const char *domain = NULL;
        const char *profile_name = NULL;
        vmivr_profile_t *profile = NULL;
-       char *argv[6] = { 0 }; 
+       char *argv[6] = { 0 };
        char *mydata = NULL;
 
        if (!zstr(data)) {
index 1f54f91e2b6f2c81bbf5d0a49f1100f62aa153f4..7ea72cbcaec1d1ac45d872b1d6a07df43534d993 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
index e497ec610168e9ef9db6e69a527d18a0a71e4cd0..92239a921164e511c4eacf81b11410f5e497d4e9 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Marc Olivier Chouinard <mochouinard@moctel.com>
  *
  *
index cf4aa92f4186005d7cb2478dcebf0fdc0322a424..cf431de70013f5ed0db9e6efc1777ade07a0a0c5 100644 (file)
@@ -1,12 +1,12 @@
-<configuration name="cepstral.conf" description="Cepstral TTS configuration">\r
-  <settings>\r
-    <!--\r
-        Possible encodings:\r
-        * utf-8\r
-        * us-ascii\r
-        * iso8859-1 (default)\r
-        * iso8859-15\r
-    -->\r
-    <param name="encoding" value="utf-8"/>\r
-  </settings>\r
+<configuration name="cepstral.conf" description="Cepstral TTS configuration">
+  <settings>
+    <!--
+        Possible encodings:
+        * utf-8
+        * us-ascii
+        * iso8859-1 (default)
+        * iso8859-15
+    -->
+    <param name="encoding" value="utf-8"/>
+  </settings>
 </configuration>
\ No newline at end of file
index c368c28b24529c323558dbfcc2b61561fece9407..b66581ca2bd4382760c5bb94911bffd08af3bb70 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
  * mod_cepstral.c -- Cepstral Interface
- * 
- * Contains some material derived from the Cepstral Swift SDK, by  
- * permission.  You are free to copy and modify the source under the  
- * terms of FreeSWITCH itself, without additional permission from  
+ *
+ * Contains some material derived from the Cepstral Swift SDK, by
+ * permission.  You are free to copy and modify the source under the
+ * terms of FreeSWITCH itself, without additional permission from
  * Cepstral
- * 
+ *
  *
  */
 #ifdef __ICC
index b21b86b8412848dabf9365971398d97388313a5e..2118825295c386e12dfac9565743069c27a81611 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Brian West <brian@freeswitch.org>
  * Raymond Chandler <intralanman@freeswitch.org>
  *
index 9264f0ec2203afa710a914708b7100e8b9a2e3eb..1d9906d0a935f3993e9e9bdb47d001ddd8d5db25 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2009, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  * mod_tts_commandline.c -- System command ASR TTS Interface
@@ -204,7 +204,7 @@ static void tts_commandline_speech_flush_tts(switch_speech_handle_t *sh)
 {
        tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
        assert(info != NULL);
-       
+
        if (info->fh != NULL && info->fh->file_interface != NULL) {
                switch_core_file_close(info->fh);
        }
index c1e89be89ff805290db9edc079751671cb1b9524..7909c077ba76c22f34af7a683626513a5acac663 100644 (file)
@@ -625,7 +625,7 @@ static switch_status_t audio_queue_create(audio_queue_t ** audio_queue, const ch
 
        lname = zstr(name) ? "" : switch_core_strdup(pool, name);
        lsession_uuid = zstr(session_uuid) ? NULL : switch_core_strdup(pool, session_uuid);
-       
+
        if (zstr(name)) {
                lname = "";
        } else {
@@ -4397,17 +4397,17 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CREATE);
                return SWITCH_STATUS_TERM;
        }
-       
+
        if (switch_event_reserve_subclass(MY_EVENT_PROFILE_CLOSE) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CLOSE);
                return SWITCH_STATUS_TERM;
        }
-       
+
        if (switch_event_reserve_subclass(MY_EVENT_PROFILE_OPEN) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_OPEN);
                return SWITCH_STATUS_TERM;
        }
-       
+
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -4468,7 +4468,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown)
        switch_event_free_subclass(MY_EVENT_PROFILE_CREATE);
        switch_event_free_subclass(MY_EVENT_PROFILE_CLOSE);
        switch_event_free_subclass(MY_EVENT_PROFILE_OPEN);
-       
+
        synth_shutdown();
        recog_shutdown();
 
index 6dc83762586040367adf33c2fd1a81a3cd18b1cb..0613ad17368a58b1e4cb7f6d65ef41ebf5c1e36f 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2016, Athonet (www.athonet.com)
  * Dragos Oancea  <dragos.oancea@athonet.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -42,13 +42,13 @@ extern const int switch_amr_frame_sizes[];
 /* Bandwidth Efficient AMR-NB */
 /* https://tools.ietf.org/html/rfc4867#page-17 */
 
-extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n) 
+extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n)
 {
        uint8_t save_toc, ft;
 
        save_toc = shift_buf[1];
 
-       /* we must convert OA TOC -> BE TOC */ 
+       /* we must convert OA TOC -> BE TOC */
        /* OA TOC
        0 1 2 3 4 5 6 7
        +-+-+-+-+-+-+-+-+
@@ -68,8 +68,8 @@ extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n)
         +-+-+-+-+-+-+
        |F|  FT   |Q|
        +-+-+-+-+-+-+
-       F = 0 , FT = XXXX , Q = 1 
-       eg: Frame Types (FT): ftp://www.3gpp.org/tsg_sa/TSG_SA/TSGS_04/Docs/PDF/SP-99253.pdf - table 1a 
+       F = 0 , FT = XXXX , Q = 1
+       eg: Frame Types (FT): ftp://www.3gpp.org/tsg_sa/TSG_SA/TSGS_04/Docs/PDF/SP-99253.pdf - table 1a
        */
 
        ft = save_toc >> 3 ; /* drop Q, P1, P2  */
@@ -86,19 +86,19 @@ extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n)
                shift_buf[1] |= 1 << 7;
        } else {
                /* reset last bit of TOC instead of P2 */
-               shift_buf[1] &= ~(1 << 7);  
+               shift_buf[1] &= ~(1 << 7);
        }
 
        return SWITCH_TRUE;
 }
 
-extern switch_bool_t switch_amr_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len) 
+extern switch_bool_t switch_amr_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len)
 {
        int framesz, index, ft;
        uint8_t shift_tocs[2] = {0x00, 0x00};
        uint8_t *shift_buf;
 
-       memcpy(shift_tocs, encoded_buf, 2); 
+       memcpy(shift_tocs, encoded_buf, 2);
        /* shift for BE */
        switch_amr_array_lshift(4, shift_tocs, 2);
        ft = shift_tocs[0] >> 3;
@@ -117,7 +117,7 @@ extern switch_bool_t switch_amr_unpack_be(unsigned char *encoded_buf, uint8_t *t
 
        return SWITCH_TRUE;
 }
-#endif 
+#endif
 
 /* For Emacs:
  * Local Variables:
index c870018814375fa6134ce442e360a3d1049bc93e..7d49b6b8b651bb32cbf4c3a8efd4ed8acc8ffe60 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2016, Athonet (www.athonet.com)
  * Dragos Oancea  <dragos.oancea@athonet.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 #define __AMR_BE_H__
 
 /* Bandwidth Efficient AMR */
-extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n); 
+extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n);
 extern switch_bool_t switch_amr_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len);
 
-#endif 
+#endif
 
 /* For Emacs:
  * Local Variables:
index 825433cd9f05804d2824cbc0a8b18d28047cd0f3..fd3fc55606fe98f9b412a68e3faaf991b3a0b96e 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2016, Athonet (www.athonet.com)
  * Paolo Missiaggia  <paolo.missiaggia@athonet.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -61,7 +61,7 @@ extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len)
        buf[i] = ((buf[i] & first_byte) << lshift);
        return (0);
 }
-#endif 
+#endif
 
 /* For Emacs:
  * Local Variables:
index f448ecf652ed03c1cd6b6bd046c68064bd4c04f1..5adc4b53f9bdfa447364520cf6efa8de6877924a 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2016, Athonet (www.athonet.com)
  * Paolo Missiaggia  <paolo.missiaggia@athonet.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -42,7 +42,7 @@
  */
 extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len);
 
-#endif 
+#endif
 
 /* For Emacs:
  * Local Variables:
index c111d8d04d68ab2aadd20d812dccb3dfa4fe4cd5..5f18feab7cf5310c6adc93c0e778e5c5078a3f93 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Brian K. West <brian@freeswitch.org>
  * Dragos Oancea <dragos.oancea@athonet.com>
@@ -48,9 +48,9 @@ SWITCH_MODULE_DEFINITION(mod_amr, mod_amr_load, NULL, NULL);
 #include "amr_be.h"
 /*
  * Check section 8.1 of rfc3267 for possible sdp options.
- *  
- * SDP Example 
- * 
+ *
+ * SDP Example
+ *
  * a=fmtp:97 mode-set=0,2,5,7; mode-change-period=2; mode-change-neighbor=1
  *
  *                                 Class A   total speech
@@ -176,7 +176,7 @@ static switch_bool_t switch_amr_pack_oa(unsigned char *shift_buf, int n)
        return SWITCH_TRUE;
 }
 
-static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) 
+static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text)
 {
        uint8_t *tocs;
        int framesz, index, not_last_frame, q, ft;
@@ -185,30 +185,30 @@ static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_dat
        if (!encoded_buf) {
                return SWITCH_FALSE;
        }
-       
+
        /* payload format can be OA (octed-aligned) or BE (bandwidth efficient)*/
        if (payload_format) {
                /* OA */
                encoded_buf++; /* CMR skip */
-               tocs = encoded_buf; 
+               tocs = encoded_buf;
                index = (tocs[0] >> 3) & 0x0f;
                if (index > SWITCH_AMR_MODES) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMR decoder (OA): Invalid Table Of Contents (TOC): 0x%x\n", index);
                        return SWITCH_FALSE;
                }
                framesz = switch_amr_frame_sizes[index];
-               not_last_frame = (tocs[0] >> 7) & 1; 
-               q = (tocs[0] >> 2) & 1; 
+               not_last_frame = (tocs[0] >> 7) & 1;
+               q = (tocs[0] >> 2) & 1;
                ft = tocs[0] >> 3 ;
                ft &= ~(1 << 5); /* Frame Type*/
 
        } else {
                /* BE */
-               memcpy(shift_tocs, encoded_buf, 2); 
+               memcpy(shift_tocs, encoded_buf, 2);
                /* shift for BE */
                switch_amr_array_lshift(4, shift_tocs, 2);
-               not_last_frame = (shift_tocs[0] >> 7) & 1; 
-               q = (shift_tocs[0] >> 2) & 1; 
+               not_last_frame = (shift_tocs[0] >> 7) & 1;
+               q = (shift_tocs[0] >> 2) & 1;
                ft = shift_tocs[0] >> 3 ;
                ft &= ~(1 << 5); /* Frame Type */
                index = (shift_tocs[0] >> 3) & 0x0f;
@@ -219,9 +219,9 @@ static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_dat
                framesz = switch_amr_frame_sizes[index];
        }
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n",
                                                                                                        print_text, payload_format ? "OA":"BE", ft, q, not_last_frame);
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMR encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMR encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n",
                                                                                                        print_text, payload_format ? "OA":"BE", framesz, encoded_data_len);
 
        return SWITCH_TRUE;
@@ -257,8 +257,8 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
                memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp));
                codec_fmtp.private_info = &amr_codec_settings;
 
-               /* "mode" may mean two different things: 
-                * "Octed Aligned" or "Bandwidth Efficient" encoding mode , 
+               /* "mode" may mean two different things:
+                * "Octed Aligned" or "Bandwidth Efficient" encoding mode ,
                 * or the actual bitrate which is set with FMTP param "mode-set". */
                /* https://tools.ietf.org/html/rfc4867 */
 
@@ -266,7 +266,7 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
                /* bitrate = value read from config file or default mode 7 */
                context->enc_mode = globals.default_bitrate;
 
-               /* set octet-align = 0 - it must be 0 by default when there is no "octet-align" param in FMTP, per RFC : 
+               /* set octet-align = 0 - it must be 0 by default when there is no "octet-align" param in FMTP, per RFC :
                 *
                 *     "octet-align: Permissible values are 0 and 1.  If 1, octet-aligned
                 *     operation SHALL be used.  If 0 or if not present,
@@ -288,7 +288,7 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
                                        if (!strcasecmp(data, "octet-align")) {
                                                if (atoi(arg)) {
                                                        switch_set_flag(context, AMR_OPT_OCTET_ALIGN);
-                                               } 
+                                               }
                                        } else if (!strcasecmp(data, "mode-change-neighbor")) {
                                                if (atoi(arg)) {
                                                        switch_set_flag(context, AMR_OPT_MODE_CHANGE_NEIGHBOR);
@@ -346,7 +346,7 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
                                                        context->enc_mode);
                } else {
                        /* some UEs reject the call with 488 if mode-change-capability is not 2 */
-                       switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d; max-red=0; mode-change-capability=2", 
+                       switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d; max-red=0; mode-change-capability=2",
                                                        switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
                }
                codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
@@ -412,14 +412,14 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec,
                return SWITCH_STATUS_FALSE;
        }
 
-       /* set CMR + TOC (F + 3 bits of FT) , 1111 = CMR: No mode request */ 
-       *(switch_byte_t *) encoded_data = 0xf0;  
+       /* set CMR + TOC (F + 3 bits of FT) , 1111 = CMR: No mode request */
+       *(switch_byte_t *) encoded_data = 0xf0;
        *encoded_data_len  = n;
 
        if (switch_test_flag(context, AMR_OPT_OCTET_ALIGN)) {
-               /* this function does nothing for now - the payload is already OA 
+               /* this function does nothing for now - the payload is already OA
                as it comes out of the encoding function */
-               switch_amr_pack_oa(shift_buf, n);  
+               switch_amr_pack_oa(shift_buf, n);
                *encoded_data_len = n + 1;
        } else {
                switch_amr_pack_be(shift_buf, n);
@@ -427,7 +427,7 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec,
                /* mode 1 = 103 speech bits -> 104 bytes - 1 padding bit */
                /* mode 5 = 159 speech bits -> 160 bytes - 1 padding bit */
                if ((context->enc_mode == 5 ) || (context->enc_mode == 1) || (context->enc_mode == 0)) {
-                       /* modes 0,1 and 5 have only 1 padding bit and due to shifting 
+                       /* modes 0,1 and 5 have only 1 padding bit and due to shifting
                         * we may have an extra 0 byte at the end of the voice payload (bit stuffing) */
                        if (shift_buf[n-1] != 0x0) {
                                *encoded_data_len  = n + 1;
@@ -456,7 +456,7 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec,
 #else
        struct amr_context *context = codec->private_info;
        unsigned char *buf = encoded_data;
-       uint8_t tmp[SWITCH_AMR_OUT_MAX_SIZE]; 
+       uint8_t tmp[SWITCH_AMR_OUT_MAX_SIZE];
 
        if (!context) {
                return SWITCH_STATUS_FALSE;
@@ -466,12 +466,12 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec,
                switch_amr_info(buf, encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR decoder");
        }
 
-       if (switch_test_flag(context, AMR_OPT_OCTET_ALIGN)) { 
+       if (switch_test_flag(context, AMR_OPT_OCTET_ALIGN)) {
                /* Octed Aligned */
                if (!switch_amr_unpack_oa(buf, tmp, encoded_data_len)) {
                        return SWITCH_STATUS_FALSE;
                }
-       } else { 
+       } else {
                /* Bandwidth Efficient */
                if (!switch_amr_unpack_be(buf, tmp, encoded_data_len)) {
                        return SWITCH_STATUS_FALSE;
@@ -514,32 +514,32 @@ static switch_status_t switch_amr_control(switch_codec_t *codec,
                        if (!strcasecmp(cmd, "increase")) {
                                if (context->enc_mode < SWITCH_AMR_MODES - 1) {
                                        int mode_step = 2; /*this is the mode, not the actual bitrate*/
-                                       context->enc_mode = context->enc_mode + mode_step; 
+                                       context->enc_mode = context->enc_mode + mode_step;
                                        if (globals.debug || context->debug) {
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                                                "AMR encoder: Adjusting mode to %d (increase)\n", context->enc_mode);
                                        }
-                               } 
+                               }
                        } else if (!strcasecmp(cmd, "decrease")) {
                                if (context->enc_mode > 0) {
                                        int mode_step = 2; /*this is the mode, not the actual bitrate*/
-                                       context->enc_mode = context->enc_mode - mode_step; 
+                                       context->enc_mode = context->enc_mode - mode_step;
                                        if (globals.debug || context->debug) {
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                                                "AMR encoder: Adjusting mode to %d (decrease)\n", context->enc_mode);
                                        }
                                }
                        } else if (!strcasecmp(cmd, "default")) {
                                        context->enc_mode = globals.default_bitrate;
                                        if (globals.debug || context->debug) {
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                                                "AMR encoder: Adjusting mode to %d (default)\n", context->enc_mode);
                                        }
                        } else {
                                /*minimum bitrate (AMR mode)*/
                                context->enc_mode = 0;
                                if (globals.debug || context->debug) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                                        "AMR encoder: Adjusting mode to %d (minimum)\n", context->enc_mode);
                                }
                        }
@@ -547,14 +547,14 @@ static switch_status_t switch_amr_control(switch_codec_t *codec,
                break;
        default:
                break;
-       } 
-       
+       }
+
        return SWITCH_STATUS_SUCCESS;
 #endif
 }
 
 static char *generate_fmtp(switch_memory_pool_t *pool , int octet_align)
-{ 
+{
        char buf[256] = { 0 };
 
        snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "octet-align=%d; ", octet_align);
@@ -567,7 +567,7 @@ static char *generate_fmtp(switch_memory_pool_t *pool , int octet_align)
                snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "max-red=0; mode-change-capability=2; ");
        }
 
-#endif 
+#endif
        if (end_of(buf) == ' ') {
                *(end_of_p(buf) - 1) = '\0';
        }
@@ -591,11 +591,11 @@ SWITCH_STANDARD_API(mod_amr_debug)
                                stream->write_function(stream, "AMR Debug: off\n");
                        } else {
                                stream->write_function(stream, "-USAGE: %s\n", AMRWB_DEBUG_SYNTAX);
-                       }       
+                       }
                }
        return SWITCH_STATUS_SUCCESS;
 }
-#endif 
+#endif
 
 /* Registration */
 SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load)
@@ -640,7 +640,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load)
 
        switch_console_set_complete("add amr_debug on");
        switch_console_set_complete("add amr_debug off");
-#endif 
+#endif
 
        SWITCH_ADD_CODEC(codec_interface, "AMR / Octet Aligned");
 
@@ -657,9 +657,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load)
                                                                                 320,   /* number of bytes per frame decompressed */
 #ifndef AMR_PASSTHROUGH
                                                                                 SWITCH_AMR_OUT_MAX_SIZE,       /* number of bytes per frame compressed */
-#else 
+#else
                                                                                 0,     /* number of bytes per frame compressed */
-#endif 
+#endif
                                                                                 1,     /* number of channels represented */
                                                                                 1,     /* number of frames per network packet */
                                                                                 switch_amr_init,       /* function to initialize a codec handle using this implementation */
@@ -682,9 +682,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load)
                                                                                 320,   /* number of bytes per frame decompressed */
 #ifndef AMR_PASSTHROUGH
                                                                                 SWITCH_AMR_OUT_MAX_SIZE,       /* number of bytes per frame compressed */
-#else 
+#else
                                                                                 0,     /* number of bytes per frame compressed */
-#endif 
+#endif
                                                                                 1,     /* number of channels represented */
                                                                                 1,     /* number of frames per network packet */
                                                                                 switch_amr_init,       /* function to initialize a codec handle using this implementation */
index 12489d8256912b9edba9752a77d2b634a517ec29..c668ac94cbe2689472bdd32671e21e5669e3e186 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2016, Athonet (www.athonet.com)
  * Dragos Oancea  <dragos.oancea@athonet.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -43,13 +43,13 @@ extern const int switch_amrwb_frame_sizes[];
 /* https://tools.ietf.org/html/rfc4867#page-17 */
 
 /* this works the same as in AMR NB*/
-extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n) 
+extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n)
 {
        uint8_t save_toc, ft;
 
        save_toc = shift_buf[1];
 
-       /* we must convert OA TOC -> BE TOC */ 
+       /* we must convert OA TOC -> BE TOC */
        /* OA TOC
        0 1 2 3 4 5 6 7
        +-+-+-+-+-+-+-+-+
@@ -69,8 +69,8 @@ extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n)
         +-+-+-+-+-+-+
        |F|  FT   |Q|
        +-+-+-+-+-+-+
-       F = 0 , FT = XXXX , Q = 1 
-       eg: Frame Types (FT): ftp://www.3gpp.org/tsg_sa/TSG_SA/TSGS_04/Docs/PDF/SP-99253.pdf - table 1a 
+       F = 0 , FT = XXXX , Q = 1
+       eg: Frame Types (FT): ftp://www.3gpp.org/tsg_sa/TSG_SA/TSGS_04/Docs/PDF/SP-99253.pdf - table 1a
        */
 
        ft = save_toc >> 3 ; /* drop Q, P1, P2  */
@@ -87,19 +87,19 @@ extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n)
                shift_buf[1] |= 1 << 7;
        } else {
                /* reset last bit of TOC instead of P2 */
-               shift_buf[1] &= ~(1 << 7);  
+               shift_buf[1] &= ~(1 << 7);
        }
 
        return SWITCH_TRUE;
 }
 
-extern switch_bool_t switch_amrwb_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len) 
+extern switch_bool_t switch_amrwb_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len)
 {
        int framesz, index, ft;
        uint8_t shift_tocs[2] = {0x00, 0x00};
        uint8_t *shift_buf;
 
-       memcpy(shift_tocs, encoded_buf, 2); 
+       memcpy(shift_tocs, encoded_buf, 2);
        /* shift for BE */
        switch_amr_array_lshift(4, shift_tocs, 2);
        ft = shift_tocs[0] >> 3;
@@ -118,7 +118,7 @@ extern switch_bool_t switch_amrwb_unpack_be(unsigned char *encoded_buf, uint8_t
 
        return SWITCH_TRUE;
 }
-#endif 
+#endif
 
 /* For Emacs:
  * Local Variables:
index 6a871b4f0cdbd4d3925d44d4974b19f5a4bf916a..f01f7b63834f0148a8c3433dbf4dae5b730abfd9 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2016, Athonet (www.athonet.com)
  * Dragos Oancea  <dragos.oancea@athonet.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 #define __AMRWB_BE_H__
 
 /* Bandwidth Efficient AMR-WB */
-extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n); 
+extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n);
 extern switch_bool_t switch_amrwb_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len);
 
-#endif 
+#endif
 
 /* For Emacs:
  * Local Variables:
index 825433cd9f05804d2824cbc0a8b18d28047cd0f3..fd3fc55606fe98f9b412a68e3faaf991b3a0b96e 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2016, Athonet (www.athonet.com)
  * Paolo Missiaggia  <paolo.missiaggia@athonet.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -61,7 +61,7 @@ extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len)
        buf[i] = ((buf[i] & first_byte) << lshift);
        return (0);
 }
-#endif 
+#endif
 
 /* For Emacs:
  * Local Variables:
index f448ecf652ed03c1cd6b6bd046c68064bd4c04f1..5adc4b53f9bdfa447364520cf6efa8de6877924a 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2016, Athonet (www.athonet.com)
  * Paolo Missiaggia  <paolo.missiaggia@athonet.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -42,7 +42,7 @@
  */
 extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len);
 
-#endif 
+#endif
 
 /* For Emacs:
  * Local Variables:
index 60cf95442818d00a761dbc54afa06c64a02960e3..19cde02adf71a2ec418acbeb605829a7f4e3ff5c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Brian K. West <brian@freeswitch.org>
  * Dragos Oancea <dragos.oancea@athonet.com>
@@ -117,7 +117,7 @@ static switch_bool_t switch_amrwb_unpack_oa(unsigned char *buf, uint8_t *tmp, in
        }
        tmp[0] = tocs[0];
        memcpy(&tmp[1], buf, framesz);
-       
+
        return SWITCH_TRUE;
 }
 
@@ -127,7 +127,7 @@ static switch_bool_t switch_amrwb_pack_oa(unsigned char *shift_buf, int n)
        return SWITCH_TRUE;
 }
 
-static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) 
+static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text)
 {
        uint8_t *tocs;
        int framesz, index, not_last_frame, q, ft;
@@ -136,29 +136,29 @@ static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_d
        if (!encoded_buf) {
                return SWITCH_FALSE;
        }
-       
+
        /* payload format can be OA (octed-aligned) or BE (bandwidth efficient)*/
        if (payload_format) {
                /* OA */
                encoded_buf++; /* CMR skip */
-               tocs = encoded_buf; 
+               tocs = encoded_buf;
                index = (tocs[0] >> 3) & 0x0f;
                if (index > SWITCH_AMRWB_MODES) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMRWB decoder (OA): Invalid TOC 0x%x\n", index);
                        return SWITCH_FALSE;
                }
                framesz = switch_amrwb_frame_sizes[index];
-               not_last_frame = (tocs[0] >> 7) & 1; 
-               q = (tocs[0] >> 2) & 1; 
+               not_last_frame = (tocs[0] >> 7) & 1;
+               q = (tocs[0] >> 2) & 1;
                ft = tocs[0] >> 3;
                ft &= ~(1 << 5); /* Frame Type */
        } else {
                /* BE */
-               memcpy(shift_tocs, encoded_buf, 2); 
+               memcpy(shift_tocs, encoded_buf, 2);
                /* shift for BE */
                switch_amr_array_lshift(4, shift_tocs, 2);
-               not_last_frame = (shift_tocs[0] >> 7) & 1; 
-               q = (shift_tocs[0] >> 2) & 1; 
+               not_last_frame = (shift_tocs[0] >> 7) & 1;
+               q = (shift_tocs[0] >> 2) & 1;
                ft = shift_tocs[0] >> 3;
                ft &= ~(1 << 5); /* Frame Type */
                index = (shift_tocs[0] >> 3) & 0x0f;
@@ -169,13 +169,13 @@ static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_d
                framesz = switch_amrwb_frame_sizes[index];
        }
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n",
                                                                                                        print_text, payload_format ? "OA":"BE", ft, q, not_last_frame);
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMRWB encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMRWB encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n",
                                                                                                        print_text, payload_format ? "OA":"BE", framesz, encoded_data_len);
 
        return SWITCH_TRUE;
-} 
+}
 #endif
 
 static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
@@ -200,8 +200,8 @@ static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_fla
                return SWITCH_STATUS_FALSE;
        } else {
 
-               /* "mode" may mean two different things: 
-                * "Octed Aligned" or "Bandwidth Efficient" encoding mode , 
+               /* "mode" may mean two different things:
+                * "Octed Aligned" or "Bandwidth Efficient" encoding mode ,
                 * or the actual bitrate  which is set with FMTP param "mode-set". */
                /* https://tools.ietf.org/html/rfc4867 */
 
@@ -279,10 +279,10 @@ static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_fla
                }
 
                if (!globals.volte) {
-                       switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", 
+                       switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d",
                                        switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
                } else {
-                       switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d; max-red=0; mode-change-capability=2", 
+                       switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d; max-red=0; mode-change-capability=2",
                                        switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
                }
                codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
@@ -346,12 +346,12 @@ static switch_status_t switch_amrwb_encode(switch_codec_t *codec,
                return SWITCH_STATUS_FALSE;
        }
 
-       /* set CMR + TOC (F + 3 bits of FT), 1111 = CMR: No mode request */ 
+       /* set CMR + TOC (F + 3 bits of FT), 1111 = CMR: No mode request */
        *(switch_byte_t *) encoded_data = 0xf0;
        *encoded_data_len  = n;
 
        if (switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN)) {
-               switch_amrwb_pack_oa(shift_buf, n);  /* the payload is OA as it 
+               switch_amrwb_pack_oa(shift_buf, n);  /* the payload is OA as it
                                                                                                comes out of the encoding function */
                *encoded_data_len = n + 1;
        } else {
@@ -380,7 +380,7 @@ static switch_status_t switch_amrwb_decode(switch_codec_t *codec,
 #else
        struct amrwb_context *context = codec->private_info;
        unsigned char *buf = encoded_data;
-       uint8_t tmp[SWITCH_AMRWB_OUT_MAX_SIZE]; 
+       uint8_t tmp[SWITCH_AMRWB_OUT_MAX_SIZE];
 
        if (!context) {
                return SWITCH_STATUS_FALSE;
@@ -390,12 +390,12 @@ static switch_status_t switch_amrwb_decode(switch_codec_t *codec,
                switch_amrwb_info(buf, encoded_data_len, switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, "AMRWB decoder");
        }
 
-       if (switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN)) { 
+       if (switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN)) {
                /* Octed Aligned */
                if (!switch_amrwb_unpack_oa(buf, tmp, encoded_data_len)) {
                        return SWITCH_STATUS_FALSE;
                }
-       } else { 
+       } else {
                /* Bandwidth Efficient */
                if (!switch_amrwb_unpack_be(buf, tmp, encoded_data_len)) {
                        return SWITCH_STATUS_FALSE;
@@ -436,32 +436,32 @@ static switch_status_t switch_amrwb_control(switch_codec_t *codec,
                        if (!strcasecmp(cmd, "increase")) {
                                if (context->enc_mode < SWITCH_AMRWB_MODES - 1) {
                                        int mode_step = 2; /*this is the mode, not the actual bitrate*/
-                                       context->enc_mode = context->enc_mode + mode_step; 
+                                       context->enc_mode = context->enc_mode + mode_step;
                                        if (globals.debug || context->debug) {
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                                                "AMRWB encoder: Adjusting mode to %d (increase)\n", context->enc_mode);
                                        }
-                               } 
+                               }
                        } else if (!strcasecmp(cmd, "decrease")) {
                                if (context->enc_mode > 0) {
                                        int mode_step = 2; /*this is the mode, not the actual bitrate*/
-                                       context->enc_mode = context->enc_mode - mode_step; 
+                                       context->enc_mode = context->enc_mode - mode_step;
                                        if (globals.debug || context->debug) {
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                                                "AMRWB encoder: Adjusting mode to %d (decrease)\n", context->enc_mode);
                                        }
                                }
                        } else if (!strcasecmp(cmd, "default")) {
                                        context->enc_mode = globals.default_bitrate;
                                        if (globals.debug || context->debug) {
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                                                "AMRWB encoder: Adjusting mode to %d (default)\n", context->enc_mode);
                                        }
                        } else {
                                /*minimum bitrate (AMRWB mode)*/
                                context->enc_mode = 0;
                                if (globals.debug || context->debug) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
                                                        "AMRWB encoder: Adjusting mode to %d (minimum)\n", context->enc_mode);
                                }
                        }
@@ -469,14 +469,14 @@ static switch_status_t switch_amrwb_control(switch_codec_t *codec,
                break;
        default:
                break;
-       } 
-       
+       }
+
        return SWITCH_STATUS_SUCCESS;
 }
-#endif 
+#endif
 
 static char *generate_fmtp(switch_memory_pool_t *pool , int octet_align)
-{ 
+{
        char buf[256] = { 0 };
 
        snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "octet-align=%d; ", octet_align);
@@ -563,31 +563,31 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amrwb_load)
        switch_console_set_complete("add amrwb_debug off");
 #else
 #define SWITCH_AMRWB_OUT_MAX_SIZE 0
-#endif 
+#endif
 
        SWITCH_ADD_CODEC(codec_interface, "AMR-WB / Octet Aligned");
 
        default_fmtp_oa = generate_fmtp(pool, 1);
 
        switch_core_codec_add_implementation(pool, codec_interface,
-                                                                                SWITCH_CODEC_TYPE_AUDIO, 100, "AMR-WB", default_fmtp_oa, 
+                                                                                SWITCH_CODEC_TYPE_AUDIO, 100, "AMR-WB", default_fmtp_oa,
                                                                                 16000, 16000, 23850, 20000, 320, 640, SWITCH_AMRWB_OUT_MAX_SIZE, 1, 1,
                                                                                 switch_amrwb_init, switch_amrwb_encode, switch_amrwb_decode, switch_amrwb_destroy);
 #ifndef AMRWB_PASSTHROUGH
        codec_interface->implementations->codec_control = switch_amrwb_control;
-#endif 
+#endif
 
        SWITCH_ADD_CODEC(codec_interface, "AMR-WB / Bandwidth Efficient");
 
        default_fmtp_be = generate_fmtp(pool, 0);
 
        switch_core_codec_add_implementation(pool, codec_interface,
-                                                                                SWITCH_CODEC_TYPE_AUDIO, 110, "AMR-WB", default_fmtp_be,  
-                                                                                16000, 16000, 23850, 20000, 320, 640, SWITCH_AMRWB_OUT_MAX_SIZE, 1, 1, 
+                                                                                SWITCH_CODEC_TYPE_AUDIO, 110, "AMR-WB", default_fmtp_be,
+                                                                                16000, 16000, 23850, 20000, 320, 640, SWITCH_AMRWB_OUT_MAX_SIZE, 1, 1,
                                                                                 switch_amrwb_init, switch_amrwb_encode, switch_amrwb_decode, switch_amrwb_destroy);
 #ifndef AMRWB_PASSTHROUGH
        codec_interface->implementations->codec_control = switch_amrwb_control;
-#endif 
+#endif
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
index a7180260afc4a629f35f9fea20c90b7904a52c9e..8f2b0350551b32685aa5786893e2cc31501fd0a2 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Brian K. West <brian@freeswitch.org>
  *
  * mod_b64.c -- The B64 ultra-low delay audio codec (http://www.b64-codec.org/)
@@ -53,7 +53,7 @@ static int rot(char *p, char min, char max, int i)
 {
        int r = 0;
        int c;
-       
+
        if (*p >= min && *p <= max) {
                if ((c = *p + i) <= max) {
                        *p = c;
@@ -119,7 +119,7 @@ static switch_status_t switch_codec_b64_decode(switch_codec_t *codec,
        p += HLEN;
        encoded_data = p;
        encoded_data_len -= HLEN;
-       
+
        rot13_buffer(encoded_data, encoded_data_len);
        switch_b64_decode(encoded_data, decoded_data, *decoded_data_len);
        *decoded_data_len = codec->implementation->decoded_bytes_per_packet;
@@ -160,14 +160,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_b64_load)
                                                                                         switch_codec_b64_encode,       /* function to encode raw data into encoded data */
                                                                                         switch_codec_b64_decode,       /* function to decode encoded data into raw data */
                                                                                         switch_codec_b64_destroy);     /* deinitalize a codec handle using this implementation */
-               
+
                bytes *= 2;
                samples *= 2;
                rate *= 2;
                bits *= 2;
-               
+
        }
-       
+
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
index 352e17185987e3c9810ad95dce6b2ca0e52dfa7f..be79ddbd5e46f4ce9abfc267ba77d036a08e4c82 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Brian K. West <brian@freeswitch.org>
  *
  * mod_bv.c -- BroadVoice16 and BroadVoice32 audio codecs (http://www.broadcom.com/support/broadvoice/)
index 998fb3c3e4f529352d442172023f7b6bc59814fd..9edd4641970a27f5359144a40a62a02cd0243062 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -32,8 +32,8 @@
 #include <switch.h>
 #include <codec2.h>
 
-/* Uncomment to log input/output data for debugging 
-#define LOG_DATA 
+/* Uncomment to log input/output data for debugging
+#define LOG_DATA
 #define CODEC2_DEBUG
 */
 
@@ -42,7 +42,7 @@
 #ifdef CODEC2_DEBUG
 #define codec2_assert(_x) switch_assert(_x)
 #else
-#define codec2_assert(_x) 
+#define codec2_assert(_x)
 #endif
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_codec2_load);
@@ -56,7 +56,7 @@ struct codec2_context {
        int nbit; /* nr of bits per frame */
        int nbyte; /* nr of bytes per frame */
        int nsam; /* nr of samples per frame */
-#ifdef LOG_DATA        
+#ifdef LOG_DATA
        FILE *encoder_in;
        FILE *encoder_out;
        FILE *encoder_out_unpacked;
@@ -107,13 +107,13 @@ static switch_status_t switch_codec2_init(switch_codec_t *codec, switch_codec_fl
        } else {
                /* 3200 might be better for VOIP, but forcing 2400 for backwards compatibility  */
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mode not supported, forcing CODEC2_MODE_2400. You can try mode 3200 too!\n");
-               context->mode = CODEC2_MODE_2400; 
+               context->mode = CODEC2_MODE_2400;
        }
-       
+
        if (encoding) {
                context->encoder = codec2_create(context->mode);
        }
-       
+
        if (decoding) {
                context->decoder = codec2_create(context->mode);
        }
@@ -126,32 +126,32 @@ static switch_status_t switch_codec2_init(switch_codec_t *codec, switch_codec_fl
        context->nbyte = (context->nbit + 7) / 8;
 
        codec->private_info = context;
-       
-#ifdef LOG_DATA                
+
+#ifdef LOG_DATA
        {
-               
+
                int c = c2_count++;
                char buf[1024];
-               
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Logging as /tmp/c2-%d-*\n", c);
-               
+
                if (encoding) {
                        snprintf(buf, sizeof(buf), "/tmp/c2-%d-enc-in", c);
                        context->encoder_in = fopen(buf, "w");
-               
+
                        snprintf(buf, sizeof(buf), "/tmp/c2-%d-enc-out", c);
                        context->encoder_out = fopen(buf, "w");
-               
+
                        snprintf(buf, sizeof(buf), "/tmp/c2-%d-enc-out-unpacked", c);
                        context->encoder_out_unpacked = fopen(buf, "w");
                }
                if (decoding) {
                        snprintf(buf, sizeof(buf), "/tmp/c2-%d-dec-in", c);
                        context->decoder_in = fopen(buf, "w");
-               
+
                        snprintf(buf, sizeof(buf), "/tmp/c2-%d-dec-out", c);
                        context->decoder_out = fopen(buf, "w");
-               
+
                        snprintf(buf, sizeof(buf), "/tmp/c2-%d-dec-out-unpacked", c);
                        context->decoder_in_unpacked = fopen(buf, "w");
                }
@@ -171,23 +171,23 @@ static switch_status_t switch_codec2_encode(switch_codec_t *codec, switch_codec_
                                                                                  unsigned int *flag)
 {
        struct codec2_context *context = codec->private_info;
-       
+
        codec2_assert(decoded_data_len == context->nsam * 2);
-       
-#ifdef LOG_DATA        
+
+#ifdef LOG_DATA
        fwrite(decoded_data, decoded_data_len, 1, context->encoder_in);
        fflush(context->encoder_in);
 #endif
 
        codec2_encode(context->encoder, encoded_data, decoded_data);
-       
-#ifdef LOG_DATA        
+
+#ifdef LOG_DATA
        fwrite(encode_buf, sizeof(encode_buf), 1, context->encoder_out_unpacked);
        fflush(context->encoder_out_unpacked);
        fwrite(encoded_data, context->nbyte, 1, context->encoder_out);
        fflush(context->encoder_out);
 #endif
-       
+
        *encoded_data_len = context->nbyte;
 
        return SWITCH_STATUS_SUCCESS;
@@ -204,32 +204,32 @@ static switch_status_t switch_codec2_decode(switch_codec_t *codec,
                                                                                  unsigned int *flag)
 {
        struct codec2_context *context = codec->private_info;
-       
+
        codec2_assert(encoded_data_len == 8);
-       
-#ifdef LOG_DATA        
+
+#ifdef LOG_DATA
        fwrite(encoded_data, encoded_data_len, 1, context->decoder_in);
        fflush(context->decoder_in);
        fwrite(bits, sizeof(bits), 1, context->decoder_in_unpacked);
        fflush(context->decoder_in_unpacked);
 #endif
-       
+
        codec2_decode(context->decoder, decoded_data, encoded_data);
 
-#ifdef LOG_DATA        
+#ifdef LOG_DATA
        fwrite(decoded_data, context->nsam, 2, context->decoder_out);
        fflush(context->decoder_out);
 #endif
 
        *decoded_data_len = context->nsam * 2; /* eg: 160 samples for 3200,2400 */
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t switch_codec2_destroy(switch_codec_t *codec)
 {
        struct codec2_context *context = codec->private_info;
-       
+
        codec2_destroy(context->encoder);
        codec2_destroy(context->decoder);
 
@@ -266,7 +266,7 @@ static switch_status_t codec2_load_config(switch_bool_t reload) {
        switch_xml_t cfg, xml = NULL, param, settings;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-       codec2_prefs.mode = 2400 ; 
+       codec2_prefs.mode = 2400 ;
 
        if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Opening of %s failed\n", cf);
@@ -283,7 +283,7 @@ static switch_status_t codec2_load_config(switch_bool_t reload) {
                        }
                }
        }
-       
+
        if (xml) {
                switch_xml_free(xml);
        }
@@ -301,14 +301,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_codec2_load)
        }
 
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       
+
        /*there is no API call to retrieve ptime per mode, so hardcoding here*/
        if ((codec2_prefs.mode == 3200) ||(codec2_prefs.mode == 2400)) {
                codec2_prefs.ptime = 20000;
-               codec2_prefs.samples_per_frame = CODEC2_SAMPLES_PER_FRAME;  
+               codec2_prefs.samples_per_frame = CODEC2_SAMPLES_PER_FRAME;
        } else {
                codec2_prefs.ptime = 40000;
-               codec2_prefs.samples_per_frame = CODEC2_SAMPLES_PER_FRAME * 2;  
+               codec2_prefs.samples_per_frame = CODEC2_SAMPLES_PER_FRAME * 2;
        }
 
        SWITCH_ADD_CODEC(codec_interface, "CODEC2 3200/2400/1400/1200bps");
index 5927d16ae76d3672e8637f55b4fe4d22a74ab5ae..df09429ced4bab33461a2445957c911d6e3d42c1 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -41,7 +41,7 @@
 
 /*
  * some rules to keep in mind for G729 (the frame size may be different for G723)
- * we cannot write more than SFRAME_SIZE (320) - sizeof(struct rtp_packet) which 
+ * we cannot write more than SFRAME_SIZE (320) - sizeof(struct rtp_packet) which
  * seems to be 266 bytes
  * if we write less than 160 bytes (1 ulaw frame which is 20 bytes of G729 bytes, a read will block forever)
  * TODO: do buffering ourselves to provide just the fixed amount of samples that the card expects
@@ -60,7 +60,7 @@ static uint32_t total_encoders_usage = 0;
 static uint32_t total_decoders = 0;
 static uint32_t total_decoders_usage = 0;
 
-/* 
+/*
    Zaptel/DAHDI definitions to not require the headers installed
    Zaptel and DAHDI are binary compatible (at least in the transcoder interface)
  */
@@ -122,7 +122,7 @@ static int32_t switch_dahdi_get_transcoder(struct dahdi_transcoder_formats *fmts
                if (fcntl(fd, F_SETFL, fdflags)) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not set non-block mode in %s transcoder FD: %s\n",
                                                          transcoder_name, strerror(errno));
-                       /* should we abort? this may cause channels to hangup when overruning the device 
+                       /* should we abort? this may cause channels to hangup when overruning the device
                         * see jira dahdi codec issue MODCODEC-8 (Hung Calls and Codec DAHDI G.729A 8.0k decoder error!)
                         * */
                }
@@ -216,7 +216,7 @@ static switch_status_t switch_dahdi_init(switch_codec_t *codec, switch_codec_fla
        context->encoding_fd = -1;
        context->decoding_fd = -1;
 
-       /* ulaw requires 8 times more storage than g729 and 12 times more than G723, right? 
+       /* ulaw requires 8 times more storage than g729 and 12 times more than G723, right?
         * this can be used to calculate the target buffer when encoding and decoding
         * */
        context->codec_r = (codec->implementation->ianacode == CODEC_G729_IANA_CODE)
index 4e565a129a838d1abbb23c724a07b63939f5ad07..76d62e5d3a69153ef860d354edd8d89c738443f4 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Brian K. West <brian@freeswitch.org>
  *
index 2dfb1275b019a312299199ae410c9ce1971a03e0..abd6c6330c9864e18dd6bf71033bb5eb81788cab 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  *
index b3ef2e55d3411510f646ddbb45a55e3d8e0fec9b..4d82322936d2de564cbdb18543c738f07b4864d3 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index f472cc46b0f41beb7339f12b5503e871e73e9a80..14d67d372e51e2fe2b1ae57ea7b84f713dee195c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Brian K. West <brian@freeswitch.org>
  *
  * mod_ilbc.c -- ilbc Codec Module
index 85912efbc80ad69ba23b6869d0e066e4d89d7ec6..c84ace38c593371ba74392ddfb9b35e76a2ecf97 100644 (file)
@@ -522,7 +522,7 @@ WebRtc_Word16 WebRtcIsac_UpdateUplinkBwImpl(
   {
     if(index > 11)
     {
-      index -= 12;   
+      index -= 12;
       /* compute the jitter estimate as decoded on the other side */
       bwest_str->send_max_delay_avg = 0.9f * bwest_str->send_max_delay_avg +
           0.1f * (float)MAX_ISAC_MD;
index 1e8503c245cee733b36b5cfae83048a50d5efdd4..fa09636f7b6abc2a0ca5531aaa9419b2b75106de 100644 (file)
@@ -251,7 +251,7 @@ int WebRtcSpl_ComplexFFT(WebRtc_Word16 frfi[], int stages, int mode)
                         "r"(wri), "r"(frfi_r), "r"(CFFTRND));
                     __asm__("smladx %0, %1, %2, %3" : "=r"(ti32) :
                         "r"(wri), "r"(frfi_r), "r"(CFFTRND));
-    
+
 #else
                     tr32 = WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j])
                             - WEBRTC_SPL_MUL_16_16(wi, frfi[2 * j + 1]) + CFFTRND;
index 726a74967beacc2f7d9363e561eb58b8396c1271..936ae6877fd1d2ae0abcbece8a54ff3136ac140b 100644 (file)
@@ -163,7 +163,7 @@ void WebRtcSpl_CrossCorrelation(WebRtc_Word32* cross_correlation, WebRtc_Word16*
         seq2Ptr = seq2 + (step_seq2 * i);
         (*CrossCorrPtr) = 0;
 
-#ifndef _ARM_OPT_ 
+#ifndef _ARM_OPT_
 #ifdef _WIN32
 #pragma message("NOTE: default implementation is used")
 #endif
index 75cd726507d22394996bf3dae4a100f010933a53..66b80244a8f0c506bdc6f47fe264b43055d62a26 100644 (file)
@@ -933,7 +933,7 @@ WebRtcIsac_EncodeUb12(
 
   WebRtcIsac_GetLpcGain(s2nr, percepFilterParams, SUBFRAMES, lpcGains,
                        corr, varscale);
-  
+
   /* Store the state of arithmetic coder before coding LPC gains */
   transcodingParam.W_upper = ISACencUB_obj->bitstr_obj.W_upper;
 
index e7f1a76af2eb84fea7de1124207bda1c7f648cb3..84c7ec0d2692075a713d71d1c52acd690de110a2 100644 (file)
@@ -151,7 +151,7 @@ WebRtc_Word16 WebRtcIsac_CorrelateInterVec(
  * WebRtcIsac_AddLarMean()
  *
  * This is the inverse of WebRtcIsac_RemoveLarMean()
- * 
+ *
  * Input:
  *      -data               : pointer to mean-removed LAR:s.
  *      -bandwidth          : indicates if the given LAR vectors belong
@@ -220,7 +220,7 @@ WebRtc_Word16 WebRtcIsac_DecorrelateLPGain(
  * WebRtcIsac_QuantizeLpcGain()
  *
  * Quantize the decorrelated log-domain gains.
- * 
+ *
  * Input:
  *      -lpcGain            : uncorrelated LPC gains.
  *
index c8247983aa5ace4f927aa9e555a7717db7fc7ef0..4164d3b59b17eabec54d8708b3e007770ae5bccc 100644 (file)
@@ -212,7 +212,7 @@ int  WebRtcIsac_Fftns(unsigned int ndim, const int dims[],
     {
       max_factors = (int)nSpan;
     }
-    if ((int)nSpan > max_perm) 
+    if ((int)nSpan > max_perm)
     {
       max_perm = (int)nSpan;
     }
index 0685878811caa5d8b057893f7e9e5955ffc65936..5746e62aa7ffb59d84ca5b9bca430d0ff073599f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -59,7 +59,7 @@ static switch_status_t switch_isac_init(switch_codec_t *codec, switch_codec_flag
        codec->private_info = context;
 
        err = WebRtcIsac_Create(&context->ISAC_main_inst);
-       
+
        if (err < 0) return SWITCH_STATUS_FALSE;
 
 
@@ -95,9 +95,9 @@ static switch_status_t switch_isac_init(switch_codec_t *codec, switch_codec_flag
                        return SWITCH_STATUS_FALSE;
                }
        }
-       
 
-       
+
+
        if (WebRtcIsac_SetMaxRate(context->ISAC_main_inst, codec->implementation->bits_per_second) < 0) {
                return SWITCH_STATUS_FALSE;
        }
@@ -126,13 +126,13 @@ static switch_status_t switch_isac_encode(switch_codec_t *codec, switch_codec_t
                len = WebRtcIsac_Encode(context->ISAC_main_inst, in, out);
                in += rise;
        }
-       
+
        if (len < 0) {
                return SWITCH_STATUS_GENERR;
        }
 
        *encoded_data_len = (uint32_t) len;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -159,9 +159,9 @@ static switch_status_t switch_isac_decode(switch_codec_t *codec,
                *decoded_data_len = 0;
                return SWITCH_STATUS_GENERR;
        }
-       
+
        *decoded_data_len = (uint32_t) len * 2;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -170,7 +170,7 @@ static switch_status_t switch_isac_destroy(switch_codec_t *codec)
        struct isac_context *context = codec->private_info;
 
        WebRtcIsac_Free(context->ISAC_main_inst);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -183,90 +183,90 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_isac_codec_load)
 
        SWITCH_ADD_CODEC(codec_interface, "isac");      /* 8.0kbit */
 
-       switch_core_codec_add_implementation(pool, codec_interface,     
+       switch_core_codec_add_implementation(pool, codec_interface,
                                                                                 SWITCH_CODEC_TYPE_AUDIO,
-                                                                                99,    
+                                                                                99,
                                                                                 "isac",
-                                                                                "ibitrate=32000;maxbitrate=53400",     
-                                                                                16000, 
-                                                                                16000, 
-                                                                                53400, 
-                                                                                30000, 
-                                                                                480,   
-                                                                                960,   
-                                                                                0,     
-                                                                                1,     
-                                                                                3,     
-                                                                                switch_isac_init,      
+                                                                                "ibitrate=32000;maxbitrate=53400",
+                                                                                16000,
+                                                                                16000,
+                                                                                53400,
+                                                                                30000,
+                                                                                480,
+                                                                                960,
+                                                                                0,
+                                                                                1,
+                                                                                3,
+                                                                                switch_isac_init,
                                                                                 switch_isac_encode,
                                                                                 switch_isac_decode,
                                                                                 switch_isac_destroy);
 
 
 
-       switch_core_codec_add_implementation(pool, codec_interface,     
+       switch_core_codec_add_implementation(pool, codec_interface,
                                                                                 SWITCH_CODEC_TYPE_AUDIO,
-                                                                                99,    
+                                                                                99,
                                                                                 "isac",
-                                                                                "ibitrate=32000;maxbitrate=53400",     
-                                                                                16000, 
-                                                                                16000, 
-                                                                                53400, 
-                                                                                60000, 
-                                                                                960,   
-                                                                                1920,  
-                                                                                0,     
-                                                                                1,     
-                                                                                6,     
-                                                                                switch_isac_init,      
+                                                                                "ibitrate=32000;maxbitrate=53400",
+                                                                                16000,
+                                                                                16000,
+                                                                                53400,
+                                                                                60000,
+                                                                                960,
+                                                                                1920,
+                                                                                0,
+                                                                                1,
+                                                                                6,
+                                                                                switch_isac_init,
                                                                                 switch_isac_encode,
                                                                                 switch_isac_decode,
                                                                                 switch_isac_destroy);
 
-       
 
 
-       switch_core_codec_add_implementation(pool, codec_interface,     
+
+       switch_core_codec_add_implementation(pool, codec_interface,
                                                                                 SWITCH_CODEC_TYPE_AUDIO,
-                                                                                99,    
+                                                                                99,
                                                                                 "isac",
-                                                                                "ibitrate=32000;maxbitrate=160000",    
-                                                                                32000, 
-                                                                                32000, 
-                                                                                160000,        
-                                                                                30000, 
-                                                                                960,   
-                                                                                1920,  
-                                                                                0,     
-                                                                                1,     
-                                                                                6,     
-                                                                                switch_isac_init,      
+                                                                                "ibitrate=32000;maxbitrate=160000",
+                                                                                32000,
+                                                                                32000,
+                                                                                160000,
+                                                                                30000,
+                                                                                960,
+                                                                                1920,
+                                                                                0,
+                                                                                1,
+                                                                                6,
+                                                                                switch_isac_init,
                                                                                 switch_isac_encode,
                                                                                 switch_isac_decode,
                                                                                 switch_isac_destroy);
 
 
-       switch_core_codec_add_implementation(pool, codec_interface,     
+       switch_core_codec_add_implementation(pool, codec_interface,
                                                                                 SWITCH_CODEC_TYPE_AUDIO,
-                                                                                99,    
+                                                                                99,
                                                                                 "isac",
-                                                                                "ibitrate=32000;maxbitrate=160000",    
-                                                                                32000, 
-                                                                                32000, 
-                                                                                160000,        
-                                                                                60000, 
-                                                                                1920,  
-                                                                                3840,  
-                                                                                0,     
-                                                                                1,     
-                                                                                6,     
-                                                                                switch_isac_init,      
+                                                                                "ibitrate=32000;maxbitrate=160000",
+                                                                                32000,
+                                                                                32000,
+                                                                                160000,
+                                                                                60000,
+                                                                                1920,
+                                                                                3840,
+                                                                                0,
+                                                                                1,
+                                                                                6,
+                                                                                switch_isac_init,
                                                                                 switch_isac_encode,
                                                                                 switch_isac_decode,
                                                                                 switch_isac_destroy);
-       
 
-       
+
+
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
index e239db75c0a3cf0aec6d392b0f4c80e8259fcc2e..ead598d2c676414a0429acbbd6528978cf0bcf13 100644 (file)
@@ -40,7 +40,7 @@ static __inline WebRtc_Word32 MUL_ACCUM_1(WebRtc_Word32 tbl_value,
 // Return: Return: state + (((diff << 1) * tbl_value) >> 32)
 //
 // The reason to introduce this function is that, in case we can't use smlawb
-// instruction (in MUL_ACCUM_1) due to input value range, we can still use 
+// instruction (in MUL_ACCUM_1) due to input value range, we can still use
 // smmla to save some cycles.
 
 static __inline WebRtc_Word32 MUL_ACCUM_2(WebRtc_Word32 tbl_value,
index 651a68c8b4d8cdad73b8d3f6197c684a5b51da58..4433bc175ffea87419082678381118c73077fc37 100644 (file)
@@ -1652,7 +1652,7 @@ void WebRtcSpl_SynthesisQMF(const WebRtc_Word16* low_band,
 // WebRtc_Word16 WebRtcSpl_SatW32ToW16(...)
 //
 // This function saturates a 32-bit word into a 16-bit word.
-// 
+//
 // Input:
 //      - value32   : The value of a 32-bit word.
 //
@@ -1664,7 +1664,7 @@ void WebRtcSpl_SynthesisQMF(const WebRtc_Word16* low_band,
 //
 // This function multiply a 16-bit word by a 16-bit word, and accumulate this
 // value to a 32-bit integer.
-// 
+//
 // Input:
 //      - a    : The value of the first 16-bit word.
 //      - b    : The value of the second 16-bit word.
index 159245bd98bb6f04bcf8331c9ca9e5b112525222..b6ea85ba7715ceed3675ac934d6cc30501645c44 100644 (file)
@@ -11,7 +11,7 @@
 /*
  * spectrum_ar_model_tables.h
  *
- * This file contains definitions of tables with AR coefficients, 
+ * This file contains definitions of tables with AR coefficients,
  * Gain coefficients and cosine tables.
  *
  */
index cc77a3d4e89d22a38fec0ed6ef7461837728fc18..685e6756c7c90a204b736637d99538243a2e2fad 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index b497ed2386a42811b8ecfe36c48704c9c6181f8b..841e9efcd750c83b479d77f0631eb90b8728edc3 100644 (file)
@@ -82,7 +82,7 @@ typedef struct h264_codec_context_s {
 int FillSpecificParameters(h264_codec_context_t *context) {
        int sane = 0;
        SEncParamExt *param;
-       
+
        param = &context->encoder_params;
 
        if (!context->codec_settings.video.width) {
@@ -216,11 +216,11 @@ static switch_size_t buffer_h264_nalu(h264_codec_context_t *context, switch_fram
 
        /* hack for phones sending sps/pps with frame->m = 1 such as grandstream */
        if ((nalu_type == 7 || nalu_type == 8) && frame->m) frame->m = SWITCH_FALSE;
-       
+
        if (nalu_type == 28) { // 0x1c FU-A
                int start = *(data + 1) & 0x80;
                int end = *(data + 1) & 0x40;
-               
+
                nalu_type = *(data + 1) & 0x1f;
 
                //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "WTF start:%d end:%d mark:%d\n", start, end, frame->m);
@@ -731,8 +731,8 @@ end:
        return status;
 }
 
-static switch_status_t switch_h264_control(switch_codec_t *codec, 
-                                                                                  switch_codec_control_command_t cmd, 
+static switch_status_t switch_h264_control(switch_codec_t *codec,
+                                                                                  switch_codec_control_command_t cmd,
                                                                                   switch_codec_control_type_t ctype,
                                                                                   void *cmd_data,
                                                                                   switch_codec_control_type_t atype,
@@ -746,7 +746,7 @@ static switch_status_t switch_h264_control(switch_codec_t *codec,
 
        switch(cmd) {
        case SCC_VIDEO_GEN_KEYFRAME:
-               context->need_key_frame = 1;            
+               context->need_key_frame = 1;
                break;
        case SCC_VIDEO_BANDWIDTH:
                {
index 3ff5a6a465df38fe9472a0967370b81c66e1d8e5..35db781df64a301e0816a71fea486a0d1067f26a 100644 (file)
@@ -181,7 +181,7 @@ static uint32_t switch_opus_encoder_set_audio_bandwidth(OpusEncoder *encoder_obj
                        opus_encoder_ctl(encoder_object, OPUS_SET_MAX_BANDWIDTH(OPUS_BANDWIDTH_SUPERWIDEBAND));
                        opus_encoder_ctl(encoder_object, OPUS_SET_SIGNAL(OPUS_AUTO));
                        return OPUS_BANDWIDTH_SUPERWIDEBAND;
-               }  
+               }
                /* Audio Bandwidth: 0-20000Hz Sampling Rate: 48000Hz */
                opus_encoder_ctl(encoder_object, OPUS_SET_BANDWIDTH(OPUS_AUTO));
                opus_encoder_ctl(encoder_object, OPUS_SET_MAX_BANDWIDTH(OPUS_BANDWIDTH_FULLBAND));
@@ -360,7 +360,7 @@ static char *gen_fmtp(opus_codec_settings_t *settings, switch_memory_pool_t *poo
 
 }
 
-static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_length_bytes) 
+static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_length_bytes)
 {
        /* nb_silk_frames: number of silk-frames (10 or 20 ms) in an opus frame:  0, 1, 2 or 3 */
        /* computed from the 5 MSB (configuration) of the TOC byte (payload[0]) */
@@ -370,7 +370,7 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng
        /* p0p1 = 1 or 2  => nb_opus_frames = 2 */
        /* p0p1 = 3  =>  given by the 6 LSB of payload[1] */
 
-       int nb_silk_frames, nb_opus_frames, n, i; 
+       int nb_silk_frames, nb_opus_frames, n, i;
        opus_int16 frame_sizes[48];
        const unsigned char *frame_data[48];
 
@@ -378,12 +378,12 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "corrupted packet (invalid size)\n");
                return SWITCH_FALSE;
        }
-       if (payload[0] & 0x80) {   
+       if (payload[0] & 0x80) {
                /* this scares users and its harmless so commenting it */
                //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FEC in CELT_ONLY mode ?!\n");
                return SWITCH_FALSE;
        }
-                       
+
        if ((nb_opus_frames = opus_packet_parse(payload, payload_length_bytes, NULL, frame_data, frame_sizes, NULL)) <= 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OPUS_INVALID_PACKET ! nb_opus_frames: %d\n", nb_opus_frames);
                return SWITCH_FALSE;
@@ -396,7 +396,7 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng
                if(nb_silk_frames  == 0) {
                        nb_silk_frames = 1;
                }
-               if ((nb_silk_frames == 1) && (nb_opus_frames == 1)) { 
+               if ((nb_silk_frames == 1) && (nb_opus_frames == 1)) {
                        for (n = 0; n <= (payload[0]&0x4) ; n++) { /* mono or stereo: 10,20 ms */
                                if (frame_data[0][0] & (0x80 >> ((n + 1) * (nb_silk_frames + 1) - 1))) {
                                        return SWITCH_TRUE; /* frame has FEC */
@@ -407,7 +407,7 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng
                        for (i=0 ; i < nb_opus_frames; i++ ) { /* only mono Opus frames */
                                LBRR_flag = (frame_data[i][0] >> (7 - nb_silk_frames)) & 0x1;
                                if (LBRR_flag) {
-                                       return SWITCH_TRUE; /* one of the silk frames has FEC */ 
+                                       return SWITCH_TRUE; /* one of the silk frames has FEC */
                                }
                        }
                }
@@ -432,17 +432,17 @@ static int switch_opus_get_fec_bitrate(int fs, int loss)
 
        if (loss <= 0){
                return SWITCH_STATUS_FALSE;
-       } 
+       }
 
        if (fs == 8000) {
-               if (loss >=25) { 
+               if (loss >=25) {
                        return threshold_bitrates[24];
                } else {
                        return threshold_bitrates[loss-1];
                }
        }
 
-       return SWITCH_STATUS_FALSE ; 
+       return SWITCH_STATUS_FALSE ;
 }
 
 static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint32_t samples_per_second, char *print_text)
@@ -476,11 +476,11 @@ static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint3
 
        nb_channels = opus_packet_get_nb_channels(payload);
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: opus_frames [%d] samples [%d] audio bandwidth [%s] bytes [%d] FEC[%s] channels[%d]\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: opus_frames [%d] samples [%d] audio bandwidth [%s] bytes [%d] FEC[%s] channels[%d]\n",
                                                        print_text, nb_opus_frames, nb_samples, audiobandwidth_str, len, has_fec ? "yes" : "no", nb_channels);
 
        return SWITCH_STATUS_SUCCESS;
-} 
+}
 
 static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
 {
@@ -576,18 +576,18 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag
                }
 
                /* https://tools.ietf.org/html/rfc7587  */
-               if (opus_codec_settings.maxaveragebitrate) { 
+               if (opus_codec_settings.maxaveragebitrate) {
                        opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(opus_codec_settings.maxaveragebitrate));
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: set bitrate based on maxaveragebitrate value found in SDP or local config [%dbps]\n", opus_codec_settings.maxaveragebitrate);
                } else {
                        opus_encoder_ctl(context->encoder_object, OPUS_SET_BANDWIDTH(OPUS_AUTO));
                        opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(bitrate_bps)); /* OPUS_AUTO */
-                       opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(&bitrate_bps)); /* return average bps for this audio bandwidth */ 
+                       opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(&bitrate_bps)); /* return average bps for this audio bandwidth */
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: set bitrate to local settings [%dbps]\n", bitrate_bps);
                }
                /* Another fmtp setting from https://tools.ietf.org/html/rfc7587 - "RTP Payload Format for the Opus Speech and Audio Codec" */
                if (opus_codec_settings.maxplaybackrate) {
-                       opus_int32 audiobandwidth; 
+                       opus_int32 audiobandwidth;
                        char audiobandwidth_str[32] = {0};
 
                        audiobandwidth = switch_opus_encoder_set_audio_bandwidth(context->encoder_object,opus_codec_settings.maxplaybackrate);
@@ -617,15 +617,15 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag
                if (opus_codec_settings.useinbandfec) {
                        /* FEC on the encoder: start the call with a preconfigured packet loss percentage */
                        int fec_bitrate = opus_codec_settings.maxaveragebitrate;
-                       int loss_percent = opus_prefs.plpct ; 
+                       int loss_percent = opus_prefs.plpct ;
                        opus_encoder_ctl(context->encoder_object, OPUS_SET_INBAND_FEC(opus_codec_settings.useinbandfec));
                        opus_encoder_ctl(context->encoder_object, OPUS_SET_PACKET_LOSS_PERC(loss_percent));
-                       if (opus_prefs.keep_fec){  
-                               fec_bitrate = switch_opus_get_fec_bitrate(enc_samplerate,loss_percent); 
+                       if (opus_prefs.keep_fec){
+                               fec_bitrate = switch_opus_get_fec_bitrate(enc_samplerate,loss_percent);
                                 /* keep a bitrate for which the encoder will always add FEC */
                                if (fec_bitrate != SWITCH_STATUS_FALSE) {
-                                       opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(fec_bitrate)); 
-                                       /* will override the maxaveragebitrate set in opus.conf.xml  */ 
+                                       opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(fec_bitrate));
+                                       /* will override the maxaveragebitrate set in opus.conf.xml  */
                                        opus_codec_settings.maxaveragebitrate = fec_bitrate;
                                }
                                context->control_state.keep_fec = opus_prefs.keep_fec;
@@ -691,8 +691,8 @@ static switch_status_t switch_opus_destroy(switch_codec_t *codec)
                if (context->decoder_object) {
                        switch_core_session_t *session = codec->session;
                        if (session) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Opus decoder stats: Frames[%d] PLC[%d] FEC[%d]\n", 
-                                                                               context->decoder_stats.frame_counter, context->decoder_stats.plc_counter-context->decoder_stats.fec_counter, context->decoder_stats.fec_counter); 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Opus decoder stats: Frames[%d] PLC[%d] FEC[%d]\n",
+                                                                               context->decoder_stats.frame_counter, context->decoder_stats.plc_counter-context->decoder_stats.fec_counter, context->decoder_stats.fec_counter);
                        }
                        opus_decoder_destroy(context->decoder_object);
                        context->decoder_object = NULL;
@@ -817,40 +817,40 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
 
                                frame.data = buf;
                                frame.buflen = sizeof(buf);
-                               
+
                                if (globals.debug || context->debug) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Missing %s %u Checking JB\n", seq ? "SEQ" : "TS", seq ? seq : ts);
                                }
-                               
+
                                if (switch_jb_peek_frame(jb, ts, seq, 1, &frame) == SWITCH_STATUS_SUCCESS) {
                                        if (globals.debug || context->debug) {
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Lookahead frame found: %u:%u\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Lookahead frame found: %u:%u\n",
                                                                                  frame.timestamp, frame.seq);
                                        }
 
-                                       
+
                                        if ((fec = switch_opus_has_fec(frame.data, frame.datalen))) {
                                                encoded_data = frame.data;
                                                encoded_data_len = frame.datalen;
                                        }
-                                       
+
                                        if (globals.debug || context->debug) {
                                                if (fec) {
-                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FEC info available in packet with SEQ: %d LEN: %d\n", 
+                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FEC info available in packet with SEQ: %d LEN: %d\n",
                                                                                          frame.seq, frame.datalen);
                                                } else {
-                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NO FEC info in this packet with SEQ: %d LEN: %d\n", 
+                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NO FEC info in this packet with SEQ: %d LEN: %d\n",
                                                                                          frame.seq, frame.datalen);
                                                }
                                        }
                                }
                        }
                }
-               
+
 
                opus_decoder_ctl(context->decoder_object, OPUS_GET_LAST_PACKET_DURATION(&last_frame_size));
                if (last_frame_size) frame_size = last_frame_size;
-               
+
                if (globals.debug || context->debug) {
                        if (opus_prefs.use_jb_lookahead || context->use_jb_lookahead) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "MISSING FRAME: %s\n", fec ? "Look-ahead FEC" : "PLC");
@@ -865,7 +865,7 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
        if (globals.debug || context->debug > 1) {
                int samplerate = context->dec_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000);
                switch_opus_info(encoded_data, encoded_data_len,
-                                                samplerate ? samplerate : codec->implementation->actual_samples_per_second, 
+                                                samplerate ? samplerate : codec->implementation->actual_samples_per_second,
                                                 !encoded_data ? "PLC correction" : fec ?  "FEC correction" : "decode");
        }
 
@@ -910,7 +910,7 @@ static switch_status_t switch_opus_encode_repacketize(switch_codec_t *codec,
        opus_int32 ret = 0;
        opus_int32 total_len = 0;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
-       
+
        if (!context) {
                switch_goto_status(SWITCH_STATUS_FALSE, end);
        }
@@ -932,12 +932,12 @@ static switch_status_t switch_opus_encode_repacketize(switch_codec_t *codec,
        dec_ptr_buf = (int16_t *)decoded_data;
        for (i = 0; i < nb_frames; i++) {
                 /* set inband FEC ON or OFF for the next Opus frame */
-               if (i == (nb_frames - 1) && want_fec) { 
-                       /* When FEC is enabled for Opus frame N, LBRR is stored during regular encoding of */ 
+               if (i == (nb_frames - 1) && want_fec) {
+                       /* When FEC is enabled for Opus frame N, LBRR is stored during regular encoding of */
                        /* this Opus frame N, and this LBRR data will be packed with the regular encoding */
                        /* data of Opus frame N+1. We enable FEC on our last Opus frame which is to be packed, just */
                        /* to actually have it stored in the first Opus frame, that is when switch_opus_encode_repacketize() */
-                       /* is called again to pack the next big 80,100 or 120 ms frame. */ 
+                       /* is called again to pack the next big 80,100 or 120 ms frame. */
                        toggle_fec = 1; /* FEC ON for the last frame */
                }
 
@@ -1199,19 +1199,19 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
                                }
                        }
                        if (opus_prefs.adjust_bitrate) {
-                               /* make bitrate adjust the step , but keep it as a  multiple of 400 (see OpusFAQ). 
+                               /* make bitrate adjust the step , but keep it as a  multiple of 400 (see OpusFAQ).
                                 * usual RTCP interval is 5 seconds  which is long time - the step should be bigger. */
-                               /* step's value should depend on packet loss too, to decrease more abrubtly 
+                               /* step's value should depend on packet loss too, to decrease more abrubtly
                                 * at high packet loss. */
                                int base_step = 400; /*bps*/
                                int range = context->codec_settings.maxaveragebitrate - SWITCH_OPUS_MIN_BITRATE;
                                float steps = (float)((float)(range / 100) / base_step);
-                               int br_step = (int)(round(steps) * base_step) * plpct; 
+                               int br_step = (int)(round(steps) * base_step) * plpct;
                                if (globals.debug || context->debug) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, 
-                                                       SWITCH_LOG_DEBUG, "Opus encoder: bitrate increase/decrease step now is: %d bps, range:%d\n", br_step, range); 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG,
+                                                       SWITCH_LOG_DEBUG, "Opus encoder: bitrate increase/decrease step now is: %d bps, range:%d\n", br_step, range);
                                }
-                               context->control_state.increase_step = context->control_state.decrease_step = br_step; 
+                               context->control_state.increase_step = context->control_state.decrease_step = br_step;
                        }
                        context->old_plpct = plpct;
                }
@@ -1224,7 +1224,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
                                opus_int32 current_bitrate=context->control_state.current_bitrate;
                                if (!strcasecmp(cmd, "increase")) {
                                        /* https://wiki.xiph.org/OpusFAQ
-                                       "[...]Opus scales from about 6 to 512 kb/s, in increments of 0.4 kb/s (one byte with 20 ms frames). 
+                                       "[...]Opus scales from about 6 to 512 kb/s, in increments of 0.4 kb/s (one byte with 20 ms frames).
                                        Opus can have more than 1200 possible bitrates[...]" */
                                        int br_step = context->control_state.increase_step?context->control_state.increase_step:400;
                                        opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(&current_bitrate));
@@ -1232,7 +1232,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
                                                opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(current_bitrate+br_step));
                                                if ((context->control_state.keep_fec) && (current_bitrate > SWITCH_OPUS_MIN_FEC_BITRATE)) {
                                                        opus_prefs.keep_fec = 1; /* enable back FEC if it was disabled by SCC_AUDIO_ADJUST_BITRATE, we have enough network bandwidth now */
-                                               } 
+                                               }
                                                if (globals.debug || context->debug) {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: Adjusting bitrate to %d (increase)\n", current_bitrate+br_step);
                                                }
@@ -1242,7 +1242,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
                                        opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(&current_bitrate));
                                        if (current_bitrate > SWITCH_OPUS_MIN_BITRATE) {
                                                if (context->control_state.keep_fec) {
-                                                       /* no point to try to keep FEC enabled anymore, 
+                                                       /* no point to try to keep FEC enabled anymore,
                                                         * we're low on network bandwidth (that's why we ended up here) */
                                                        opus_prefs.keep_fec = 0;
                                                }
@@ -1256,7 +1256,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
                                        opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(opus_prefs.maxaveragebitrate));
                                        if (context->control_state.keep_fec) {
                                                opus_prefs.keep_fec = 1; /* enable back FEC, we have enough network bandwidth now */
-                                       } 
+                                       }
                                        if (globals.debug || context->debug) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: Adjusting bitrate to %d (configured maxaveragebitrate)\n", opus_prefs.maxaveragebitrate);
                                        }
@@ -1265,7 +1265,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
                                        opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(SWITCH_OPUS_MIN_BITRATE));
                                        if (context->control_state.keep_fec) {
                                                opus_prefs.keep_fec = 0; /* do not enforce FEC anymore, we're low on network bandwidth */
-                                       } 
+                                       }
                                        if (globals.debug || context->debug) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: Adjusting bitrate to %d (minimum)\n", SWITCH_OPUS_MIN_BITRATE);
                                        }
@@ -1398,7 +1398,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
                                                                                         switch_opus_decode,    /* function to decode encoded data into raw data */
                                                                                         switch_opus_destroy);  /* deinitalize a codec handle using this implementation */
                codec_interface->implementations->codec_control = switch_opus_control;
-       
+
                bytes *= 2;
                samples *= 2;
                mss *= 2;
index 6ce31b14025da3681aca63c318fbce1d98a2d809..506df4c4c8ec8dadfbd88e4586fc89dab0af6b5c 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2010, Sangoma Technologies
  * Moises Silva <moy@sangoma.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -44,7 +44,7 @@ SWITCH_MODULE_DEFINITION(mod_sangoma_codec, mod_sangoma_codec_load, mod_sangoma_
 
 /* it seemed we need higher PTIME than the calling parties, so we assume nobody will use higher ptime than 40 */
 #define SANGOMA_DEFAULT_SAMPLING_RATE 80
-#define SANGOMA_TRANSCODE_CONFIG "sangoma_codec.conf" 
+#define SANGOMA_TRANSCODE_CONFIG "sangoma_codec.conf"
 
 /* \brief vocallos configuration */
 static sngtc_init_cfg_t g_init_cfg;
@@ -131,7 +131,7 @@ struct codec_data {
        /* packet counters */
        unsigned long tx;
        unsigned long rx;
-       unsigned long ticks; 
+       unsigned long ticks;
 
        /* Lost packets */
        long lastrxseqno;
@@ -213,7 +213,7 @@ static int sangoma_create_rtp_port(void *usr_priv, uint32_t host_ip, uint32_t *p
        switch_port_t rtp_port;
 
        local_ip_addr.s_addr = htonl(host_ip);
-       
+
        switch_inet_ntop(AF_INET, &local_ip_addr, local_ip, sizeof(local_ip));
 
        /* request a port */
@@ -235,7 +235,7 @@ static int sangoma_release_rtp_port(void *usr_priv, uint32_t host_ip, uint32_t p
        switch_port_t rtp_port = p_rtp_port;
 
        local_ip_addr.s_addr = htonl(host_ip);
-       
+
        switch_inet_ntop(AF_INET, &local_ip_addr, local_ip, sizeof(local_ip));
 
        /* release the port */
@@ -264,8 +264,8 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r
 
        /*
         * We *MUST* use a new pool
-        * Do not use the session pool since the session may go away while the RTP socket should linger around 
-        * until sangoma_transcode decides to kill it (possibly because the same RTP session is used for a different call) 
+        * Do not use the session pool since the session may go away while the RTP socket should linger around
+        * until sangoma_transcode decides to kill it (possibly because the same RTP session is used for a different call)
         * also do not use the module pool otherwise memory would keep growing because switch_rtp_destroy does not
         * free the memory used (is assumed it'll be freed when the pool is destroyed)
         */
@@ -273,19 +273,19 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r
        if (status != SWITCH_STATUS_SUCCESS) {
                return -1;
        }
-       
+
        local_ip_addr.s_addr = htonl(codec_req_leg->host_ip);
        switch_inet_ntop(AF_INET, &local_ip_addr, local_ip, sizeof(local_ip));
        sngtc_codec_ipv4_hex_to_str(codec_reply_leg->codec_ip, codec_ip);
 
        iana = codec_id_to_iana(codec_req_leg->codec_id);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Creating RTP session for host (%s/%d)  vocallo(%s/%d) Iana=%d CodecId=%d ms=%d idx=%lu\n",
-                                         local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, codec_req_leg->codec_id, 
+                                         local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, codec_req_leg->codec_id,
                                          codec_req_leg->ms*1000, sess->sessid);
 
        /* create the RTP socket */
-       rtp_session = switch_rtp_new(local_ip, rtp_port, 
-                       codec_ip, codec_reply_leg->codec_udp_port, 
+       rtp_session = switch_rtp_new(local_ip, rtp_port,
+                       codec_ip, codec_reply_leg->codec_udp_port,
                        iana,
                        sess->impl->samples_per_packet,
                        codec_req_leg->ms * 1000, /* microseconds per packet */
@@ -320,7 +320,7 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f
        uint32_t encoding, decoding;
        struct sangoma_transcoding_session *sess = NULL;
        vocallo_codec_t *vcodec;
-       
+
        encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
        decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
 
@@ -342,11 +342,11 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f
        switch_assert(sess->impl);
 
        vcodec = get_codec_from_iana(codec->implementation->ianacode, codec->implementation->bits_per_second);
-       
+
        if (encoding) {
                sess->encoder.request.usr_priv = sess;
                sess->encoder.request.a.host_ip = g_rtpip;
-               sess->encoder.request.a.codec_id = vcodec->actual_sampling_rate == 16000 
+               sess->encoder.request.a.codec_id = vcodec->actual_sampling_rate == 16000
                                                 ? SNGTC_CODEC_L16_2 : SNGTC_CODEC_L16_1;
                sess->encoder.request.a.ms = codec->implementation->microseconds_per_packet/1000;
 
@@ -362,7 +362,7 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f
                sess->decoder.request.a.ms = codec->implementation->microseconds_per_packet/1000;
 
                sess->decoder.request.b.host_ip = g_rtpip;
-               sess->decoder.request.b.codec_id = vcodec->actual_sampling_rate == 16000 
+               sess->decoder.request.b.codec_id = vcodec->actual_sampling_rate == 16000
                                                 ? SNGTC_CODEC_L16_2 : SNGTC_CODEC_L16_1;
                sess->decoder.request.b.ms = codec->implementation->microseconds_per_packet/1000;
 
@@ -509,7 +509,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec
        }
 
        /* do the writing */
-       memset(&linear_frame, 0, sizeof(linear_frame)); 
+       memset(&linear_frame, 0, sizeof(linear_frame));
        linear_frame.source = __SWITCH_FUNC__;
        linear_frame.data = decoded_byteswapped_data;
        linear_frame.datalen = decoded_data_len;
@@ -528,7 +528,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec
        }
 
        if (res < i) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                "Requested to write %d bytes to Sangoma encoder RTP session, but wrote %d bytes.\n", i, res);
                return SWITCH_STATUS_FALSE;
        }
@@ -569,7 +569,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec
 
                if (encoded_frame.payload != codec->implementation->ianacode) {
                        if (sess->encoder.request.b.codec_id == SNGTC_CODEC_ILBC_152 || sess->encoder.request.b.codec_id == SNGTC_CODEC_ILBC_133) {
-                               /* since we moved to SOAP based communications, the mapping between vocallo IANA and our IANA does not work, 
+                               /* since we moved to SOAP based communications, the mapping between vocallo IANA and our IANA does not work,
                                 * some codecs checks cannot be completely done, like iLBC */
                                if (encoded_frame.payload != IANA_ILBC_152_8000_1 && encoded_frame.payload != IANA_ILBC_133_8000_1) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting either %d or %d\n",
@@ -588,7 +588,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec
                                /* if there is something where we want to write, we're dropping it */
                                sess->encoder.rxdiscarded++;
 #if 0
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding encoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n", 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding encoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n",
                                                sess->encoder.rtp_queue[sess->encoder.queue_rindex].datalen, sess->sessid, sess->encoder.queue_windex, sess->encoder.queue_rindex);
 #endif
                                SAFE_INDEX_INC(sess->encoder.rtp_queue, sess->encoder.queue_rindex);
@@ -603,7 +603,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec
                /* monitor the queue size */
                sess->encoder.queue_size++;
                if (sess->encoder.queue_size > sess->encoder.queue_max_ever) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->encoder.queue_size, 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->encoder.queue_size,
                                        sess->encoder.queue_windex, sess->encoder.queue_rindex);
                        sess->encoder.queue_max_ever = sess->encoder.queue_size;
                }
@@ -732,7 +732,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses
        }
 
        if (res < encoded_data_len) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                "Requested to write %d bytes to Sangoma decoder RTP session, but wrote %d bytes.\n",
                                encoded_data_len, res);
                return SWITCH_STATUS_FALSE;
@@ -778,7 +778,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses
                                /* if there is something where we want to write, we're dropping it */
                                sess->decoder.rxdiscarded++;
 #if 0
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding decoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n", 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding decoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n",
                                                sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen, sess->sessid, sess->decoder.queue_windex, sess->decoder.queue_rindex);
 #endif
                                SAFE_INDEX_INC(sess->decoder.rtp_queue, sess->decoder.queue_rindex);
@@ -799,7 +799,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses
                /* monitor the queue size */
                sess->decoder.queue_size++;
                if (sess->decoder.queue_size > sess->decoder.queue_max_ever) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->decoder.queue_size, 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->decoder.queue_size,
                                        sess->decoder.queue_windex, sess->decoder.queue_rindex);
                        sess->decoder.queue_max_ever = sess->decoder.queue_size;
                }
@@ -856,10 +856,10 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec,       /* codec ses
 static switch_status_t switch_sangoma_destroy(switch_codec_t *codec)
 {
        struct sangoma_transcoding_session *sess = codec->private_info;
-       /* things that you may do here is closing files, sockets or other resources used during the codec session 
+       /* things that you may do here is closing files, sockets or other resources used during the codec session
         * no need to free memory allocated from the pool though, the owner of the pool takes care of that */
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sangoma destroy called.\n");
-       
+
        switch_mutex_lock(g_sessions_lock);
 
        if (sess->encoder.txrtp) {
@@ -868,7 +868,7 @@ static switch_status_t switch_sangoma_destroy(switch_codec_t *codec)
        if (sess->decoder.txrtp) {
                sngtc_free_transcoding_session(&sess->decoder.reply);
        }
-       
+
        switch_core_hash_delete(g_sessions_hash, sess->hashkey);
        memset(sess, 0, sizeof(*sess));
 
@@ -965,9 +965,9 @@ SWITCH_STANDARD_API(sangoma_function)
 
 
                        stream->write_function(stream, STATS_FORMAT,
-                                       sessid_str, 
+                                       sessid_str,
                                        sess->impl->iananame,
-                                       sess->encoder.txrtp ? "Yes" : "No", 
+                                       sess->encoder.txrtp ? "Yes" : "No",
                                        sess->decoder.txrtp ? "Yes" : "No",
                                        encoder_tx_str,
                                        encoder_rx_str,
@@ -988,12 +988,12 @@ SWITCH_STANDARD_API(sangoma_function)
                if (argc < 2) {
                        stream->write_function(stream, "%s", SANGOMA_SYNTAX);
                        goto done;
-               } 
+               }
                ret = sscanf(argv[1], "%lu", &sessid);
                if (ret != 1) {
                        stream->write_function(stream, "%s", SANGOMA_SYNTAX);
                        goto done;
-               } 
+               }
 
                sess = sangoma_find_session(sessid);
                if (!sess) {
@@ -1016,7 +1016,7 @@ SWITCH_STANDARD_API(sangoma_function)
                        stream->write_function(stream, "-- Inbound Stats --\n");
                        stream->write_function(stream, "Rx Discarded: %lu\n", sess->encoder.rxdiscarded);
                        sangoma_print_stats(stream, &stats->inbound);
-                       
+
 
                        stats = switch_rtp_get_stats(sess->encoder.txrtp, NULL);
                        stream->write_function(stream, "-- Outbound Stats --\n");
@@ -1048,12 +1048,12 @@ SWITCH_STANDARD_API(sangoma_function)
                if (argc < 2) {
                        stream->write_function(stream, "%s", SANGOMA_SYNTAX);
                        goto done;
-               } 
+               }
                ret = sscanf(argv[1], "%lu", &sessid);
                if (ret != 1) {
                        stream->write_function(stream, "%s", SANGOMA_SYNTAX);
                        goto done;
-               } 
+               }
                sess = sangoma_find_session(sessid);
                if (!sess) {
                        stream->write_function(stream, "Failed to find session %lu\n", sessid);
@@ -1069,12 +1069,12 @@ SWITCH_STANDARD_API(sangoma_function)
                if (argc < 2) {
                        stream->write_function(stream, "%s", SANGOMA_SYNTAX);
                        goto done;
-               } 
+               }
                ret = sscanf(argv[1], "%lu", &sessid);
                if (ret != 1) {
                        stream->write_function(stream, "%s", SANGOMA_SYNTAX);
                        goto done;
-               } 
+               }
                sess = sangoma_find_session(sessid);
                if (!sess) {
                        stream->write_function(stream, "Failed to find session %lu\n", sessid);
@@ -1230,7 +1230,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to detect vocallo modules\n");
                return SWITCH_STATUS_FALSE;
        }
-    
+
        if (sngtc_activate_modules(&g_init_cfg, &activated)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to activate vocallo modules\n");
                return SWITCH_STATUS_FALSE;
@@ -1259,14 +1259,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load)
 
                /* check if the codec is in the load list, otherwise skip it */
                if (strcasecmp(g_codec_register_list, "all") && !strcasestr(g_codec_register_list, g_codec_map[c].iana_name)) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not loading codec %s because was not found in the load list\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not loading codec %s because was not found in the load list\n",
                                        g_codec_map[c].iana_name);
                        continue;
                }
 
                /* load it unless is named in the noload list */
                if (strcasestr(g_codec_noregister_list, g_codec_map[c].iana_name)) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not loading codec %s because was not found in the noload list\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not loading codec %s because was not found in the noload list\n",
                                        g_codec_map[c].iana_name);
                        continue;
                }
@@ -1283,7 +1283,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load)
 
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Registering implementations for codec %s\n", g_codec_map[c].iana_name);
 
-               /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface 
+               /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface
                 * list the core keeps, gets a codec id and set the given codec name to it.
                 * At this point there is an empty shell codec interface registered, but not yet implementations */
                SWITCH_ADD_CODEC(codec_interface, g_codec_map[c].fs_name);
@@ -1341,7 +1341,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load)
                                                                 switch_sangoma_encode, /* function to encode slinear data into encoded data */
                                                                 switch_sangoma_decode, /* function to decode encoded data into slinear data */
                                                                 switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */
-                               
+
                                break;
                        case SNGTC_CODEC_ILBC_133:
                        case SNGTC_CODEC_ILBC_152:
index 8da1c541c702e075046b15f83fdcd6eb049ec76c..e437ed7df7e009e2ff046646b053a44175abf403 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Brian K. West <brian@freeswitch.org>
  *
@@ -36,7 +36,7 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_silk_load);
 SWITCH_MODULE_DEFINITION(mod_silk, mod_silk_load, NULL, NULL);
 
-#define MAX_BYTES_PER_FRAME            250 
+#define MAX_BYTES_PER_FRAME            250
 #define MAX_INPUT_FRAMES               5
 #define MAX_LBRR_DELAY                 2
 #define MAX_FRAME_LENGTH               480
@@ -158,8 +158,8 @@ static switch_status_t switch_silk_fmtp_parse(const char *fmtp, switch_codec_fmt
 
 
 
-static switch_status_t switch_silk_init(switch_codec_t *codec, 
-                                                                               switch_codec_flag_t freeswitch_flags, 
+static switch_status_t switch_silk_init(switch_codec_t *codec,
+                                                                               switch_codec_flag_t freeswitch_flags,
                                                                                const switch_codec_settings_t *codec_settings)
 {
        struct silk_context *context = NULL;
@@ -177,7 +177,7 @@ static switch_status_t switch_silk_init(switch_codec_t *codec,
        memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp));
        codec_fmtp.private_info = &silk_codec_settings;
        switch_silk_fmtp_parse(codec->fmtp_in, &codec_fmtp);
-       
+
        codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "useinbandfec=%s; usedtx=%s; maxaveragebitrate=%d",
                                                                                  silk_codec_settings.useinbandfec ? "1" : "0",
                                                                                  silk_codec_settings.usedtx ? "1" : "0",
@@ -187,13 +187,13 @@ static switch_status_t switch_silk_init(switch_codec_t *codec,
                if (SKP_Silk_SDK_Get_Encoder_Size(&encSizeBytes)) {
                        return SWITCH_STATUS_FALSE;
                }
-               
+
                context->enc_state = switch_core_alloc(codec->memory_pool, encSizeBytes);
 
                if (SKP_Silk_SDK_InitEncoder(context->enc_state, &context->encoder_object)) {
                        return SWITCH_STATUS_FALSE;
                }
-               
+
 
                context->encoder_object.API_sampleRate = codec->implementation->actual_samples_per_second;
                context->encoder_object.maxInternalSampleRate = codec->implementation->actual_samples_per_second;
@@ -208,7 +208,7 @@ static switch_status_t switch_silk_init(switch_codec_t *codec,
        if (decoding) {
 
                switch_set_flag(codec, SWITCH_CODEC_FLAG_HAS_PLC);
-               
+
                if (SKP_Silk_SDK_Get_Decoder_Size(&decSizeBytes)) {
                        return SWITCH_STATUS_FALSE;
                }
@@ -236,25 +236,25 @@ void printSilkError(SKP_int16 ret){
        switch (ret) {
                case SKP_SILK_NO_ERROR: message = "No errors";
                        break;
-               case SKP_SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES: 
+               case SKP_SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES:
                        message = "Input length is not multiplum of 10 ms, or length is longer than the packet length";
                        break;
-               case SKP_SILK_ENC_FS_NOT_SUPPORTED: 
+               case SKP_SILK_ENC_FS_NOT_SUPPORTED:
                        message = "Sampling frequency not 8000 , 12000, 16000 or 24000 Hertz";
                        break;
                case SKP_SILK_ENC_PACKET_SIZE_NOT_SUPPORTED:
                        message ="Packet size not 20, 40 , 60 , 80 or 100 ms ";
-                       break; 
-               case SKP_SILK_ENC_PAYLOAD_BUF_TOO_SHORT: 
+                       break;
+               case SKP_SILK_ENC_PAYLOAD_BUF_TOO_SHORT:
                        message = "Allocated payload buffer too short";
                        break;
-               case SKP_SILK_ENC_INVALID_LOSS_RATE: 
+               case SKP_SILK_ENC_INVALID_LOSS_RATE:
                        message = " Loss rate not between  0 and 100 % ";
                        break;
                case SKP_SILK_ENC_INVALID_COMPLEXITY_SETTING:
                        message = "Complexity setting not valid, use 0 ,1 or 2";
                        break;
-               case SKP_SILK_ENC_INVALID_INBAND_FEC_SETTING: 
+               case SKP_SILK_ENC_INVALID_INBAND_FEC_SETTING:
                        message = "Inband FEC setting not valid, use 0 or 1     ";
                        break;
                case SKP_SILK_ENC_INVALID_DTX_SETTING:
@@ -266,7 +266,7 @@ void printSilkError(SKP_int16 ret){
                case SKP_SILK_DEC_INVALID_SAMPLING_FREQUENCY:
                        message = "Output sampling frequency lower than internal decoded sampling frequency";
                        break;
-               case SKP_SILK_DEC_PAYLOAD_TOO_LARGE: 
+               case SKP_SILK_DEC_PAYLOAD_TOO_LARGE:
                        message = "Payload size exceeded the maximum allowed 1024 bytes";
                        break;
                case  SKP_SILK_DEC_PAYLOAD_ERROR        :
@@ -288,7 +288,7 @@ static switch_status_t switch_silk_encode(switch_codec_t *codec,
        struct silk_context *context = codec->private_info;
        SKP_int16 ret;
        SKP_int16 pktsz  = (SKP_int16)context->encoder_object.packetSize;
-       SKP_int16 nBytes = MAX_BYTES_PER_FRAME * MAX_INPUT_FRAMES; 
+       SKP_int16 nBytes = MAX_BYTES_PER_FRAME * MAX_INPUT_FRAMES;
        SKP_int16 *lindata = (SKP_int16 *)decoded_data;
        SKP_int16 samples = (SKP_int16)(decoded_data_len /sizeof(SKP_int16));
        *encoded_data_len = 0;
@@ -299,7 +299,7 @@ static switch_status_t switch_silk_encode(switch_codec_t *codec,
                                                          pktsz,
                                                          encoded_data,
                                                          &nBytes);
-       
+
                if (ret) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SKP_Silk_Encode returned %d!\n", ret);
                        printSilkError(ret);
@@ -323,7 +323,7 @@ static switch_status_t switch_silk_decode(switch_codec_t *codec,
                                                                                  uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
 {
        struct silk_context *context = codec->private_info;
-       SKP_int16 ret, len; 
+       SKP_int16 ret, len;
        int16_t *target = decoded_data;
        switch_core_session_t *session = codec->session;
        switch_jb_t *jb = NULL;
index 783f47427bcc9622ce891bc908a01b0679aa5eed..3c6a7f1c8946b6921f91ee01d4d5af47769ce1ac 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Brian K. West <brian@freeswitch.org>
  * Steve Underwood <steveu@coppice.org>
  *
  * mod_siren.c -- ITU-T G.722.1 (Siren7) and ITU-T G.722.1 Annex C (Siren14) licensed from Polycom(R)
  *
- * Using mod_siren in a commercial product will require you to acquire a patent 
+ * Using mod_siren in a commercial product will require you to acquire a patent
  * license directly from Polycom(R) for your company.
  *
  * http://www.polycom.com/usa/en/company/about_us/technology/siren_g7221/siren_g7221.html
index e83ccc0a6e3fe0b0a594aae80a2b34a47da966d5..e22b5fa7623ecad6a32e9507c36c1a028d1232d0 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -29,7 +29,7 @@
  */
 
 /*
- * Other source of reference for module building: 
+ * Other source of reference for module building:
  * src/mod/applications/mod_skel/mod_skel.c
  * http://files.freeswitch.org/cluecon_2009/presentations/Silva_FreeSWITCH_Modules_For_Asterisk_Devs.ppt
  * You can load this codec with this command:
@@ -145,7 +145,7 @@ static switch_status_t switch_skel_decode(switch_codec_t *codec,    /* codec sessio
 
 static switch_status_t switch_skel_destroy(switch_codec_t *codec)
 {
-       /* things that you may do here is closing files, sockets or other resources used during the codec session 
+       /* things that you may do here is closing files, sockets or other resources used during the codec session
         * no need to free memory allocated from the pool though, the owner of the pool takes care of that */
        struct skel_context *context = codec->private_info;
        context->encodes = 0;
@@ -153,7 +153,7 @@ static switch_status_t switch_skel_destroy(switch_codec_t *codec)
        return SWITCH_STATUS_SUCCESS;
 }
 
-/* A standard API registered by the this codec module, APIs can be executed from CLI, mod_event_socket, or many other interfaces 
+/* A standard API registered by the this codec module, APIs can be executed from CLI, mod_event_socket, or many other interfaces
  * any information or actions you want to publish for users on demand is typically exposed through an API */
 SWITCH_STANDARD_API(skel_sayhi)
 /* static switch_status_t skel_sayhi(const char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream) */
@@ -168,20 +168,20 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skel_codec_load)
        /* the codec interface that will be registered with the core */
        switch_codec_interface_t *codec_interface;
 
-       /* the API interface, only needed if you wish to register APIs 
+       /* the API interface, only needed if you wish to register APIs
         * (like commands exposed through CLI, mod_event_socket or any other FS interface capable of executing APIs) */
        switch_api_interface_t *api_interface;
 
-       /* The core gives us a blank module interface pointer and a pool of memory, we allocate memory from that pool to create our module interface 
+       /* The core gives us a blank module interface pointer and a pool of memory, we allocate memory from that pool to create our module interface
         * and set the pointer to that chunk of allocated memory */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-       /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface list the core keeps, 
+       /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface list the core keeps,
         * gets a codec id and set the given codec name to it.
         * At this point there is an empty shell codec interface registered, but not yet implementations */
        SWITCH_ADD_CODEC(codec_interface, "SKEL 8.0k"); /* 8.0kbit */
 
-       /* Now add as many codec implementations as needed, typically this is done inside a for loop where the packetization size is 
+       /* Now add as many codec implementations as needed, typically this is done inside a for loop where the packetization size is
         * incremented (10ms, 20ms, 30ms etc) as needed */
        switch_core_codec_add_implementation(pool, codec_interface,     /* the codec interface we allocated and we want to register with the core */
                                                                                 SWITCH_CODEC_TYPE_AUDIO,       /* enumeration defining the type of the codec */
index 6cc40398567db6f956f02d467d1530120fd8f4f0..e1733d44fc4253d8eca544b9d185710230032c89 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index 0384e7af3e8c3522a0b8c54cb6b8379ed9cc157d..691b640a7832933f2f0cc0d84663c87b1dc1a458 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_dialplan_asterisk.c -- Asterisk extensions.conf style dialplan parser.
index 0997224dd810be4c72785cb5076632143e191a53..9865f6ef39c7a89da36dd5504686bec400376751 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index 6dba64121d9ca1fc87b7af8d5ec300af6b9bcbd8..005276dcd34e78e0d667342d289d8435ee4c09f5 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -93,9 +93,9 @@ static switch_status_t exec_app(switch_core_session_t *session, const char *app,
                } else {                                                                                                                \
                        tzoff = NULL;                                                                                           \
                }                                                                                                                               \
-       } while(tzoff)                                                                                                          
+       } while(tzoff)
 
-static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t xexten, 
+static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t xexten,
                                           switch_caller_extension_t **extension, const char *exten_name, int recur)
 {
        switch_xml_t xcond, xaction, xexpression, xregex;
@@ -131,7 +131,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
 
                switch_snprintf(nbuf, sizeof(nbuf), "%s_recur_%d", exten_name, recur);
                exten_name = nbuf;
-               
+
                space[j++] = '|';
 
                for (i = 0; i < recur; i++) {
@@ -143,17 +143,17 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                }
                        }
                }
-               
+
                if ((req_nesta = switch_xml_attr(xexten, "require-nested"))) {
                        req_nest = switch_true(req_nesta);
                }
 
                if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                  "%sDialplan: Processing recursive conditions level:%d [%s] require-nested=%s\n", space,
                                                  recur, exten_name, req_nest ? "TRUE" : "FALSE");
                } else {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
                                                  "%sDialplan: Processing recursive conditions level:%d [%s] require-nested=%s\n", space,
                                                  recur, exten_name, req_nest ? "TRUE" : "FALSE");
                }
@@ -197,7 +197,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                do_break_a = NULL;
                        }
                }
-               
+
                if (time_match == 1) {
                        if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
@@ -222,8 +222,8 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                        }
                        proceed = 0;
                }
-               
-               
+
+
                if ((regex_rule = (char *) switch_xml_attr(xcond, "regex"))) {
                        int all = !strcasecmp(regex_rule, "all");
                        int xor = !strcasecmp(regex_rule, "xor");
@@ -237,7 +237,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                int regex_time_match;
                                check_tz();
                                regex_time_match = switch_xml_std_datetime_check(xregex, tzoff ? &offset : NULL, tzname_);
-                               
+
                                if (regex_time_match == 1) {
                                        if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
@@ -266,17 +266,17 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                } else {
                                        expression = (char *) switch_xml_attr_soft(xregex, "expression");
                                }
-                               
+
                                if ((expression_expanded = switch_channel_expand_variables(channel, expression)) == expression) {
                                        expression_expanded = NULL;
                                } else {
                                        expression = expression_expanded;
                                }
-                               
+
                                total++;
-                               
+
                                field = (char *) switch_xml_attr(xregex, "field");
-                               
+
                                if (field) {
                                        if (strchr(field, '$')) {
                                                if ((field_expanded = switch_channel_expand_variables(channel, field)) == field) {
@@ -291,7 +291,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                        if (!field_data) {
                                                field_data = "";
                                        }
-                                       
+
                                        if ((proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
                                                if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
@@ -338,23 +338,23 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                        fail++;
                                        if (all) break;
                                }
-                               
+
                                if (field && strchr(expression, '(')) {
                                        char var[256];
                                        switch_snprintf(var, sizeof(var), "DP_REGEX_MATCH_%d", total);
 
                                        switch_channel_set_variable(channel, var, NULL);
                                        switch_capture_regex(re, proceed, field_data, ovector, var, switch_regex_set_var_callback, session);
-                                       
+
                                        switch_safe_free(save_expression);
                                        switch_safe_free(save_field_data);
                                        switch_regex_safe_free(save_re);
-                                       
+
                                        save_expression = strdup(expression);
                                        save_field_data = strdup(field_data);
                                        save_re = re;
                                        save_proceed = proceed;
-                                       
+
                                        re = NULL;
                                }
 
@@ -370,7 +370,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                                }
                        } else {
                                if ((all && !fail) || (!all && pass)) {
-                                       anti_action = SWITCH_FALSE; 
+                                       anti_action = SWITCH_FALSE;
                                }
                        }
 
@@ -388,7 +388,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                        } else {
                                expression = expression_expanded;
                        }
-                       
+
                        if (field) {
                                if (strchr(field, '$')) {
                                        if ((field_expanded = switch_channel_expand_variables(channel, field)) == field) {
@@ -445,7 +445,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
                if (save_re) {
                        re = save_re;
                        save_re = NULL;
-                       
+
                        expression = expression_expanded = save_expression;
                        save_expression = NULL;
                        field_data = field_expanded = save_field_data;
index 18e06be04698322a13a05bbfeec8b3ad5ed6e405..fd7bbd43c3d45490201657a32619debae4b233e7 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index f7d933b29e73346b485b6836498d77f6c12028c0..ecb7c53eb389656d7dd585489491f8778c66525b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -163,8 +163,8 @@ SWITCH_STANDARD_API(pa_cmd);
 
 
 
-/* 
-   State methods they get called when the state changes to the specific state 
+/*
+   State methods they get called when the state changes to the specific state
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
 */
index 72c29a9a5db136a2ac7bdce915c280c38bcc88e8..898b21345fdfcdd8ad309a93bdfac2cc46373cca 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -161,7 +161,7 @@ typedef struct mdl_transport {
        unsigned int ssrc;
 
        char local_user[17];
-    char local_pass[17];    
+    char local_pass[17];
        char *remote_user;
        char *remote_pass;
        int ptime;
@@ -170,18 +170,18 @@ typedef struct mdl_transport {
 
        switch_codec_t read_codec;
        switch_codec_t write_codec;
-       
+
        switch_frame_t read_frame;
-       
+
        uint32_t codec_rate;
        char *codec_name;
-       
+
        switch_payload_t codec_num;
        switch_payload_t r_codec_num;
-       
+
        char *stun_ip;
        uint16_t stun_port;
-       
+
        switch_rtp_t *rtp_session;
        ldl_transport_type_t type;
 
@@ -206,9 +206,9 @@ typedef struct mdl_transport {
 
        char *local_crypto_key;
        char *remote_crypto_key;
-       
+
        ldl_crypto_data_t *local_crypto_data;
-       
+
 } mdl_transport_t;
 
 
@@ -224,7 +224,7 @@ struct private_object {
        const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
        unsigned int num_codecs;
 
-       mdl_transport_t transports[LDL_TPORT_MAX+1];    
+       mdl_transport_t transports[LDL_TPORT_MAX+1];
 
        ldl_session_t *dlsession;
 
@@ -331,7 +331,7 @@ static switch_cache_db_handle_t *mdl_get_db_handle(mdl_profile_t *profile)
 {
        switch_cache_db_handle_t *dbh = NULL;
        char *dsn;
-       
+
        if (!zstr(profile->odbc_dsn)) {
                dsn = profile->odbc_dsn;
        } else {
@@ -341,7 +341,7 @@ static switch_cache_db_handle_t *mdl_get_db_handle(mdl_profile_t *profile)
        if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) {
                dbh = NULL;
        }
-       
+
        return dbh;
 
 }
@@ -598,9 +598,9 @@ static switch_status_t chat_send(switch_event_t *message_event)
        char *user = NULL, *host, *f_user = NULL, *ffrom = NULL, *f_host = NULL, *f_resource = NULL;
        mdl_profile_t *profile = NULL;
        const char *proto;
-       const char *from; 
-       const char *from_full; 
-       const char *to_full; 
+       const char *from;
+       const char *from_full;
+       const char *to_full;
        const char *to;
        const char *body;
        const char *hint;
@@ -617,7 +617,7 @@ static switch_status_t chat_send(switch_event_t *message_event)
        profile_name = switch_event_get_header(message_event, "ldl_profile");
 
        switch_assert(proto != NULL);
-       
+
        if (from && (f_user = strdup(from))) {
                if ((f_host = strchr(f_user, '@'))) {
                        *f_host++ = '\0';
@@ -644,13 +644,13 @@ static switch_status_t chat_send(switch_event_t *message_event)
                                from = hint;
                        } else {
                                char *p;
-                               
+
                                if (!(profile->user_flags & LDL_FLAG_COMPONENT)) {
                                        from = ffrom = strdup(profile->login);
                                } else {
                                        from = ffrom = switch_mprintf("%s+%s", proto, from);
                                }
-                               
+
                                if ((p = strchr(from, '/'))) {
                                        *p = '\0';
                                }
@@ -943,14 +943,14 @@ static int get_codecs(struct private_object *tech_pvt)
                        codec_order_last = globals.codec_order_last;
                        codec_order_p = globals.codec_order;
                }
-               
+
                if (codec_string) {
                        if ((tech_pvt->num_codecs = switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, NULL,
                                                                                                                                                                 SWITCH_MAX_CODECS, codec_order_p, codec_order_last)) <= 0) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
                                return 0;
                        }
-                       
+
                } else if (((tech_pvt->num_codecs = switch_loadable_module_get_codecs(tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
                        return 0;
@@ -994,7 +994,7 @@ static void handle_thread_launch(ldl_handle_t *handle)
 }
 
 
-switch_status_t mdl_build_crypto(struct private_object *tech_pvt, ldl_transport_type_t ttype, 
+switch_status_t mdl_build_crypto(struct private_object *tech_pvt, ldl_transport_type_t ttype,
                                                                        int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction)
 {
        unsigned char b64_key[512] = "";
@@ -1043,7 +1043,7 @@ switch_status_t mdl_build_crypto(struct private_object *tech_pvt, ldl_transport_
 }
 
 
-static switch_status_t mdl_add_crypto(struct private_object *tech_pvt, 
+static switch_status_t mdl_add_crypto(struct private_object *tech_pvt,
                                                                          ldl_transport_type_t ttype, const char *key_str, switch_rtp_crypto_direction_t direction)
 {
        unsigned char key[SWITCH_RTP_MAX_CRYPTO_LEN];
@@ -1083,11 +1083,11 @@ static switch_status_t mdl_add_crypto(struct private_object *tech_pvt,
                                memcpy(tech_pvt->transports[ttype].remote_raw_key, key, SWITCH_RTP_KEY_LEN);
                        }
 
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE,
                                                          "%s Setting %s crypto key\n", ldl_transport_type_str(ttype), switch_core_session_get_name(tech_pvt->session));
                        tech_pvt->transports[ttype].has_crypto++;
 
-                       
+
                        return SWITCH_STATUS_SUCCESS;
                }
 
@@ -1100,7 +1100,7 @@ static switch_status_t mdl_add_crypto(struct private_object *tech_pvt,
 
 }
 
-static void try_secure(struct private_object *tech_pvt, ldl_transport_type_t ttype) 
+static void try_secure(struct private_object *tech_pvt, ldl_transport_type_t ttype)
 {
 
        if (!switch_test_flag(tech_pvt, TFLAG_SECURE)) {
@@ -1114,19 +1114,19 @@ static void try_secure(struct private_object *tech_pvt, ldl_transport_type_t tty
 
 
        if (tech_pvt->transports[ttype].crypto_type) {
-               switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, 
-                                                                 SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->transports[ttype].crypto_type, 
+               switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session,
+                                                                 SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->transports[ttype].crypto_type,
                                                                  tech_pvt->transports[ttype].local_raw_key, SWITCH_RTP_KEY_LEN);
-                       
 
-               switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, 
-                                                                 SWITCH_RTP_CRYPTO_RECV, tech_pvt->transports[ttype].crypto_tag, 
-                                                                 tech_pvt->transports[ttype].crypto_type, 
+
+               switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session,
+                                                                 SWITCH_RTP_CRYPTO_RECV, tech_pvt->transports[ttype].crypto_tag,
+                                                                 tech_pvt->transports[ttype].crypto_type,
                                                                  tech_pvt->transports[ttype].remote_raw_key, SWITCH_RTP_KEY_LEN);
-                       
+
                switch_channel_set_variable(tech_pvt->channel, "jingle_secure_audio_confirmed", "true");
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE,
                                                  "%s %s crypto confirmed\n", ldl_transport_type_str(ttype), switch_core_session_get_name(tech_pvt->session));
 
                }
@@ -1203,7 +1203,7 @@ static int activate_audio_rtp(struct private_object *tech_pvt)
                tech_pvt->transports[LDL_TPORT_RTP].write_codec.session = tech_pvt->session;
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Write Codec to %s@%d\n",
                                                  tech_pvt->transports[LDL_TPORT_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_RTP].write_codec.implementation->samples_per_second);
-               
+
                switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].read_codec);
                switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].write_codec);
        }
@@ -1221,23 +1221,23 @@ static int activate_audio_rtp(struct private_object *tech_pvt)
        }
 
        if (tech_pvt->transports[LDL_TPORT_RTP].adv_local_port != tech_pvt->transports[LDL_TPORT_RTP].local_port) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n",
                                                  tech_pvt->profile->ip,
-                                                 tech_pvt->transports[LDL_TPORT_RTP].local_port, 
-                                                 tech_pvt->transports[LDL_TPORT_RTP].adv_local_port, 
-                                                 tech_pvt->transports[LDL_TPORT_RTP].remote_ip, 
+                                                 tech_pvt->transports[LDL_TPORT_RTP].local_port,
+                                                 tech_pvt->transports[LDL_TPORT_RTP].adv_local_port,
+                                                 tech_pvt->transports[LDL_TPORT_RTP].remote_ip,
                                                  tech_pvt->transports[LDL_TPORT_RTP].remote_port,
                                                  tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->iananame,
                                                  tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->ianacode,
                                                  tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet,
                                                  tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->microseconds_per_packet
-                                                 
+
                                                  );
        } else {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n",
                                                  tech_pvt->profile->ip,
-                                                 tech_pvt->transports[LDL_TPORT_RTP].local_port, 
-                                                 tech_pvt->transports[LDL_TPORT_RTP].remote_ip, 
+                                                 tech_pvt->transports[LDL_TPORT_RTP].local_port,
+                                                 tech_pvt->transports[LDL_TPORT_RTP].remote_ip,
                                                  tech_pvt->transports[LDL_TPORT_RTP].remote_port,
                                                  tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->iananame,
                                                  tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->ianacode,
@@ -1283,20 +1283,20 @@ static int activate_audio_rtp(struct private_object *tech_pvt)
 
 
                if (tech_pvt->transports[LDL_TPORT_RTCP].remote_port) {
-                       switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, MDL_RTCP_DUR, 
+                       switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, MDL_RTCP_DUR,
                                                                         tech_pvt->transports[LDL_TPORT_RTCP].remote_port, SWITCH_FALSE);
 
                }
 
                try_secure(tech_pvt, LDL_TPORT_RTP);
 
-               switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 
-                                                               tech_pvt->transports[LDL_TPORT_RTP].remote_user, 
+               switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session,
+                                                               tech_pvt->transports[LDL_TPORT_RTP].remote_user,
                                                                tech_pvt->transports[LDL_TPORT_RTP].local_user,
-                                                               tech_pvt->transports[LDL_TPORT_RTP].remote_pass, NULL, 
+                                                               tech_pvt->transports[LDL_TPORT_RTP].remote_pass, NULL,
                                                                IPR_RTP,
                                                                ICE_GOOGLE_JINGLE, 0);
-               
+
                if ((vad_in && inb) || (vad_out && !inb)) {
                        if (switch_rtp_enable_vad(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].read_codec, SWITCH_VAD_FLAG_TALKING) != SWITCH_STATUS_SUCCESS) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "VAD ERROR %s\n", err);
@@ -1308,18 +1308,18 @@ static int activate_audio_rtp(struct private_object *tech_pvt)
                }
                //switch_rtp_set_cng_pt(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 13);
                switch_rtp_set_telephony_event(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 101);
-               
+
                if (tech_pvt->transports[LDL_TPORT_RTCP].remote_port) {
-                       switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 
-                                                                       tech_pvt->transports[LDL_TPORT_RTCP].remote_user, 
+                       switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session,
+                                                                       tech_pvt->transports[LDL_TPORT_RTCP].remote_user,
                                                                        tech_pvt->transports[LDL_TPORT_RTCP].local_user,
-                                                                       tech_pvt->transports[LDL_TPORT_RTCP].remote_pass, 
+                                                                       tech_pvt->transports[LDL_TPORT_RTCP].remote_pass,
                                                                        NULL, IPR_RTCP,
                                                                        ICE_GOOGLE_JINGLE, 0);
-                       
+
                }
 
-               
+
 
        }
 
@@ -1341,7 +1341,7 @@ static int activate_video_rtp(struct private_object *tech_pvt)
        switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0};
        int r = 1, locked = 0;
 
-       
+
        if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) {
                        r = 1; goto end;
        }
@@ -1353,7 +1353,7 @@ static int activate_video_rtp(struct private_object *tech_pvt)
 
        if (zstr(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No valid video_rtp codecs received!\n");
-               r = 0; goto end;                
+               r = 0; goto end;
        }
 
        if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec)) {
@@ -1418,23 +1418,23 @@ static int activate_video_rtp(struct private_object *tech_pvt)
 
 
        if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port != tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n",
                                                  tech_pvt->profile->ip,
-                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, 
-                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port, 
-                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, 
+                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port,
+                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port,
+                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip,
                                                  tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port,
                                                  tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->iananame,
                                                  tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->ianacode,
                                                  tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_packet,
                                                  tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->microseconds_per_packet
-                                                 
+
                                                  );
        } else {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n",
                                                  tech_pvt->profile->ip,
-                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, 
-                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, 
+                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port,
+                                                 tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip,
                                                  tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port,
                                                  tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->iananame,
                                                  tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->ianacode,
@@ -1468,32 +1468,32 @@ static int activate_video_rtp(struct private_object *tech_pvt)
                switch_rtp_set_ssrc(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc);
 
                if (tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port) {
-                       switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, MDL_RTCP_DUR, 
+                       switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, MDL_RTCP_DUR,
                                                                         tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port, SWITCH_FALSE);
                }
                try_secure(tech_pvt, LDL_TPORT_VIDEO_RTP);
 
 
-               switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, 
-                                                               tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_user, 
+               switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session,
+                                                               tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_user,
                                                                tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_user,
                                                                NULL, NULL, IPR_RTP, ICE_GOOGLE_JINGLE, 0);//tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_pass);
                switch_channel_set_flag(channel, CF_VIDEO);
                switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY);
                //switch_rtp_set_default_payload(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num);
                //switch_rtp_set_recv_pt(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num);
-               
+
 
                if (tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port) {
-                       
-                       switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, 
-                                                                       tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_user, 
+
+                       switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session,
+                                                                       tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_user,
                                                                        tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].local_user,
                                                                        NULL, NULL, IPR_RTCP, ICE_GOOGLE_JINGLE, 0);//tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_pass);
                }
 
 
-               
+
        }
 
  end:
@@ -1529,7 +1529,7 @@ static int do_tport_candidates(struct private_object *tech_pvt, ldl_transport_ty
        switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
        char *advip = tech_pvt->profile->extip ? tech_pvt->profile->extip : tech_pvt->profile->ip;
        char *err = NULL, *address = NULL;
-       
+
        if (!force && tech_pvt->transports[ttype].ready) {
                return 0;
        }
@@ -1594,14 +1594,14 @@ static int do_tport_candidates(struct private_object *tech_pvt, ldl_transport_ty
        cand->password = tech_pvt->transports[ttype].local_pass;
        cand->pref = 1;
        cand->protocol = "udp";
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
                                          "Send %s Candidate %s:%d [%s]\n", ldl_transport_type_str(ttype), cand->address, cand->port,
                                          cand->username);
 
 
-               
+
        tech_pvt->transports[ttype].ready = 1;
-       
+
        return 1;
 }
 
@@ -1637,15 +1637,15 @@ static int do_candidates(struct private_object *tech_pvt, int force)
                }
        }
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtp candidates.\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtp candidates.\n",
                                          tech_pvt->transports[LDL_TPORT_RTP].accepted, tech_pvt->transports[LDL_TPORT_RTP].total);
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtcp candidates.\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtcp candidates.\n",
                                          tech_pvt->transports[LDL_TPORT_RTCP].accepted, tech_pvt->transports[LDL_TPORT_RTCP].total);
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rtp candidates\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rtp candidates\n",
                                          tech_pvt->transports[LDL_TPORT_VIDEO_RTP].accepted, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].total);
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rctp candidates\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rctp candidates\n",
                                          tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted, tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].total);
 
 
@@ -1691,9 +1691,9 @@ static void setup_codecs(struct private_object *tech_pvt)
                        dft_video = idx;
                }
        }
-       
+
        if (dft_audio == -1 && dft_video == -1) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Cannot find a codec.\n");  
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Cannot find a codec.\n");
                return;
        }
 
@@ -1745,7 +1745,7 @@ static void setup_codecs(struct private_object *tech_pvt)
                        payloads[1].width = 600;
                        payloads[1].height = 400;
                        payloads[1].framerate = 30;
-                       
+
                        idx++;
                } else {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have video codec.\n");
@@ -1771,8 +1771,8 @@ static void setup_codecs(struct private_object *tech_pvt)
 
        tech_pvt->desc_id = ldl_session_describe(tech_pvt->dlsession, payloads, idx,
                                                                                         switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT,
-                                                                                        &tech_pvt->transports[LDL_TPORT_RTP].ssrc, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc, 
-                                                                                        tech_pvt->transports[LDL_TPORT_RTP].local_crypto_data, 
+                                                                                        &tech_pvt->transports[LDL_TPORT_RTP].ssrc, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc,
+                                                                                        tech_pvt->transports[LDL_TPORT_RTP].local_crypto_data,
                                                                                         tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_crypto_data);
 
 
@@ -1885,7 +1885,7 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
 
                if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) {
                        switch_rtp_ping(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session);
-               }               
+               }
 
                switch_yield(20000);
        }
@@ -1908,7 +1908,7 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
        }
        ret = SWITCH_STATUS_SUCCESS;
 
-       switch_channel_audio_sync(channel); 
+       switch_channel_audio_sync(channel);
 
 
        goto done;
@@ -1920,8 +1920,8 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
        return ret;
 }
 
-/* 
-   State methods they get called when the state changes to the specific state 
+/*
+   State methods they get called when the state changes to the specific state
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
 */
@@ -2028,7 +2028,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
 
                if (tech_pvt->profile) {
                        switch_thread_rwlock_unlock(tech_pvt->profile->rwlock);
-                       
+
                        if (tech_pvt->profile->purge) {
                                mdl_profile_t *profile = tech_pvt->profile;
                                if (switch_core_hash_delete(globals.profile_hash, profile->name)) {
@@ -2074,7 +2074,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
                ldl_session_terminate(tech_pvt->dlsession);
                switch_set_flag_locked(tech_pvt, TFLAG_TERM);
        }
-       
+
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
 
@@ -2172,7 +2172,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
 
        if (switch_test_flag(tech_pvt, TFLAG_IO)) {
                //switch_status_t status;
-               
+
                switch_assert(tech_pvt->transports[LDL_TPORT_RTP].rtp_session != NULL);
                tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen = 0;
 
@@ -2302,7 +2302,7 @@ static switch_status_t channel_read_video_frame(switch_core_session_t *session,
 
        tech_pvt = (struct private_object *) switch_core_session_get_private(session);
        switch_assert(tech_pvt != NULL);
-       
+
        if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
                return SWITCH_STATUS_GENERR;
        }
@@ -2314,9 +2314,9 @@ static switch_status_t channel_read_video_frame(switch_core_session_t *session,
                        return SWITCH_STATUS_GENERR;
                }
        }
-       
+
        tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen = 0;
-       
+
        while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen == 0) {
                tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.flags = SFF_NONE;
                switch_rtp_zerocopy_read_frame(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame, flags);
@@ -2328,7 +2328,7 @@ static switch_status_t channel_read_video_frame(switch_core_session_t *session,
        }
 
        *frame = &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -2702,7 +2702,7 @@ static switch_status_t list_profiles(const char *line, const char *cursor, switc
                        }
                } else {
                        switch_console_push_match(&my_matches, profile->name);
-               } 
+               }
        }
 
        if (my_matches) {
@@ -3220,13 +3220,13 @@ static switch_bool_t match_profile(mdl_profile_t *profile, mdl_profile_t *new_pr
                (new_profile->user_flags == profile->user_flags) && (new_profile->acl_count == profile->acl_count)
                ) {
                uint32_t i;
-               
+
                if (!(((!new_profile->odbc_dsn && !profile->odbc_dsn) ||
-                          (new_profile->odbc_dsn && profile->odbc_dsn && !strcasecmp(new_profile->odbc_dsn, profile->odbc_dsn))) 
+                          (new_profile->odbc_dsn && profile->odbc_dsn && !strcasecmp(new_profile->odbc_dsn, profile->odbc_dsn)))
                          )) {
                        return SWITCH_FALSE;
                }
-               
+
 
                for (i = 0; i < new_profile->acl_count; i++) {
                        if (strcasecmp(new_profile->acl[i], profile->acl[i]) != 0) {
@@ -3560,9 +3560,9 @@ static void do_vcard(ldl_handle_t *handle, char *to, char *from, char *id)
        switch_safe_free(xmlstr);
 }
 
-static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session_t *session, ldl_transport_type_t ttype, const char *subject) 
+static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session_t *session, ldl_transport_type_t ttype, const char *subject)
 {
-       
+
        ldl_candidate_t *candidates;
        unsigned int len = 0;
        unsigned int x, choice = 0, ok = 0;
@@ -3598,12 +3598,12 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session
                        }
 
                        for (y = 0; y < tech_pvt->profile->acl_count; y++) {
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
+
                                if (switch_check_network_list_ip(candidates[x].address, tech_pvt->profile->acl[y])) {
                                        choice = x;
                                        ok = 1;
                                }
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
+
                                if (ok) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n",
                                                                          candidates[x].address, candidates[x].port, tech_pvt->profile->acl[y]);
@@ -3616,13 +3616,13 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session
                }
        } else {
                for (x = 0; x < len; x++) {
-                       
+
 
                        if (tech_pvt->profile->lanaddr) {
                                lanaddr = strncasecmp(candidates[x].address, tech_pvt->profile->lanaddr, strlen(tech_pvt->profile->lanaddr)) ? 0 : 1;
                        }
 
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s candidates %s:%d\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s candidates %s:%d\n",
                                                          ldl_transport_type_str(ttype), candidates[x].address,
                                                          candidates[x].port);
 
@@ -3655,7 +3655,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session
 
 
  end_candidates:
-       
+
        if (ok) {
                ldl_payload_t payloads[5];
                char *key;
@@ -3664,7 +3664,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session
 
 
                if (tech_pvt->transports[ttype].accepted) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already Accepted [%s:%d]\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already Accepted [%s:%d]\n",
                                                          tech_pvt->transports[ttype].remote_ip, tech_pvt->transports[ttype].remote_port);
                        //goto end;
                }
@@ -3675,7 +3675,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session
                        //goto end;
                }
 
-               
+
                memset(payloads, 0, sizeof(payloads));
 
                tech_pvt->transports[ttype].accepted++;
@@ -3693,7 +3693,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session
                                tech_pvt->transports[ttype].crypto_type = 0;
                        }
                }
-               
+
                if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
                        switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
                        //ldl_session_accept_candidate(dlsession, &candidates[choice]);
@@ -3758,7 +3758,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session
 }
 
 
-static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_session_t *session, 
+static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_session_t *session,
                                                                                ldl_transport_type_t ttype, ldl_payload_t *payloads, unsigned int len)
 {
        struct private_object *tech_pvt = NULL;
@@ -3766,7 +3766,7 @@ static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_sess
        unsigned int x, y;
        int match = 0;
 
-       tech_pvt = switch_core_session_get_private(session);    
+       tech_pvt = switch_core_session_get_private(session);
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%u payloads\n", len);
        for (x = 0; x < len; x++) {
@@ -3775,7 +3775,7 @@ static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_sess
                for (y = 0; y < tech_pvt->num_codecs; y++) {
                        char *name = tech_pvt->codecs[y]->iananame;
 
-                       if ((ttype == LDL_TPORT_VIDEO_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_VIDEO) || 
+                       if ((ttype == LDL_TPORT_VIDEO_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_VIDEO) ||
                                (ttype == LDL_TPORT_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_AUDIO)) {
                                continue;
                        }
@@ -3792,10 +3792,10 @@ static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_sess
                        } else {
                                match = (payloads[x].id == tech_pvt->codecs[y]->ianacode) ? 1 : 0;
                        }
-                                               
+
                        if (match && payloads[x].rate == tech_pvt->codecs[y]->samples_per_second) {
                                tech_pvt->transports[ttype].codec_index = y;
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Choosing %s Payload index %u %s %u\n", 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Choosing %s Payload index %u %s %u\n",
                                                                  ldl_transport_type_str(ttype),
                                                                  y,
                                                                  payloads[x].name, payloads[x].id);
@@ -3841,7 +3841,7 @@ static ldl_status parse_payloads(ldl_session_t *dlsession, switch_core_session_t
 
        tech_pvt = switch_core_session_get_private(session);
 
-       
+
        if ((status = parse_payloads_type(dlsession, session, LDL_TPORT_RTP, payloads, len)) == LDL_STATUS_SUCCESS) {
                match++;
        }
@@ -3863,7 +3863,7 @@ static ldl_status parse_payloads(ldl_session_t *dlsession, switch_core_session_t
        return status;
 
 }
-               
+
 
 static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject,
                                                                        char *msg)
@@ -4060,21 +4060,21 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", hint);
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", hint);
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "ldl_profile", profile->name);
-                                       
+
                                        if (msg) {
                                                switch_event_add_body(event, "%s", msg);
                                        }
                                } else {
                                        abort();
                                }
-                               
+
                                switch_safe_free(from_user);
 
                                if (!zstr(msg)) {
                                        if (strcasecmp(proto, MDL_CHAT_PROTO)) { /* yes no ! on purpose */
                                                switch_core_chat_send(proto, event);
                                        }
-                                       
+
                                        switch_core_chat_send("GLOBAL", event);
                                }
 
@@ -4237,15 +4237,15 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
                                if (switch_stristr("voice.google.com", from)) {
                                        char *id = switch_core_session_strdup(session, from);
                                        char *p;
-                                       
+
                                        if ((p = strchr(id, '@'))) {
                                                *p++ = '\0';
                                                cid_name = "Google Voice";
                                                cid_num = id;
                                        }
-                                       
+
                                        ldl_session_set_gateway(dlsession);
-                                       
+
                                        do_candidates(tech_pvt, 1);
                                }
 
@@ -4289,7 +4289,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
 
                                        switch_safe_free(tmp);
                                }
-                               
+
                                if (!tech_pvt->caller_profile) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                          "Creating an identity for %s %s <%s> %s\n", ldl_session_get_id(dlsession), cid_name, cid_num, exten);
@@ -4321,7 +4321,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
                        }
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating a session for %s\n", ldl_session_get_id(dlsession));
                        ldl_session_set_private(dlsession, session);
-                       
+
                        switch_channel_set_name(channel, "DingaLing/new");
                        switch_channel_set_state(channel, CS_INIT);
                        if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
@@ -4395,7 +4395,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
                if (dl_signal) {
                        ldl_payload_t *payloads;
                        unsigned int len = 0;
-                       
+
                        if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
                                if (msg && !strcasecmp(msg, "accept")) {
                                        switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
@@ -4433,9 +4433,9 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
                        status = LDL_STATUS_SUCCESS;
 
                        status = parse_candidates(dlsession, session, LDL_TPORT_RTP, subject);
-                       status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTP, subject); 
+                       status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTP, subject);
                        status = parse_candidates(dlsession, session, LDL_TPORT_RTCP, subject);
-                       status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTCP, subject); 
+                       status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTCP, subject);
                }
 
                break;
index 80bee58265a382070eac4f9a4b1061dc397ca8aa..75f62148e3b393538a11c9161a5686b9cc7acfee 100644 (file)
@@ -219,7 +219,7 @@ struct GSMopenHandles {
 
 #endif //WIN32
 
-/*! 
+/*!
  * \brief structure for storing the results of AT commands, in an array of AT_MESG_MAX_LINES * AT_MESG_MAX_LENGTH chars
  */
 struct s_result {
index eb2e8c75d5933e285da2cdd56e4676490c61977d..bfd465501a10c1a610709e2c8b55337a9a680239 100644 (file)
@@ -1086,7 +1086,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
                                } else if (option_debug) {
                                        DEBUGA_GSMOPEN("|%s| +CNUM: Subscriber number = %s, Type = %d\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i], number, type);
                                }
-                               
+
                                /* Copy only the first number listed if there are more then one */
                                if (tech_pvt->requesting_subscriber_number && !strlen(tech_pvt->subscriber_number))
                                        strncpy(tech_pvt->subscriber_number, number, sizeof(tech_pvt->subscriber_number));
@@ -1496,8 +1496,8 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
 
                                        //identifying dcs alphabet according to GSM 03.38 Cell Broadcast Data Coding Scheme
                                        //CBDataCodingScheme should be used here, but it appears to be buggy (ucs2 messages are not recognized)
-                                       int alphabet = DCS_RESERVED_ALPHABET;  
-                                       if (dcs == 0x11) { 
+                                       int alphabet = DCS_RESERVED_ALPHABET;
+                                       if (dcs == 0x11) {
                                                alphabet = DCS_SIXTEEN_BIT_ALPHABET;
                                        } else if ((dcs & 0xF0) <= 0x30){
                                                alphabet = DCS_DEFAULT_ALPHABET;
@@ -1531,7 +1531,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
                                                ERRORA("USSD data coding scheme not supported=%d\n", GSMOPEN_P_LOG, dcs);
                                        }
 
-                                       NOTICA("USSD received: status=%d, message='%s', dcs='%d'\n", 
+                                       NOTICA("USSD received: status=%d, message='%s', dcs='%d'\n",
                                                GSMOPEN_P_LOG, tech_pvt->ussd_status, tech_pvt->ussd_message, dcs);
 
                                        ussd_incoming(tech_pvt);
@@ -1841,7 +1841,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
 #if 0
                                                        char letsee[1024];
                                                        memset(letsee, '\0', sizeof(letsee));
-       
+
                                                        DEBUGA_GSMOPEN("about to letsee\n", GSMOPEN_P_LOG);
                                                        try {
                                                                sprintf(letsee, "|%s|\n", sms->toString().c_str());
@@ -1852,7 +1852,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
                                                                return -1;
                                                        }
                                                        DEBUGA_GSMOPEN("after letsee\n", GSMOPEN_P_LOG);
-                                               
+
                                                        DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, letsee);
 #endif //0
                                                        memset(content2, '\0', sizeof(content2));
@@ -3041,7 +3041,7 @@ int gsmopen_ussd(private_t *tech_pvt, char *ussd, int waittime)
 
                memset(at_command, '\0', sizeof(at_command));
                tech_pvt->ussd_received = 0;
-               if (tech_pvt->ussd_request_encoding == USSD_ENCODING_PLAIN  
+               if (tech_pvt->ussd_request_encoding == USSD_ENCODING_PLAIN
                                        ||tech_pvt->ussd_request_encoding == USSD_ENCODING_AUTO) {
                        snprintf(at_command, sizeof(at_command), "AT+CUSD=1,\"%s\",15", ussd_enc.c_str());
                        res = gsmopen_serial_write_AT_ack(tech_pvt, at_command);
@@ -3058,7 +3058,7 @@ int gsmopen_ussd(private_t *tech_pvt, char *ussd, int waittime)
                        snprintf(at_command, sizeof(at_command), "AT+CUSD=1,\"%s\",15", ussd_hex.c_str());
                        res = gsmopen_serial_write_AT_ack(tech_pvt, at_command);
                } else if (tech_pvt->ussd_request_encoding == USSD_ENCODING_HEX_8BIT) {
-                       string ussd_h8 = bufToHex((const unsigned char*)ussd_enc.c_str(), ussd_enc.length()); 
+                       string ussd_h8 = bufToHex((const unsigned char*)ussd_enc.c_str(), ussd_enc.length());
                        snprintf(at_command, sizeof(at_command), "AT+CUSD=1,\"%s\",15", ussd_h8.c_str());
                        res = gsmopen_serial_write_AT_ack(tech_pvt, at_command);
                } else if (tech_pvt->ussd_request_encoding == USSD_ENCODING_UCS2) {
index afd09931594dd8a08a72acd3b9ff9d2ba7b7a928..20697adda4f3e79bc73786ca62bf9910525cecba 100644 (file)
@@ -259,7 +259,7 @@ static switch_status_t list_interfaces(const char *line, const char *cursor, swi
                *matches = my_matches;
                status = SWITCH_STATUS_SUCCESS;
        }
-       
+
        return status;
 }
 
@@ -1261,7 +1261,7 @@ static switch_status_t load_config(int reload_type)
                        //int controldevice_audio_speed = 115200;       //FIXME TODO
                        uint32_t controldevprotocol = PROTOCOL_AT;      //FIXME TODO
                        const char *gsmopen_serial_sync_period = "300"; //FIXME TODO
-                       const char *imei = "";  
+                       const char *imei = "";
                        const char *imsi = "";
 
                        tech_pvt = NULL;
@@ -1580,15 +1580,15 @@ static switch_status_t load_config(int reload_type)
                                globals.GSMOPEN_INTERFACES[interface_id].gsmopen_serial_sync_period = atoi(gsmopen_serial_sync_period);
 
                                globals.GSMOPEN_INTERFACES[interface_id].ussd_request_encoding =
-                                       strcasecmp(ussd_request_encoding, "plain") == 0 ? USSD_ENCODING_PLAIN : 
-                                       strcasecmp(ussd_request_encoding, "hex7") == 0 ? USSD_ENCODING_HEX_7BIT : 
-                                       strcasecmp(ussd_request_encoding, "hex8") == 0 ? USSD_ENCODING_HEX_8BIT : 
+                                       strcasecmp(ussd_request_encoding, "plain") == 0 ? USSD_ENCODING_PLAIN :
+                                       strcasecmp(ussd_request_encoding, "hex7") == 0 ? USSD_ENCODING_HEX_7BIT :
+                                       strcasecmp(ussd_request_encoding, "hex8") == 0 ? USSD_ENCODING_HEX_8BIT :
                                        strcasecmp(ussd_request_encoding, "ucs2") == 0 ? USSD_ENCODING_UCS2 : USSD_ENCODING_AUTO;
 
                                globals.GSMOPEN_INTERFACES[interface_id].ussd_response_encoding =
-                                       strcasecmp(ussd_response_encoding, "plain") == 0 ? USSD_ENCODING_PLAIN : 
-                                       strcasecmp(ussd_response_encoding, "hex7") == 0 ? USSD_ENCODING_HEX_7BIT : 
-                                       strcasecmp(ussd_response_encoding, "hex8") == 0 ? USSD_ENCODING_HEX_8BIT : 
+                                       strcasecmp(ussd_response_encoding, "plain") == 0 ? USSD_ENCODING_PLAIN :
+                                       strcasecmp(ussd_response_encoding, "hex7") == 0 ? USSD_ENCODING_HEX_7BIT :
+                                       strcasecmp(ussd_response_encoding, "hex8") == 0 ? USSD_ENCODING_HEX_8BIT :
                                        strcasecmp(ussd_response_encoding, "ucs2") == 0 ? USSD_ENCODING_UCS2 : USSD_ENCODING_AUTO;
 
                                globals.GSMOPEN_INTERFACES[interface_id].controldevice_speed = controldevice_speed;     //FIXME
@@ -2224,7 +2224,7 @@ private_t *find_available_gsmopen_interface_rr(private_t *tech_pvt_calling)
                                switch_mutex_unlock(globals.mutex);
                                return tech_pvt;
                        }
-               }                                               
+               }
        }
 
        switch_mutex_unlock(globals.mutex);
@@ -2757,7 +2757,7 @@ SWITCH_STANDARD_API(gsmopen_ussd_function)
                stream->write_function(stream, "ERROR, usage: %s", USSD_SYNTAX);
                goto end;
        }
-       
+
        if (argc >= 3 && strcasecmp(argv[2], "nowait")==0) {
                waittime = 0;
        }
@@ -2794,10 +2794,10 @@ SWITCH_STANDARD_API(gsmopen_ussd_function)
                                stream->write_function(stream, "ERROR: no response received\n");
                        } else {
                                stream->write_function(stream, "Status: %d%s\n", tech_pvt->ussd_status,
-                               tech_pvt->ussd_status == 0 ? " - completed" : 
-                               tech_pvt->ussd_status == 1 ? " - action required" : 
+                               tech_pvt->ussd_status == 0 ? " - completed" :
+                               tech_pvt->ussd_status == 1 ? " - action required" :
                                tech_pvt->ussd_status == 2 ? " - error" : "");
-                               if (strlen(tech_pvt->ussd_message) != 0) 
+                               if (strlen(tech_pvt->ussd_message) != 0)
                                        stream->write_function(stream, "Text: %s\n", tech_pvt->ussd_message);
                        }
                }
index 4f4c1128571e8dea03d5f3d0ac2046e0bf2b21bf..8816252aea4685fb61ce4701eeec9ff9a2a2b897 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * H323 endpoint interface for Freeswitch Modular Media Switching Software Library /
  * Soft-Switch Application
  *
@@ -19,9 +19,9 @@
  *
  * Contributor(s):
  * Jan Willamowius.
- * 
- * 
- * 
+ *
+ *
+ *
  *
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
@@ -207,7 +207,7 @@ void h_timer(unsigned sec)
 #else
        timeval timeout;
        timeout.tv_sec = sec;
-       timeout.tv_usec = 0; 
+       timeout.tv_usec = 0;
        select(0, NULL, NULL, NULL, &timeout);
 #endif
 }
@@ -255,7 +255,7 @@ class FSTrace : public ostream {
                 *pptr() = (char)c;
                 bufSize++;
             }
-            
+
             if (bufSize != 0) {
                 char *bufPtr = pbase();
                 char *bufEndPtr = NULL;
@@ -263,11 +263,11 @@ class FSTrace : public ostream {
                 bufPtr[bufSize] = '\0';
                 int line = 0;
                 char *p;
-                
+
                 char *file = NULL;
                 switch_log_level_t level;
 
-                
+
                 switch (strtoul(bufPtr, &file, 10)) {
                 case 1 :
                     level = SWITCH_LOG_INFO;
@@ -279,7 +279,7 @@ class FSTrace : public ostream {
 
                 if (file) {
                     while (isspace(*file)) file++;
-                    
+
                     if (file && (bufPtr = strchr(file, '(')) && (bufEndPtr = strchr(bufPtr, ')'))) {
                         char *e;
 
@@ -300,7 +300,7 @@ class FSTrace : public ostream {
                         }
                     }
                 }
-                
+
                 switch_text_channel_t tchannel = SWITCH_CHANNEL_ID_LOG;
 
                 if (!bufPtr) {
@@ -316,7 +316,7 @@ class FSTrace : public ostream {
 
                     switch_log_printf(tchannel, file, func, line, NULL, level, fmt, bufPtr);
                 }
-                
+
             }
 
             return 0;
@@ -352,7 +352,7 @@ PString GetH245CodecName(const H323Capability* cap)
                case H245_AudioCapability::e_gsmFullRate:
                case H245_AudioCapability::e_gsmHalfRate:
                case H245_AudioCapability::e_gsmEnhancedFullRate:
-                       return "GSM";   
+                       return "GSM";
        }
        return "L16";
 }
@@ -369,7 +369,7 @@ FSProcess::~FSProcess(){
 bool FSProcess::Initialise(switch_loadable_module_interface_t *iface)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "======>FSProcess::Initialise [%p]\n", this);
-       
+
        m_h323endpoint = new FSH323EndPoint();
        return m_h323endpoint != NULL && m_h323endpoint->Initialise(iface);
 }
@@ -388,13 +388,13 @@ bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface)
        m_freeswitch->interface_name = modulename;
        m_freeswitch->io_routines = &h323fs_io_routines;
        m_freeswitch->state_handler = &h323fs_event_handlers;
-                       
+
        PString codec = ((const char *)mod_h323_globals.codec_string);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Config capability %s \n", (const char *)codec);
 
-       if (!codec.IsEmpty()) {         
+       if (!codec.IsEmpty()) {
                const char** f = h323_formats;
-               for (; *f; f += 2) {                    
+               for (; *f; f += 2) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Find capability %s to %s\n",f[1], (const char *)codec);
                        if (codec.Find(f[1]) != P_MAX_INDEX) {
                                PString tmp = f[0];
@@ -410,15 +410,15 @@ bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface)
                                        AddAllCapabilities(0, 0, tmp);
                                        num = GetCapabilities().GetSize() - init;
                                }
-                               if (num)                                        
+                               if (num)
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "H.323 added %d capabilities '%s' \n",num,(const char *)tmp);
                                else
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "H323 failed to add capability '%s' \n",(const char *)tmp);
-                                       
-                       }               
+
+                       }
                }
        }
-       
+
        if (m_fax_old_asn) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "--->fax_old_asn\n");
                SetT38_IFP_PRE();
@@ -427,16 +427,16 @@ bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "--->fax_asn\n");
                SetCapability(0, 0, new FSH323_T38Capability(OpalT38_IFP_COR));
        }
-               
+
        AddAllUserInputCapabilities(0, 1);
-       
+
        DisableFastStart(!m_faststart);
        DisableH245Tunneling(!m_h245tunneling);
        DisableH245inSetup(!m_h245insetup);
        DisableDetectInBandDTMF(!m_dtmfinband);
        if (!m_endpointname.IsEmpty())
                SetLocalUserName(m_endpointname);
-        
+
        if (m_listeners.empty()) {
                StartListener("");
        } else {
@@ -452,7 +452,7 @@ bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface)
                m_thread->SetAutoDelete();
                m_thread->Resume();
        }
-       
+
        return TRUE;
 }
 
@@ -464,7 +464,7 @@ switch_status_t FSH323EndPoint::ReadConfig(int reload)
        switch_status_t status = SWITCH_STATUS_SUCCESS;
 
        switch_memory_pool_t *pool = NULL;
-       
+
        if ((status = switch_core_new_memory_pool(&pool)) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
                return status;
@@ -551,7 +551,7 @@ switch_status_t FSH323EndPoint::ReadConfig(int reload)
                                m_ai = atoi(val);
                        } else if (!strcasecmp(var, "fax-old-asn")) {
                                m_fax_old_asn = switch_true(val);
-                       }                       
+                       }
                }
        }
 
@@ -606,7 +606,7 @@ FSH323EndPoint::FSH323EndPoint()
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323EndPoint::FSH323EndPoint [%p]\n",this);
        terminalType = e_GatewayAndMC;
-}      
+}
 
 FSH323EndPoint::~FSH323EndPoint()
 {
@@ -628,12 +628,12 @@ H323Connection  *FSH323EndPoint::CreateConnection(
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------> SWITCH_CALL_DIRECTION_INBOUND\n");
        }
-       
-       switch_core_session_t *fsSession = switch_core_session_request(GetSwitchInterface(), 
+
+       switch_core_session_t *fsSession = switch_core_session_request(GetSwitchInterface(),
                                (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL);
        if (fsSession == NULL)
                return NULL;
-       
+
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------> fsSession = %p\n",fsSession);
        switch_channel_t *fsChannel = switch_core_session_get_channel(fsSession);
 
@@ -641,7 +641,7 @@ H323Connection  *FSH323EndPoint::CreateConnection(
                switch_core_session_destroy(&fsSession);
                return NULL;
        }
-       
+
        return new FSH323Connection(*this, transport, callReference, (switch_caller_profile_t *)userData, fsSession, fsChannel);
 }
 
@@ -670,7 +670,7 @@ void FSH323EndPoint::StartGkClient(int retry, PString* gkAddress,PString* gkIden
                if (m_stop_gk) {
                        m_stop_gk = false;
                        return;
-               }               
+               }
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Wait next go connect gatekeeper %d\n",retry);
                h_timer(retry);
                if (m_stop_gk) {
@@ -681,7 +681,7 @@ void FSH323EndPoint::StartGkClient(int retry, PString* gkAddress,PString* gkIden
        }
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Started gatekeeper: %s\n",
-                                                       (const char *)GetGatekeeper()->GetName());      
+                                                       (const char *)GetGatekeeper()->GetName());
        m_thread = NULL;
 }
 
@@ -692,7 +692,7 @@ void FSH323EndPoint::StopGkClient()
        if (m_thread) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stop gatekeeper thread\n");
                m_stop_gk = true;
-               
+
                while (m_stop_gk){
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Wait stop gatekeeper thread\n");
                        h_timer(2);
@@ -727,11 +727,11 @@ FSH323Connection::FSH323Connection(FSH323EndPoint& endpoint, H323Transport* tran
        tech_pvt->me = this;
        tech_pvt->active_connection = true;
        switch_core_session_set_private(m_fsSession, tech_pvt);
-       
+
        switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession));
        switch_mutex_init(&tech_pvt->h323_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession));
        switch_mutex_init(&tech_pvt->h323_io_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession));
-       
+
        if (outbound_profile != NULL) {
                SetLocalPartyName(outbound_profile->caller_id_number);
                SetDisplayName(outbound_profile->caller_id_name);
@@ -745,7 +745,7 @@ FSH323Connection::FSH323Connection(FSH323EndPoint& endpoint, H323Transport* tran
 
                switch_channel_set_state(m_fsChannel, CS_INIT);
        }
-}      
+}
 
 FSH323Connection::~FSH323Connection()
 {
@@ -764,13 +764,13 @@ FSH323Connection::~FSH323Connection()
        } else if (m_RTPlocalPort) {
                switch_rtp_release_port((const char *)m_RTPlocalIP.AsString(), m_RTPlocalPort);
        }
-       
+
        tech_pvt->me = NULL;
        tech_pvt->active_connection = false;
 //     switch_mutex_unlock(tech_pvt->h323_mutex);
 //     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
        switch_safe_free(tech_pvt->token);
-}      
+}
 
 void FSH323Connection::AttachSignalChannel(const PString & token,
                                          H323Transport * channel,
@@ -796,7 +796,7 @@ bool FSH323Connection::SetLocalCapabilities()
 
        if (!mod_h323_globals.codec_string)
                return false;
-    
+
        bool nocodecs = true;
        bool changed = false;
 
@@ -813,7 +813,7 @@ bool FSH323Connection::SetLocalCapabilities()
                                        if (fastStartChannels[idx].GetCapability() == localCapabilities[i]) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"Removing fast start channel %s '%s' (%s)\n",GetDirections[fastStartChannels[idx].GetDirection()],(const char*)fname,(const char*)format);
                                                fastStartChannels.RemoveAt(idx--);
-                                       }               
+                                       }
                                }
                                localCapabilities.Remove(fname);
                                i--;
@@ -825,7 +825,7 @@ bool FSH323Connection::SetLocalCapabilities()
        if (nocodecs) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No codecs remaining for H323 connection [%p]\n",this);
                changed = false;
-               ClearCall(EndedByCapabilityExchange);           
+               ClearCall(EndedByCapabilityExchange);
        }
 
        return changed;
@@ -836,12 +836,12 @@ bool FSH323Connection::decodeCapability(const H323Capability& capability, const
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::decodeCapability [%p]\n",this);
 
        PString fname((const char *)capability.GetFormatName());
-  
+
        if (fname.Find("{sw}") == (fname.GetLength() - 4))
                fname = fname.Mid(0,fname.GetLength()-4);
        if (fname.Find("{hw}") == (fname.GetLength() - 4))
                fname = fname.Mid(0,fname.GetLength()-4);
-               
+
        OpalMediaFormat oformat(fname, false);
        int pload = oformat.GetPayloadType();
        const char *format = 0;
@@ -853,7 +853,7 @@ bool FSH323Connection::decodeCapability(const H323Capability& capability, const
                        break;
                }
        }
-    
+
        if (format) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"capability '%s' format '%s' %d\n",(const char*)fname,format,pload);
                if (capabName)
@@ -872,7 +872,7 @@ H323Connection::AnswerCallResponse FSH323Connection::OnAnswerCall(const PString
     const H323SignalPDU &setupPDU, H323SignalPDU &connectPDU)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnAnswerCall caller = %s [%p]\n",(const char*)caller,this);
-       
+
        if (m_fsSession == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Session request failed.\n");
                return H323Connection::AnswerCallDenied;
@@ -902,14 +902,14 @@ H323Connection::AnswerCallResponse FSH323Connection::OnAnswerCall(const PString
        else {
                PString callnam;
                if (q931.GetCalledPartyNumber(callnam)) {
-                       called=(const char *)callnam;                   
+                       called=(const char *)callnam;
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"Called-Party-Number = %s\n",(const char*)called);
                }
        }
-       
+
        PIPSocket::Address remote_network_addr;
        GetSignallingChannel()->GetRemoteAddress().GetIpAddress(remote_network_addr);
-       
+
        switch_caller_profile_t *caller_profile = switch_caller_profile_new(switch_core_session_get_pool(m_fsSession),
                                                                         NULL,
                                                                         /** username */
@@ -976,7 +976,7 @@ H323Connection::AnswerCallResponse FSH323Connection::OnAnswerCall(const PString
 H323Channel* FSH323Connection::CreateRealTimeLogicalChannel(const H323Capability& capability,H323Channel::Directions dir,unsigned sessionID,const H245_H2250LogicalChannelParameters* param, RTP_QOS * rtpqos)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::CreateRealTimeLogicalChannel [%p]\n",this);
-       
+
        H323TransportAddress m_h323transportadd = GetSignallingChannel()->GetLocalAddress();
        m_h323transportadd.GetIpAddress(m_RTPlocalIP);
        if (!m_RTPlocalPort) {
@@ -996,7 +996,7 @@ PBoolean FSH323Connection::OnStartLogicalChannel(H323Channel & channel)
 PBoolean FSH323Connection::OnCreateLogicalChannel(const H323Capability& capability, H323Channel::Directions dir, unsigned& errorCode)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnCreateLogicalChannel ('%s',%s) [%p]\n",(const char *)capability.GetFormatName(),GetDirections[dir],this);
-    
+
        return H323Connection::OnCreateLogicalChannel(capability,dir,errorCode);
 }
 
@@ -1011,7 +1011,7 @@ void FSH323Connection::OnReceivedReleaseComplete(const H323SignalPDU & pdu)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_write [%p]\n",m_fsSession);
        }
        tech_pvt->me = NULL;
-       switch_channel_hangup(switch_core_session_get_channel(m_fsSession),(switch_call_cause_t)pdu.GetQ931().GetCause()); 
+       switch_channel_hangup(switch_core_session_get_channel(m_fsSession),(switch_call_cause_t)pdu.GetQ931().GetCause());
 
        return H323Connection::OnReceivedReleaseComplete(pdu);
 }
@@ -1042,7 +1042,7 @@ bool FSH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"---------> after callProceedingPDU.BuildCallProceeding connectionState = %s [%p]\n",ConnectionStatesNames[connectionState],this);
        if (connectionState == ShuttingDownConnection){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"---------> connectionState = ShuttingDownConnection [%p]\n",this);
-               return false; 
+               return false;
        }
 
        if (SendFastStartAcknowledge(callProceeding.m_fastStart)) {
@@ -1069,7 +1069,7 @@ bool FSH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
                return false;
        }
 
-       return true;            
+       return true;
 }
 
 bool FSH323Connection::OnReceivedCallProceeding(const H323SignalPDU & pdu)
@@ -1094,7 +1094,7 @@ bool FSH323Connection::OnReceivedCallProceeding(const H323SignalPDU & pdu)
 
 bool FSH323Connection::OnSendCallProceeding(H323SignalPDU & callProceedingPDU)
 {
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSendCallProceeding fastStartState = %s [%p]\n",FastStartStateNames[fastStartState],this);    
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSendCallProceeding fastStartState = %s [%p]\n",FastStartStateNames[fastStartState],this);
 
        return false;
 //     return true;
@@ -1102,7 +1102,7 @@ bool FSH323Connection::OnSendCallProceeding(H323SignalPDU & callProceedingPDU)
 
 bool FSH323Connection::OnSendReleaseComplete(H323SignalPDU & pdu)
 {
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSendReleaseComplete cause = %u\n",(switch_call_cause_t)pdu.GetQ931().GetCause());    
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSendReleaseComplete cause = %u\n",(switch_call_cause_t)pdu.GetQ931().GetCause());
 
        switch_channel_hangup(m_fsChannel, (switch_call_cause_t) pdu.GetQ931().GetCause());
        return H323Connection::OnSendReleaseComplete(pdu);
@@ -1127,19 +1127,19 @@ bool FSH323Connection::OnReceivedCapabilitySet(const H323Capabilities & remoteCa
                return false;
        }
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>END H323Connection::OnReceivedCapabilitySet [%p]\n",this);
-       
+
        for (int i = 0; i < remoteCapabilities.GetSize(); ++i) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Capabilities = %s\n",(const char*)(remoteCapabilities[i].GetFormatName()));
        }
-       
+
        H323Capability * cap = remoteCapabilities.FindCapability(H323Capability::e_Audio);
        if (cap == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Capabilities is NULL \n");
                return false;
        }
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Capabilities not NULL \n");
-       
-       return connectionState != ShuttingDownConnection;                                               
+
+       return connectionState != ShuttingDownConnection;
 }
 
 bool FSH323Connection::OnAlerting(const H323SignalPDU &alertingPDU, const PString &user)
@@ -1147,7 +1147,7 @@ bool FSH323Connection::OnAlerting(const H323SignalPDU &alertingPDU, const PStrin
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>PFSH323Connection::OnAlerting user = %s [%p]\n",(const char *)user,this);
        unsigned pi;
        switch_channel_mark_ring_ready(m_fsChannel);
-       
+
        if (!alertingPDU.GetQ931().GetProgressIndicator(pi))
                pi = 0;
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----------->OnAlerting PI = %u\n",pi);
@@ -1164,7 +1164,7 @@ bool FSH323Connection::OnAlerting(const H323SignalPDU &alertingPDU, const PStrin
 void FSH323Connection::AnsweringCall(AnswerCallResponse response)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::AnsweringCall [%p]\n",this);
-       
+
        switch (response) {
                case AnswerCallDeferredWithMedia:{
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Answering call: %s\n",GetAnswerCallResponse[response]);
@@ -1198,15 +1198,15 @@ void FSH323Connection::AnsweringCall(AnswerCallResponse response)
                                                }
                                                fac.IncludeOptionalField(H225_Facility_UUIE::e_h245Address);
                                                controlChannel->SetUpTransportPDU(fac.m_h245Address, TRUE);
-                                       } 
+                                       }
                                        else
                                                sendPDU = FALSE;
                                }
-*/                             
-                               const char *vpi = switch_channel_get_variable(m_fsChannel, "progress-indication"); 
+*/
+                               const char *vpi = switch_channel_get_variable(m_fsChannel, "progress-indication");
                                unsigned pi = 8;
                                if (vpi){
-                                       pi = atoi(vpi); 
+                                       pi = atoi(vpi);
                                }
                                else pi = m_endpoint->m_pi;
                                if ((pi< 1) || (pi > 8)||(pi == 7)) pi = 8;
@@ -1220,7 +1220,7 @@ void FSH323Connection::AnsweringCall(AnswerCallResponse response)
                        Unlock();
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->UnLock\n");
                        return;
-               } 
+               }
                case AnswerCallPending :{
                        if (alertingPDU != NULL) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->Lock\n");
@@ -1229,17 +1229,17 @@ void FSH323Connection::AnsweringCall(AnswerCallResponse response)
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->Lock ok\n");
                                // send Q931 Alerting PDU
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"Sending Alerting PDU\n");
-                               
-                               const char *vai = switch_channel_get_variable(m_fsChannel, "alerting-indication"); 
+
+                               const char *vai = switch_channel_get_variable(m_fsChannel, "alerting-indication");
                                unsigned ai = 0;
                                if (vai){
-                                       ai = atoi(vai); 
+                                       ai = atoi(vai);
                                }
                                else ai = m_endpoint->m_ai;
                                if ((ai< 0) || (ai > 8)||(ai == 7)) ai = 8;
                                if (ai > 0)
                                        (*alertingPDU).GetQ931().SetProgressIndicator(ai);
-                               
+
                                HandleTunnelPDU(alertingPDU);
                                WriteSignalPDU(*alertingPDU);
                                alertingTime = PTime();
@@ -1250,20 +1250,20 @@ void FSH323Connection::AnsweringCall(AnswerCallResponse response)
                        }
                }
                default :H323Connection::AnsweringCall(response);
-       } 
+       }
 }
 
 void FSH323Connection::OnEstablished()
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>PFSH323Connection::OnEstablished [%p]\n",this);
-       if(m_startRTP)          
+       if(m_startRTP)
                switch_channel_mark_answered(m_fsChannel);
        else
                m_ChannelAnswer = true;
 
        if (m_active_channel_fax)
                RequestModeChangeT38("T.38\nT.38");
-       else 
+       else
                m_active_channel_fax = true;
 }
 PBoolean FSH323Connection::OnRequestModeChange(const H245_RequestMode & pdu,
@@ -1292,7 +1292,7 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode)
        for (PINDEX i = 0; i < newMode.GetSize(); i++) {
                H323Capability * capability = localCapabilities.FindCapability(newMode[i]);
                if (PAssertNULL(capability) != NULL)  {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Open channel after mode change: %s\n",(const char*)(capability->GetFormatName()));                      
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Open channel after mode change: %s\n",(const char*)(capability->GetFormatName()));
                        if (capability->GetMainType() == H323Capability::e_Data){
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"capability->GetMainType() = H323Capability::e_Data\n");
                                H245_DataMode & type = newMode[i].m_type;
@@ -1308,18 +1308,18 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode)
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"switch_core_session_alloc t38_options\n");
                                        }
                                        t38_options->T38VendorInfo = "0 0 0";
-                                       
+
                                        t38_options->T38FaxVersion = (uint16_t)profile.m_version;
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxVersion:%lu\n",(unsigned long)profile.m_version);
                                        t38_options->T38MaxBitRate = type.m_bitRate*100;
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38MaxBitRate:%d\n",t38_options->T38MaxBitRate);
-                                       if (profile.m_fillBitRemoval) 
+                                       if (profile.m_fillBitRemoval)
                                                t38_options->T38FaxFillBitRemoval = SWITCH_TRUE;
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxFillBitRemoval:%d\n",(int)profile.m_fillBitRemoval);
                                        if (profile.m_transcodingMMR)
                                                t38_options->T38FaxTranscodingMMR = SWITCH_TRUE;
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxTranscodingMMR:%d\n",(int)profile.m_transcodingMMR);
-                                       if (profile.m_transcodingJBIG) 
+                                       if (profile.m_transcodingJBIG)
                                                t38_options->T38FaxTranscodingJBIG = SWITCH_TRUE;
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxTranscodingJBIG:%d\n",(int)profile.m_transcodingJBIG);
                                        if (profile.m_t38FaxRateManagement.GetTag() == H245_T38FaxRateManagement::e_transferredTCF)
@@ -1336,10 +1336,10 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode)
                                        else
                                                t38_options->T38FaxUdpEC = "t38UDPRedundancy";
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxUdpEC:%s\n",t38_options->T38FaxUdpEC);
-                                       const char *uuid = switch_channel_get_partner_uuid(m_fsChannel); 
+                                       const char *uuid = switch_channel_get_partner_uuid(m_fsChannel);
                                        if (uuid != NULL) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"uuid:%s\n",uuid);
-                                               
+
                                                switch_core_session_t *session = switch_core_session_locate(switch_channel_get_partner_uuid(m_fsChannel));
                                                if (session) {
                                                        switch_channel_t * channel = switch_core_session_get_channel(session);
@@ -1351,19 +1351,19 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode)
                                                        switch_core_session_rwunlock(session);
                                                }else{
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no session\n");
-                                               }                                               
-                                       
-                                       
+                                               }
+
+
                                                switch_core_session_message_t msg = { 0 };
                                                int insist = 0;
                                                const char *v;
                                                if ((v = switch_channel_get_variable(m_fsChannel, "fax_enable_t38_insist"))) {
                                                        insist = switch_true(v);
-                                               } 
+                                               }
                                                msg.from = switch_channel_get_name(m_fsChannel);
                                                msg.message_id = SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA;
                                                msg.numeric_arg = insist;
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"uuid:%s\n",switch_channel_get_uuid(switch_core_session_get_channel(switch_channel_get_session(m_fsChannel))));                                  
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"uuid:%s\n",switch_channel_get_uuid(switch_core_session_get_channel(switch_channel_get_session(m_fsChannel))));
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"uuid:%s\n",uuid);
                                                switch_core_session_message_send(uuid,&msg);
                                        } else {
@@ -1371,7 +1371,7 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode)
                                        }
                                }
                        }
-               } 
+               }
        }
        H323Connection::OnModeChanged(newMode);
 }
@@ -1379,7 +1379,7 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode)
 bool FSH323Connection::OnSendSignalSetup(H323SignalPDU & setupPDU)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>PFSH323Connection::OnSendSignalSetup [%p]\n",this);
-       setupPDU.GetQ931().SetBearerCapabilities(Q931::TransferSpeech, 1); 
+       setupPDU.GetQ931().SetBearerCapabilities(Q931::TransferSpeech, 1);
        return true;
 }
 
@@ -1397,14 +1397,14 @@ void FSH323Connection::setRemoteAddress(const char* remoteIP, WORD remotePort)
 switch_status_t FSH323Connection::on_execute()
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::on_execute [%p]\n",this);
-    
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 switch_status_t FSH323Connection::on_routing()
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::on_routing [%p]\n",this);
-   
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1417,7 +1417,7 @@ switch_status_t FSH323Connection::kill_channel(int sig)
        if (!tech_pvt) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        switch (sig) {
                case SWITCH_SIG_BREAK:
                        if (switch_rtp_ready(tech_pvt->rtp_session)) {
@@ -1427,7 +1427,7 @@ switch_status_t FSH323Connection::kill_channel(int sig)
                case SWITCH_SIG_KILL:
                default:
                        m_rxAudioOpened.Signal();
-                       m_txAudioOpened.Signal();        
+                       m_txAudioOpened.Signal();
                        if (switch_rtp_ready(tech_pvt->rtp_session)) {
                                if ((m_rtp_resetting == 1)) {
                                        switch_core_session_unlock_codec_read(m_fsSession);
@@ -1523,12 +1523,12 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
                        AnsweringCall(AnswerCallPending);
                        AnsweringCall(AnswerCallDeferredWithMedia);
-                       
+
                        if (m_txChannel && m_rxChannel){
                                if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) {
                                        switch_channel_mark_pre_answered(m_fsChannel);
                                }
-                       } else { 
+                       } else {
                                m_callOnPreAnswer = true;
                                if (fastStartState == FastStartDisabled){
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-------------------->m_txAudioOpened.Wait START [%p]\n",this);
@@ -1544,10 +1544,10 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t
                        }
                        AnsweringCall(H323Connection::AnswerCallNow);
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Media started on connection [%p]\n",this);
-               
+
                        if (m_txChannel && m_rxChannel){
                                if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-------------------->switch_channel_mark_answered(m_fsChannel) [%p]\n",this);                                   
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-------------------->switch_channel_mark_answered(m_fsChannel) [%p]\n",this);
                                        switch_channel_mark_answered(m_fsChannel);
                                }
                        } else{
@@ -1573,7 +1573,7 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
                        if (m_active_channel_fax)
                                RequestModeChangeT38("T.38\nT.38");
-                       else 
+                       else
                                m_active_channel_fax = true;
                        break;
                }
@@ -1625,7 +1625,7 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t
                }
                default:{
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Received message id = %d [%p]\n", msg->message_id,this);
-               }       
+               }
        }
 
        return SWITCH_STATUS_SUCCESS;
@@ -1664,14 +1664,14 @@ switch_status_t FSH323Connection::on_init()
 switch_status_t FSH323Connection::on_exchange_media()
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::on_exchange_media [%p]\n",this);
-    
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 switch_status_t FSH323Connection::on_soft_execute()
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::on_soft_execute [%p]\n",this);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1759,7 +1759,7 @@ switch_status_t FSH323Connection::read_audio_frame(switch_frame_t **frame, switc
        switch_set_flag_locked(tech_pvt, TFLAG_READING);
 
        if (!switch_channel_ready(m_fsChannel)) {
-               switch_clear_flag_locked(tech_pvt, TFLAG_READING);              
+               switch_clear_flag_locked(tech_pvt, TFLAG_READING);
 #ifdef DEBUG_RTP_PACKETS
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::read_audio_frame END\n");
 #endif
@@ -1789,7 +1789,7 @@ switch_status_t FSH323Connection::read_audio_frame(switch_frame_t **frame, switc
 #ifdef DEBUG_RTP_PACKETS
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::read_audio_frame END\n\n");
 #endif
-                       return status;                  
+                       return status;
                }
 
 //             PTRACE(4, "mod_h323\t--------->\n source = "<<tech_pvt->read_frame.source<< "\n packetlen = "<<tech_pvt->read_frame.packetlen<<"\n datalen = "<<tech_pvt->read_frame.datalen<<"\n samples = "<<tech_pvt->read_frame.samples<<"\n rate = "<<tech_pvt->read_frame.rate<<"\n payload = "<<(int)tech_pvt->read_frame.payload<<"\n timestamp = "<<tech_pvt->read_frame.timestamp<<"\n seq = "<<tech_pvt->read_frame.seq<<"\n ssrc = "<<tech_pvt->read_frame.ssrc);
@@ -1817,7 +1817,7 @@ switch_status_t FSH323Connection::read_audio_frame(switch_frame_t **frame, switc
 
        switch_mutex_unlock(tech_pvt->h323_io_mutex);
        switch_clear_flag_locked(tech_pvt, TFLAG_READING);
-       
+
        *frame = &tech_pvt->read_frame;
 #ifdef DEBUG_RTP_PACKETS
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::read_audio_frame END\n\n");
@@ -1831,11 +1831,11 @@ switch_status_t FSH323Connection::write_audio_frame(switch_frame_t *frame, switc
 #ifdef DEBUG_RTP_PACKETS
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::write_audio_frame [%p]\n",this);
 #endif
-       
+
        /*switch_channel_t *channel = NULL;
        h323_private_t *tech_pvt = NULL;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
-       
+
        channel = switch_core_session_get_channel(m_fsSession);
        assert(channel != NULL);
 
@@ -1860,14 +1860,14 @@ switch_status_t FSH323Connection::write_audio_frame(switch_frame_t *frame, switc
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
        switch_assert(tech_pvt != NULL);
-       
+
        if (!switch_channel_ready(m_fsChannel)) {
 #ifdef DEBUG_RTP_PACKETS
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::write_audio_frame END\n\n");
 #endif
                return SWITCH_STATUS_FALSE;
        }
-       
+
        while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) {
                if (switch_channel_ready(m_fsChannel)) {
                        switch_yield(10000);
@@ -1878,7 +1878,7 @@ switch_status_t FSH323Connection::write_audio_frame(switch_frame_t *frame, switc
                        return SWITCH_STATUS_GENERR;
                }
        }
-       
+
        if (!switch_core_codec_ready(&tech_pvt->read_codec) || !tech_pvt->read_codec.implementation) {
 #ifdef DEBUG_RTP_PACKETS
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::write_audio_frame END\n\n");
@@ -1894,11 +1894,11 @@ switch_status_t FSH323Connection::write_audio_frame(switch_frame_t *frame, switc
        }
 
        switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
-       
+
        if (switch_rtp_write_frame(tech_pvt->rtp_session, frame) < 0) {
                status = SWITCH_STATUS_GENERR;
        }
-       
+
        switch_clear_flag_locked(tech_pvt, TFLAG_WRITING);
 #ifdef DEBUG_RTP_PACKETS
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::write_audio_frame END\n\n");
@@ -1923,9 +1923,9 @@ switch_status_t FSH323Connection::write_video_frame(switch_frame_t *frame, switc
 
 FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel(FSH323Connection& connection,
                                                        const H323Capability& capability,
-                                                       Directions direction, 
+                                                       Directions direction,
                                                        unsigned sessionID,
-                                                       const PIPSocket::Address& ip, 
+                                                       const PIPSocket::Address& ip,
                                                        WORD dataPort)
        : H323_ExternalRTPChannel(connection, capability, direction, sessionID,ip,dataPort)
        , m_conn(&connection)
@@ -1934,23 +1934,23 @@ FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel(FSH323Connection& connectio
        , m_RTPlocalPort(dataPort)
        , m_sessionID(sessionID)
        , m_rtp_resetting(0)
-{ 
+{
        m_RTPlocalIP = (const char *)ip.AsString();
        SetExternalAddress(H323TransportAddress(ip, dataPort), H323TransportAddress(ip, dataPort+1));
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel sessionID = %d :%s addr = %s:%d [%p]\n",sessionID,GetDirections[GetDirection()],(const char*)m_RTPlocalIP,m_RTPlocalPort,this);     
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel sessionID = %d :%s addr = %s:%d [%p]\n",sessionID,GetDirections[GetDirection()],(const char*)m_RTPlocalIP,m_RTPlocalPort,this);
 
        m_fsChannel = switch_core_session_get_channel(m_fsSession);
        //SetExternalAddress(H323TransportAddress(localIpAddress, m_RTPlocalPort), H323TransportAddress(localIpAddress, m_RTPlocalPort+1));
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------->capability.GetPayloadType() return = %s\n",((capability.GetPayloadType() <= RTP_DataFrame::LastKnownPayloadType)?PayloadTypesNames[capability.GetPayloadType()]:"[pt=128]"));
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------->capability.GetFormatName() return = %s\n",(const char*)(capability.GetFormatName()));
-       
+
        PString fname((const char *)capability.GetFormatName());
-  
+
        if (fname.Find("{sw}") == (fname.GetLength() - 4))
                fname = fname.Mid(0,fname.GetLength()-4);
        if (fname.Find("{hw}") == (fname.GetLength() - 4))
                fname = fname.Mid(0,fname.GetLength()-4);
-       
+
        OpalMediaFormat format(fname, FALSE);
        m_format = &format;
        payloadCode = (BYTE)format.GetPayloadType();
@@ -1960,12 +1960,12 @@ FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel(FSH323Connection& connectio
 
 FSH323_ExternalRTPChannel::~FSH323_ExternalRTPChannel()
 {
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::~FSH323_ExternalRTPChannel  %s [%p]\n",GetDirections[GetDirection()],this);           
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::~FSH323_ExternalRTPChannel  %s [%p]\n",GetDirections[GetDirection()],this);
        if (m_rtp_resetting) {
                switch_core_session_unlock_codec_read(m_fsSession);
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_read [%p]\n",m_fsSession);
                switch_core_session_unlock_codec_write(m_fsSession);
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_write [%p]\n",m_fsSession);      
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_write [%p]\n",m_fsSession);
        }
 }
 
@@ -1981,19 +1981,19 @@ PBoolean FSH323_ExternalRTPChannel::Start()
        char * timer_name = NULL;
        const char *var;
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->m_sessionID = %d  m_active_sessionID = %d\n",sessionID,m_conn->m_active_sessionID);    
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->m_sessionID = %d  m_active_sessionID = %d\n",sessionID,m_conn->m_active_sessionID);
        if (!(m_conn && H323_ExternalRTPChannel::Start())) {
                switch_mutex_unlock(tech_pvt->h323_mutex);
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
                return false;
        }
-       
+
        if ((tech_pvt->me == NULL) || ((tech_pvt->me != NULL) && tech_pvt->me->m_channel_hangup)) {
                switch_mutex_unlock(tech_pvt->h323_mutex);
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
                return false;
        }
-       
+
        if ((m_conn->m_active_sessionID != 0) && (m_conn->m_active_sessionID != sessionID)) {
                if (switch_core_codec_ready(&tech_pvt->read_codec) || switch_core_codec_ready(&tech_pvt->write_codec)) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->Changing Codec to %s\n",(const char*)GetH245CodecName(m_capability));
@@ -2048,14 +2048,14 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                }
                default:break;
        }
-               
+
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->GetFrameSize() return = %u\n",(unsigned)m_format->GetFrameSize());
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->GetFrameTime() return = %u\n",m_format->GetFrameTime());
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->payloadCode = %d\n",(int)payloadCode);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->m_codec_ms return =  %u\n",m_codec_ms);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->m_capability->GetFormatName() return =  %s\n",(const char*)(m_capability->GetFormatName()));
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->GetH245CodecName() return =  %s\n",(const char*)GetH245CodecName(m_capability));
-       
+
        if (GetDirection() == IsReceiver) {
                codec = isAudio ? &tech_pvt->read_codec : &tech_pvt->vid_read_codec;
                //m_switchTimer = isAudio ? &tech_pvt->read_timer : &tech_pvt->vid_read_timer;
@@ -2068,14 +2068,14 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                        //m_switchTimer = isAudio ? &tech_pvt->read_timer : &tech_pvt->vid_read_timer;
                }
        }
-       
+
        tech_pvt->read_frame.codec = &tech_pvt->read_codec; /* Set codec here - no need to set it every time a frame is read */
 
        if (switch_core_codec_init(codec, GetH245CodecName(m_capability), NULL, NULL, // FMTP
                8000, m_codec_ms, 1,  // Channels
                SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
                switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
-        
+
                if (switch_core_codec_init(codec, GetH245CodecName(m_capability), NULL, NULL, // FMTP
                        8000, 0, 1,  // Channels
                        SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
@@ -2095,7 +2095,7 @@ PBoolean FSH323_ExternalRTPChannel::Start()
 
        if (GetDirection() == IsReceiver) {
                //m_readFrame.rate = tech_pvt->read_codec.implementation->actual_samples_per_second;
-               
+
                if (isAudio) {
                        switch_core_session_set_read_codec(m_fsSession, codec);
                        /*if (switch_core_timer_init(m_switchTimer,
@@ -2103,7 +2103,7 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                                codec->implementation->microseconds_per_packet / 1000,
                                codec->implementation->samples_per_packet,
                                switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
-                               
+
                                switch_core_codec_destroy(codec);
                                codec = NULL;
                                switch_mutex_unlock(tech_pvt->h323_mutex);
@@ -2135,35 +2135,35 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                                                return false;
                                }
                                switch_channel_set_variable(m_fsChannel,"timer_name","soft");*/
-                       }       
+                       }
                } else {
                        switch_core_session_set_video_write_codec(m_fsSession, codec);
                        switch_channel_set_flag(m_fsChannel, CF_VIDEO);
                }
        }
-       
+
 //     PTRACE(4, "mod_h323\tSet " << ((GetDirection() == IsReceiver)? " read" : " write") << ' '
 //             << m_capability->GetMainType() << " codec to << " << m_capability << " for connection " << *this);
-               
+
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Set %s %s codec to %s  for connection [%p]\n",((GetDirection() == IsReceiver)? " read" : " write")
                ,GetMainTypes[m_capability->GetMainType()],(const char*)m_capability->GetFormatName(),this);
-               
+
        PIPSocket::Address remoteIpAddress;
-       GetRemoteAddress(remoteIpAddress,m_RTPremotePort);      
+       GetRemoteAddress(remoteIpAddress,m_RTPremotePort);
        m_RTPremoteIP = (const char *)remoteIpAddress.AsString();
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->tech_pvt->rtp_session = [%p]\n",tech_pvt->rtp_session);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->samples_per_packet = %lu\n", codec->implementation->samples_per_packet);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->actual_samples_per_second = %lu\n", codec->implementation->actual_samples_per_second);
-       
+
        bool ch_port = false;
        if (tech_pvt->rtp_session != NULL){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->old remote port = %d new remote port = %d\n",switch_rtp_get_remote_port(tech_pvt->rtp_session),m_RTPremotePort);
                if ((switch_rtp_get_remote_port(tech_pvt->rtp_session) != m_RTPremotePort) && (GetDirection() != IsReceiver) && (m_conn->m_rtp_resetting == 1)){
                        ch_port = true;
                        m_conn->m_startRTP = false;
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_lock_codec_read [%p]\n",m_fsSession);
-                       switch_core_session_lock_codec_read(m_fsSession);                       
+                       switch_core_session_lock_codec_read(m_fsSession);
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_io_mutex_lock\n");
                        switch_mutex_lock(tech_pvt->h323_io_mutex);
                        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
@@ -2173,8 +2173,8 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                        switch_rtp_destroy(&tech_pvt->rtp_session);
                }
        }
-       
-       if ((!m_conn->m_startRTP)) {                    
+
+       if ((!m_conn->m_startRTP)) {
                flags[SWITCH_RTP_FLAG_DATAWAIT] = (switch_rtp_flag_t)1;
                flags[SWITCH_RTP_FLAG_RAW_WRITE] = (switch_rtp_flag_t)1;
 
@@ -2196,7 +2196,7 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                                                        (const char *)m_RTPremoteIP,
                                                        m_RTPremotePort,
                                                        (switch_payload_t)payloadCode,
-                                                       codec->implementation->samples_per_packet,      
+                                                       codec->implementation->samples_per_packet,
                                                        codec->implementation->microseconds_per_packet,
                                                        flags, timer_name, &err,
                                                        switch_core_session_get_pool(m_fsSession));
@@ -2207,7 +2207,7 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                        switch_channel_set_flag(m_fsChannel, CF_FS_RTP);
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err));
-                       switch_channel_hangup(m_fsChannel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);                      
+                       switch_channel_hangup(m_fsChannel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        switch_mutex_unlock(tech_pvt->h323_mutex);
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
                        return SWITCH_STATUS_FALSE;
@@ -2225,7 +2225,7 @@ PBoolean FSH323_ExternalRTPChannel::Start()
        }
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->External RTP address %s:%u\n",(const char*)m_RTPremoteIP,m_RTPremotePort);
-       
+
        if (GetDirection() == IsReceiver) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_io_mutex_lock\n");
                switch_mutex_lock(tech_pvt->h323_io_mutex);
@@ -2233,7 +2233,7 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                switch_mutex_unlock(tech_pvt->h323_io_mutex);
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_io_mutex_unlock\n");
        }
-       
+
        if (m_conn->m_rtp_resetting) {
                if (GetDirection() == IsReceiver) {
                        switch_core_session_unlock_codec_read(m_fsSession);
@@ -2242,25 +2242,25 @@ PBoolean FSH323_ExternalRTPChannel::Start()
                        switch_core_session_unlock_codec_write(m_fsSession);
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_write [%p]\n",m_fsSession);
                        if (m_conn->m_callOnPreAnswer) {
-                               switch_core_session_unlock_codec_read(m_fsSession);     
+                               switch_core_session_unlock_codec_read(m_fsSession);
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_read [%p]\n",m_fsSession);
                        }
                }
        }
-       
+
        if (GetDirection() == IsReceiver)
                m_conn->m_rxAudioOpened.Signal();
        else
-               m_conn->m_txAudioOpened.Signal();                             
-       
+               m_conn->m_txAudioOpened.Signal();
+
        if (m_conn->m_ChannelAnswer && m_conn->m_rxChannel &&  m_conn->m_txChannel)
                switch_channel_mark_answered(m_fsChannel);
-               
+
        if ((m_conn->m_ChannelProgress && m_conn->m_rxChannel)||(m_conn->m_callOnPreAnswer && m_conn->m_txChannel))
                switch_channel_mark_pre_answered(m_fsChannel);
 
        if (m_capability->GetMainType() == H323Capability::e_Data && m_conn->m_rxChannel &&  m_conn->m_txChannel) {
-               const char *uuid = switch_channel_get_partner_uuid(m_fsChannel); 
+               const char *uuid = switch_channel_get_partner_uuid(m_fsChannel);
                if (uuid != NULL){
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------------->switch_rtp_udptl_mode\n");
                        switch_rtp_udptl_mode(tech_pvt->rtp_session);
@@ -2279,7 +2279,7 @@ PBoolean FSH323_ExternalRTPChannel::Start()
 PBoolean FSH323_ExternalRTPChannel::OnReceivedPDU(const H245_H2250LogicalChannelParameters& param, unsigned& errorCode)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::OnReceivedPDU [%p]\n",this);
-       
+
        if (!H323_ExternalRTPChannel::OnReceivedPDU(param,errorCode))
                return true;
        PIPSocket::Address remoteIpAddress;
@@ -2312,25 +2312,25 @@ void FSH323_ExternalRTPChannel::OnSendOpenAck(H245_H2250LogicalChannelAckParamet
 FSH323Connection * FSH323EndPoint::FSMakeCall(const PString & dest, void *userData)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323EndPoint::FSMakeCall DST NUMBER = %s [%p]\n",(const char*)dest,this);
-       
+
        FSH323Connection * connection;
        PString token;
        H323Transport *transport = NULL;
-       
+
        if (listeners.GetSize() > 0) {
                H323TransportAddress taddr = listeners[0].GetTransportAddress();
                PIPSocket::Address addr;
                WORD port;
-               if (taddr.GetIpAndPort(addr, port)) {                           
+               if (taddr.GetIpAndPort(addr, port)) {
                        if (addr) {
                                transport = new H323TransportTCP(*this, addr,false);
-                               if (!transport)                                         
+                               if (!transport)
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Unable to create transport for outgoing call\n");
                        }
                } else
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Unable to get address and port\n");
        }
-       
+
        if (!(connection = (FSH323Connection *)H323EndPoint::MakeCall(dest, token, userData))) {
                return NULL;
        }
@@ -2344,7 +2344,7 @@ static switch_call_cause_t create_outgoing_channel(switch_core_session_t *sessio
                                                    switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
 {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>create_outgoing_channel DST NUMBER = %s\n",outbound_profile->destination_number);
-       
+
        FSH323Connection * connection;
        if (h323_process == NULL) {
                return SWITCH_CAUSE_CRASH;
@@ -2365,7 +2365,7 @@ static switch_status_t on_destroy(switch_core_session_t *session)
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>on_destroy\n");
 
        h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(session);
-    
+
        if (tech_pvt) {
                if (tech_pvt->read_codec.implementation) {
                        switch_core_codec_destroy(&tech_pvt->read_codec);
@@ -2400,7 +2400,7 @@ static switch_status_t on_hangup(switch_core_session_t *session)
        FSH323Connection *me = tech_pvt->me;
        FSH323EndPoint & ep = h323_process->GetH323EndPoint();
        tech_pvt->me = NULL;
-    
+
        if (me) {
                if (me->m_rtp_resetting == 1) {
                        switch_core_session_unlock_codec_read(session);
@@ -2424,7 +2424,7 @@ static switch_status_t on_hangup(switch_core_session_t *session)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-----> () = %d\n",trylock);
                if (trylock == 1) {
                        const PString currentToken(tech_pvt->token);
-                       FSH323Connection *connection = (FSH323Connection *)me->GetEndPoint()->FindConnectionWithLock(currentToken); 
+                       FSH323Connection *connection = (FSH323Connection *)me->GetEndPoint()->FindConnectionWithLock(currentToken);
                        if (connection) {
                                connection->Unlock();
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-----> connection->UnLock()\n");
@@ -2453,6 +2453,6 @@ static switch_status_t on_hangup(switch_core_session_t *session)
        }
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "H323 connection was cleared successfully\n");
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
index 085f061d62756086116be0ecfa445d18aa648acb..9c15ae44d5a7fae2a8d097096f7b3be9a5642ae6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * H323 endpoint interface for Freeswitch Modular Media Switching Software Library /
  * Soft-Switch Application
  *
@@ -18,9 +18,9 @@
  * License.
  *
  * Contributor(s):
- * 
- * 
- * 
+ *
+ *
+ *
  *
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
@@ -125,13 +125,13 @@ const char* const GetMainTypes[H323Capability::e_NumMainTypes+1] = {
        "ExtendVideo",
        "GenericControl",
        "ConferenceControl",
-       "NumMainTypes"  
+       "NumMainTypes"
 };
 
 extern void SetT38_IFP_PRE();
 class OpalMediaFormat;
 class H245_T38FaxProfile;
-class OpalT38Protocol; 
+class OpalT38Protocol;
 extern const OpalMediaFormat & GetOpalT38_IFP_COR();
 extern const OpalMediaFormat & GetOpalT38_IFP_PRE();
 
@@ -218,7 +218,7 @@ switch_status_t name(type1 name1)
 switch_status_t name(type1 name1, type2 name2, type3 name3)
 
 class FSH323EndPoint;
-class FSProcess:public PLibraryProcess { 
+class FSProcess:public PLibraryProcess {
        PCLASSINFO(FSProcess, PLibraryProcess);
 
   public:
@@ -267,7 +267,7 @@ class FSH323EndPoint:public H323EndPoint {
 
        switch_endpoint_interface_t *GetSwitchInterface() const {
                return m_freeswitch;
-       } 
+       }
        FSH323Connection *FSMakeCall(const PString & dest, void *userData);
        list < FSListener > m_listeners;
        int m_ai;
@@ -351,7 +351,7 @@ class FSH323Connection:public H323Connection {
        const H245_MultiplexCapability * muxCap, H245_TerminalCapabilitySetReject & reject);
        switch_core_session_t *GetSession() const {
                return m_fsSession;
-       } 
+       }
        FSH323EndPoint* GetEndPoint() const{
                return m_endpoint;
        }
@@ -359,7 +359,7 @@ class FSH323Connection:public H323Connection {
        virtual void OnUserInputTone(char, unsigned, unsigned, unsigned);
        virtual void OnUserInputString(const PString & value);
        void CleanUpOnCall();
-    
+
        DECLARE_CALLBACK0(on_init);
        DECLARE_CALLBACK0(on_routing);
        DECLARE_CALLBACK0(on_execute);
@@ -437,19 +437,19 @@ class BaseG7231Capab:public H323AudioCapability {
   public:
        BaseG7231Capab(const char *fname, bool annexA = true)
   :    H323AudioCapability(7, 4), m_name(fname), m_aa(annexA) {
-       } 
+       }
        virtual PObject *Clone() const {
                return new BaseG7231Capab(*this);
-       } 
+       }
        virtual unsigned GetSubType() const {
                return H245_AudioCapability::e_g7231;
-       } 
+       }
        virtual PString GetFormatName() const {
                return m_name;
-       } 
+       }
        virtual H323Codec *CreateCodec(H323Codec::Direction direction) const {
                return 0;
-       } 
+       }
        virtual Comparison Compare(const PObject & obj) const {
                Comparison res = H323AudioCapability::Compare(obj);
                if         (res != EqualTo)
@@ -460,7 +460,7 @@ class BaseG7231Capab:public H323AudioCapability {
                if    (m_aa && !aa)
                              return GreaterThan;
                      return EqualTo;
-       } 
+       }
        virtual bool OnSendingPDU(H245_AudioCapability & pdu, unsigned packetSize) const {
                pdu.SetTag(GetSubType());
                H245_AudioCapability_g7231 & g7231 = pdu;
@@ -487,7 +487,7 @@ class BaseG729Capab:public H323AudioCapability {
   public:
        BaseG729Capab(const char *fname, unsigned type = H245_AudioCapability::e_g729)
   :    H323AudioCapability(24, 6), m_name(fname), m_type(type) {
-       } 
+       }
        virtual PObject *Clone() const
        {
                return new BaseG729Capab(*this);
@@ -500,7 +500,7 @@ class BaseG729Capab:public H323AudioCapability {
        }
        virtual H323Codec *CreateCodec(H323Codec::Direction direction) const {
                return 0;
-       } 
+       }
   protected:
        const char *m_name;
        unsigned m_type;
@@ -513,7 +513,7 @@ class BaseGSM0610Cap:public H323AudioCapability {
 
        BaseGSM0610Cap(const char *fname, unsigned type = H245_AudioCapability::e_gsmFullRate)
   :    H323AudioCapability(24, 2), m_name(fname), m_type(type), m_comfortNoise(0), m_scrambled(0) {
-       } 
+       }
        virtual PObject *Clone() const {
                return new BaseGSM0610Cap(*this);
        }
@@ -564,8 +564,8 @@ class FSH323_T38Capability : public H323_T38Capability
     virtual PObject * Clone() const {
                return new FSH323_T38Capability(*this);
        }
-    virtual PString GetFormatName() const { 
-               return mediaFormat; 
+    virtual PString GetFormatName() const {
+               return mediaFormat;
        }
     virtual H323Channel * CreateChannel(
       H323Connection & connection,
index 069792935ca4e7d0d37bcf1bc4cfb4352c825c55..6778ef7cb236a39e82ff2b763327420ab153b66c 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Endpoint 1.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 -->
+
 <channels>
 <!-- Section for main configurations about channels. -->
 
@@ -37,7 +37,7 @@ can make line noise really loud.
 
 <!--
 Enable/disable sending DTMFs out-band as a way to pass detected DTMFs to
-FreeSWITCH. Needed if FreeSWITCH generates digits for us in bridge application 
+FreeSWITCH. Needed if FreeSWITCH generates digits for us in bridge application
 or is being used for IVR ("URA", in pt_BR).
 (default = yes)
 
@@ -136,7 +136,7 @@ accepted, and described in the bottom of this file.
 -->
 
 <!--
-Defines the incoming context for calls on Passive Record boards (KPR). Some 
+Defines the incoming context for calls on Passive Record boards (KPR). Some
 wildcards are accepted, and described in the bottom of this file.
 (default = khomp-DD-CC)
 
@@ -192,9 +192,9 @@ separate the values with comma):
 Set the low level tracing. DO NOT USE THIS UNLESS YOU WERE ADVISED TO DO SO.
 Possible values (to set more than one, separate the values with comma):
 
-k3l  - Enable the low level tracing of board's API. 
+k3l  - Enable the low level tracing of board's API.
         If you are using 'kserver', this option will take no effect. For
-        the k3l tracing to proceed, you will need to (re)start kserver 
+        the k3l tracing to proceed, you will need to (re)start kserver
         with 'debug' option. E.g. '#> kserver start -debug'.
 rdsi - Enable ISDN low level debugging.
 r2   - Enable r2 protocol low level debugging.
@@ -273,17 +273,17 @@ a FXS branch.
 -->
 
 <!--
-Enables/disables the use of sharp (#) as an end-of-number digit on FXS 
+Enables/disables the use of sharp (#) as an end-of-number digit on FXS
 channels for instant dialing. This does not affect special numbers which
-start on sharp, like #8 or #1. 
-(default = yes) 
+start on sharp, like #8 or #1.
+(default = yes)
 
 <param name="fxs-sharp-dial" value="yes" />
 -->
 
 <!--
 This is the delay time to really disconnect a channel after the disconnect
-event arrive. If a connect event comes up in this interval, then the 
+event arrive. If a connect event comes up in this interval, then the
 disconnection is ignored and the call keeps going on. Values in ms.
 (default = 0)
 
@@ -322,11 +322,11 @@ you may need to set this option to 'no'.
 -->
 
 <!--
-When there is a request to indicate busy for an incoming KFXO call, the 
+When there is a request to indicate busy for an incoming KFXO call, the
 ringing channel is taken off hook and then placed on hook, so it now goes
 to answered state and we can send audio throught the line.
 
-If the off/on hook time interval is too short, the PSTN may ignore it, and 
+If the off/on hook time interval is too short, the PSTN may ignore it, and
 keep the line in a ringing state. If it is too long, the call may be charged.
 The option below defines the delay between the line being answered and being
 disconnected, in miliseconds (from 50ms to 90000ms).
@@ -429,7 +429,7 @@ In this section, you should define options using the following syntax:
 <param name="pstn" value="b0l0 + b1c38"/>
 <param name="pstn" value="b0l0 + b1c38:from-pstn"/>
 
-You may define your own groups. In the example above, the group 
+You may define your own groups. In the example above, the group
 called pstn can be used in the bridge string as <action application="brigde" data="Khomp/Gpstn/..." />
 or <action application="brigde" data="Khomp/Gpstn/..." />. As a result, the allocation string will be
 replaced with the one associated with the group "pstn". This is the same
index 5d59fc1c219e71a31a9aa61ee2d57c28d058e318..3653fd03dad3945346d0dd2a70cb66516ee2d345 100644 (file)
@@ -25,7 +25,7 @@
  *
  * Khomp development team
  * Geovani Ricardo Wiedenhoft <grw.freeswitch  (at) gmail.com>
- * Leonardo Lang              <lang.freeswitch (at) gmail.com> 
+ * Leonardo Lang              <lang.freeswitch (at) gmail.com>
  * Eduardo Nunes              <eduardonunesp   (at) gmail.com>
  * Joao Mesquita              <mesquita        (at) khomp.com.br>
  * Raul Fragoso               <raulfragoso     (at) gmail.com>
@@ -37,7 +37,7 @@
 
 /**
   \mainpage Khomp board Endpoint Module
-  
+
   \section Introduction
   This module has been developed to make a nice, affordable brazilian board
   called Khomp (http://www.khomp.com.br) compatible with FreeSWITCH.
@@ -276,18 +276,18 @@ switch_status_t khompHangup(switch_core_session_t *session)
         LOG(ERROR, D("cr (Session is NULL)"));
         return SWITCH_STATUS_FALSE;
     }
-    
+
     tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session));
     if(!tech_pvt)
     {
         LOG(ERROR, D("cr (pvt is NULL)"));
         return SWITCH_STATUS_FALSE;
     }
-    
+
     DBG(FUNC, PVT_FMT(tech_pvt->target(), "c"));
 
     try
-    {       
+    {
         ScopedPvtLock lock(tech_pvt);
 
         if(tech_pvt->freeState())
@@ -336,7 +336,7 @@ switch_status_t khompDestroy(switch_core_session_t *session)
         LOG(ERROR, D("cr (session is null)"))
         return SWITCH_STATUS_FALSE;
     }
-    
+
     Board::KhompPvt *tech_pvt = NULL;
 
     tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session));
@@ -357,7 +357,7 @@ switch_status_t khompDestroy(switch_core_session_t *session)
 
             switch_core_session_set_private(session, NULL);
             tech_pvt->destroyAll();
-            
+
             DBG(FUNC, PVT_FMT(tech_pvt->target(), "r"));
 
             return SWITCH_STATUS_SUCCESS;
@@ -369,7 +369,7 @@ switch_status_t khompDestroy(switch_core_session_t *session)
 
     }
     while(true);
-            
+
     DBG(FUNC, PVT_FMT(tech_pvt->target(), "r (unable to lock!)"));
 
     return SWITCH_STATUS_FALSE;
@@ -384,7 +384,7 @@ switch_status_t khompSMSDestroy(switch_core_session_t *session)
         DBG(FUNC, D("r (session is null)"))
         return SWITCH_STATUS_FALSE;
     }
-/*    
+/*
     Board::KhompPvt *tech_pvt = NULL;
 
     tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session));
@@ -394,9 +394,9 @@ switch_status_t khompSMSDestroy(switch_core_session_t *session)
         DBG(FUNC, D("r (pvt is null)"))
         return SWITCH_STATUS_FALSE;
     }
-    
+
     try
-    {       
+    {
         ScopedPvtLock lock(tech_pvt);
 */
         switch_core_session_set_private(session, NULL);
@@ -416,7 +416,7 @@ switch_status_t khompSMSDestroy(switch_core_session_t *session)
 
 switch_status_t khompKill(switch_core_session_t *session, int sig)
 {
-    //DBG(FUNC,FMT("CHANNEL KILL, kill = %d") % sig) 
+    //DBG(FUNC,FMT("CHANNEL KILL, kill = %d") % sig)
     Board::KhompPvt *tech_pvt = NULL;
 
     tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session));
@@ -426,7 +426,7 @@ switch_status_t khompKill(switch_core_session_t *session, int sig)
         return SWITCH_STATUS_FALSE;
     }
 
-    switch (sig) 
+    switch (sig)
     {
     case SWITCH_SIG_NONE:
         DBG(FUNC, PVT_FMT(tech_pvt->target(), "CHANNEL KILL,  NONE!"));
@@ -469,7 +469,7 @@ switch_status_t khompDigit(switch_core_session_t *session, const switch_dtmf_t *
         LOG(ERROR, D("pvt is NULL"));
         return SWITCH_STATUS_FALSE;
     }
-    
+
     DBG(FUNC, PVT_FMT(tech_pvt->target(), "c (%c)") % dtmf->digit);
 
     try
@@ -585,9 +585,9 @@ switch_status_t khompWrite(switch_core_session_t *session, switch_frame_t *frame
             }
 
             if(tech_pvt->call()->_cadence != Board::KhompPvt::PLAY_VM_TONE)
-            {    
+            {
                 tech_pvt->stopCadence();
-            } 
+            }
         }
 
         if (!tech_pvt->_writer_frames.give((const char *)frame->data, (size_t)frame->datalen))
@@ -631,7 +631,7 @@ switch_status_t khompAnswer(switch_core_session_t *session)
     }
 
     tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session));
-    
+
     if(!tech_pvt)
     {
         LOG(ERROR, D("pvt is NULL"));
@@ -695,7 +695,7 @@ switch_status_t khompAnswer(switch_core_session_t *session)
 switch_status_t khompReceiveMessage(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
     Board::KhompPvt *tech_pvt;
-    
+
     if(!session)
     {
         LOG(ERROR, D("session is NULL"));
@@ -714,100 +714,100 @@ switch_status_t khompReceiveMessage(switch_core_session_t *session, switch_core_
         LOG(ERROR, D("pvt is NULL"));
         return SWITCH_STATUS_FALSE;
     }
-    
+
     switch (msg->message_id) {
         case SWITCH_MESSAGE_REDIRECT_AUDIO:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_REDIRECT_AUDIO")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_REDIRECT_AUDIO"));
             break;
         case SWITCH_MESSAGE_TRANSMIT_TEXT:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_TRANSMIT_TEXT")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_TRANSMIT_TEXT"));
             break;
         case SWITCH_MESSAGE_INDICATE_ANSWER:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_ANSWER")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_ANSWER"));
             return khompAnswer(session);
             break;
         case SWITCH_MESSAGE_INDICATE_PROGRESS:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_PROGRESS")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_PROGRESS"));
             tech_pvt->indicateProgress();
             break;
         case SWITCH_MESSAGE_INDICATE_BRIDGE:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_BRIDGE")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_BRIDGE"));
             break;
         case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_UNBRIDGE")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_UNBRIDGE"));
             break;
         case SWITCH_MESSAGE_INDICATE_TRANSFER:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_TRANSFER")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_TRANSFER"));
             break;
         case SWITCH_MESSAGE_INDICATE_RINGING:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_RINGING")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_RINGING"));
             tech_pvt->indicateRinging();
             break;
         case SWITCH_MESSAGE_INDICATE_MEDIA:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_MEDIA")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_MEDIA"));
             break;
         case SWITCH_MESSAGE_INDICATE_NOMEDIA:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_NOMEDIA")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_NOMEDIA"));
             break;
         case SWITCH_MESSAGE_INDICATE_HOLD:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_HOLD")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_HOLD"));
             break;
         case SWITCH_MESSAGE_INDICATE_UNHOLD:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_UNHOLD")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_UNHOLD"));
             break;
         case SWITCH_MESSAGE_INDICATE_REDIRECT:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_REDIRECT")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_REDIRECT"));
             break;
         case SWITCH_MESSAGE_INDICATE_RESPOND:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_RESPOND")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_RESPOND"));
             break;
         case SWITCH_MESSAGE_INDICATE_BROADCAST:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_BROADCAST")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_BROADCAST"));
             break;
         case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT"));
             break;
         case SWITCH_MESSAGE_INDICATE_DEFLECT:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DEFLECT")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DEFLECT"));
             break;
         case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ"));
             break;
         case SWITCH_MESSAGE_INDICATE_DISPLAY:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DISPLAY")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DISPLAY"));
             break;
         case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY"));
             break;
         case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_AUDIO_SYNC")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_AUDIO_SYNC"));
             break;
         case SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA"));
             break;
         case SWITCH_MESSAGE_INDICATE_UUID_CHANGE:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_UUID_CHANGE")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_UUID_CHANGE"));
             break;
         case SWITCH_MESSAGE_INDICATE_SIMPLIFY:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_SIMPLIFY")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_SIMPLIFY"));
             break;
         case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA:
             DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA"));
             break;
         case SWITCH_MESSAGE_INDICATE_PROXY_MEDIA:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_PROXY_MEDIA")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_PROXY_MEDIA"));
             break;
         case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC"));
             break;
         case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE"));
             break;
         case SWITCH_MESSAGE_INVALID:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INVALID")); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INVALID"));
             break;
         default:
-            DBG(FUNC, PVT_FMT(tech_pvt->_target, "unknown message received [%d].") % msg->message_id % (msg->from ? msg->from : 0)); 
+            DBG(FUNC, PVT_FMT(tech_pvt->_target, "unknown message received [%d].") % msg->message_id % (msg->from ? msg->from : 0));
             break;
     }
 
@@ -837,7 +837,7 @@ switch_call_cause_t khompCall
 
     Board::KhompPvt *tech_pvt;
     int cause = (int)SWITCH_CAUSE_NONE;
-    
+
     try
     {
         ScopedAllocLock alloc_lock;
@@ -857,7 +857,7 @@ switch_call_cause_t khompCall
         {
             tech_pvt->cleanup(Board::KhompPvt::CLN_HARD);
             LOG(ERROR, PVT_FMT(tech_pvt->target(), "Initilization Error!"));
-            return SWITCH_CAUSE_UNALLOCATED_NUMBER; 
+            return SWITCH_CAUSE_UNALLOCATED_NUMBER;
         }
 
         tech_pvt->owner((session ? session : tech_pvt->session()));
@@ -873,11 +873,11 @@ switch_call_cause_t khompCall
         }
 
         alloc_lock.unlock();
-        
+
         tech_pvt->getSpecialVariables();
 
         tech_pvt->setVolume();
-        
+
         if(tech_pvt->makeCall() != ksSuccess)
         {
             *new_session = NULL;
@@ -920,8 +920,8 @@ switch_status_t khompReceiveEvent(switch_core_session_t *session, switch_event_t
         LOG(ERROR, D("pvt is NULL"));
         return SWITCH_STATUS_FALSE;
     }
-    
-    DBG(FUNC, PVT_FMT(tech_pvt->target(), "Receive Event id[%d] name[%s] body=[%s]") % event->event_id % event->headers->name % body); 
+
+    DBG(FUNC, PVT_FMT(tech_pvt->target(), "Receive Event id[%d] name[%s] body=[%s]") % event->event_id % event->headers->name % body);
 
     if (!body) {
         body = (char *)"";
@@ -933,11 +933,11 @@ switch_status_t khompReceiveEvent(switch_core_session_t *session, switch_event_t
 /* A simple idea of app */
 SWITCH_STANDARD_APP(klogFunction)
 {
-    if (zstr(data)) 
+    if (zstr(data))
     {
         LOG(ERROR, D("No data specified"));
-    } 
-    else 
+    }
+    else
     {
         LOG(MESSAGE, FMT("KLOG: %s") %  std::string(data));
     }
@@ -951,11 +951,11 @@ void setVariable(switch_core_session_t * session, const char * variable, const c
         return;
     }
 
-    if (zstr(data)) 
+    if (zstr(data))
     {
         LOG(ERROR, FMT("No %s specified") % variable);
         return;
-    } 
+    }
 
     if(strcasecmp(data, "on") && strcasecmp(data, "off"))
     {
@@ -1003,7 +1003,7 @@ SWITCH_STANDARD_APP(kadjustForFaxFunction)
         LOG(ERROR, D("Session is NULL"));
         return;
     }
-    
+
     Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session));
 
     if(!tech_pvt)
@@ -1038,7 +1038,7 @@ SWITCH_STANDARD_APP(ksendFaxFunction)
         LOG(ERROR, D("Session is NULL"));
         return;
     }
-    
+
 
     Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session));
 
@@ -1060,7 +1060,7 @@ SWITCH_STANDARD_APP(kreceiveFaxFunction)
         LOG(ERROR, D("Session is NULL"));
         return;
     }
-    
+
 
     Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session));
 
@@ -1069,7 +1069,7 @@ SWITCH_STANDARD_APP(kreceiveFaxFunction)
         LOG(ERROR, D("pvt is NULL"));
         return;
     }
-    
+
     DBG(FUNC, PVT_FMT(tech_pvt->target(), "Application KReceiveFax"));
 
     tech_pvt->application(FAX_RECEIVE, session, data);
@@ -1082,12 +1082,12 @@ SWITCH_STANDARD_APP(kUserTransferFunction)
         LOG(ERROR, D("Session is NULL"));
         return;
     }
-    
-    if (zstr(data)) 
+
+    if (zstr(data))
     {
         LOG(ERROR, D("No number specified"));
         return;
-    } 
+    }
 
     Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session));
 
@@ -1096,7 +1096,7 @@ SWITCH_STANDARD_APP(kUserTransferFunction)
         DBG(FUNC, D("pvt is NULL"));
         return;
     }
-    
+
     DBG(FUNC, PVT_FMT(tech_pvt->target(), "Application KUserTransfer"));
 
     tech_pvt->application(USER_TRANSFER, session, data);
@@ -1110,11 +1110,11 @@ SWITCH_STANDARD_APP(ksetVolumeFunction)
         return;
     }
 
-    if (zstr(data)) 
+    if (zstr(data))
     {
         LOG(ERROR, D("No KSetVolume specified"));
         return;
-    } 
+    }
 
     switch_channel_t *c = switch_core_session_get_channel(session);
 
@@ -1174,7 +1174,7 @@ SWITCH_STANDARD_APP(kSendSMSFunction)
         ScopedPvtLock lock(tech_pvt);
 
         alloc_lock.unlock();
-        
+
         tech_pvt->application(SMS_SEND, session, data);
 
     }
@@ -1201,10 +1201,10 @@ SWITCH_STANDARD_APP(kSelectSimCardFunction)
     }
 
     if (zstr(data))
-    {    
+    {
         LOG(ERROR, D("invalid number of arguments"));
         return;
-    }    
+    }
 
     int dev = -1;
     int obj = -1;
@@ -1220,14 +1220,14 @@ SWITCH_STANDARD_APP(kSelectSimCardFunction)
         std::string num("0");
 
         if (params.size() == 3)
-        {    
+        {
             dev = Strings::tolong(params[0]);
             obj = Strings::tolong(params[1]);
             num = params[2];
 
             /* just check for validity */
             (void)Strings::tolong(params[2]);
-        }    
+        }
         else
         {
             LOG(ERROR, D("Invalid number of arguments!"));
@@ -1269,12 +1269,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load)
         return SWITCH_STATUS_FALSE;
     }
 
-    /* Two bodies can not occupy the same space at the same time */ 
+    /* Two bodies can not occupy the same space at the same time */
     if(switch_loadable_module_exists("mod_kommuter") == SWITCH_STATUS_SUCCESS)
-    {   
+    {
         LOG(ERROR, D("Kommuter module for FreeSWITCH is already loaded."));
         return SWITCH_STATUS_FALSE;
-    } 
+    }
 
     //TODO: must put the autorevision variable here
     LOG(MESSAGE, "loading Khomp module");
@@ -1322,7 +1322,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load)
     Globals::khomp_sms_endpoint_interface->interface_name = "khomp_SMS";
     Globals::khomp_sms_endpoint_interface->io_routines = &khomp_sms_io_routines;
     Globals::khomp_sms_endpoint_interface->state_handler = &khomp_sms_state_handlers;
-    
+
     Globals::khomp_pr_endpoint_interface = static_cast<switch_endpoint_interface_t*>(switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE));
     Globals::khomp_pr_endpoint_interface->interface_name = "khomp_PR";
     Globals::khomp_pr_endpoint_interface->io_routines = &khomp_pr_io_routines;
@@ -1330,7 +1330,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load)
 
     /* Register cli commands */
     Cli::registerCommands(apiKhomp,module_interface);
-    
+
     ESL::registerEvents();
 
     /* Add applications */
@@ -1340,13 +1340,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load)
     SWITCH_ADD_APP(Globals::khomp_app_inteface, "KAutoGainControl", "KAutoGainControl", "KAutoGainControl", kautoGainControlFunction, "on|off", SAF_SUPPORT_NOMEDIA);
     SWITCH_ADD_APP(Globals::khomp_app_inteface, "KSetVolume", "KSetVolume", "KSetVolume", ksetVolumeFunction, "value|value", SAF_SUPPORT_NOMEDIA);
     SWITCH_ADD_APP(Globals::khomp_app_inteface, "KR2SendCondition", "KR2SendCondition", "KR2SendCondition", kr2SendConditionFunction, "value|value", SAF_SUPPORT_NOMEDIA);
-    
+
     SWITCH_ADD_APP(Globals::khomp_app_inteface, "KAdjustForFax", "KAdjustForFax", "KAdjustForFax", kadjustForFaxFunction, "", SAF_SUPPORT_NOMEDIA);
     SWITCH_ADD_APP(Globals::khomp_app_inteface, "KSendFax", "KSendFax", "KSendFax", ksendFaxFunction, "<infilename>[:<infilename2>[:...]][|<faxid>]", SAF_SUPPORT_NOMEDIA);
     SWITCH_ADD_APP(Globals::khomp_app_inteface, "KReceiveFax", "KReceiveFax", "KReceiveFax", kreceiveFaxFunction, "<outfilename>[|<faxid>]", SAF_SUPPORT_NOMEDIA);
-    
+
     SWITCH_ADD_APP(Globals::khomp_app_inteface, "KUserTransfer", "KUserTransfer", "KUserTransfer", kUserTransferFunction, "number", SAF_SUPPORT_NOMEDIA);
-    
+
     SWITCH_ADD_APP(Globals::khomp_app_inteface, "KSendSMS", "KSendSMS", "KSendSMS", kSendSMSFunction, "resource|destination|message", SAF_SUPPORT_NOMEDIA);
 
     SWITCH_ADD_APP(Globals::khomp_app_inteface, "KSelectSimCard", "KSelectSimCard", "KSelectSimCard", kSelectSimCardFunction, "<board>|<channel>|<sim_card>", SAF_SUPPORT_NOMEDIA);
@@ -1364,7 +1364,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown)
     Board::kommuter.stop();
 
     Cli::unregisterCommands();
-    
+
     ESL::unregisterEvents();
 
 
@@ -1374,7 +1374,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown)
     Board::finalizeHandlers();
 
     Board::finalize();
-    
+
     DBG(FUNC, "Successfully Unloaded mod_khomp")
 
     K::Logger::stop();
@@ -1426,7 +1426,7 @@ extern "C" void Kstdcall khompAudioListener (int32 deviceid, int32 objectid, byt
 {
     try
     {
-    
+
     //If NULL get throws K3LAPITraits::invalid_channel exception.
     Board::KhompPvt * pvt = Board::get(deviceid, objectid);
 
@@ -1441,7 +1441,7 @@ extern "C" void Kstdcall khompAudioListener (int32 deviceid, int32 objectid, byt
         DBG(STRM, PVT_FMT(pvt->target(), "Stream not enabled, skipping write..."));
         return;
     }
-    
+
     /* will be used below for CM_ADD_STREAM_BUFFER */
     struct
     {
@@ -1449,7 +1449,7 @@ extern "C" void Kstdcall khompAudioListener (int32 deviceid, int32 objectid, byt
         size_t       size;
     }
     write_packet = { (const byte *)0, 0 };
-    
+
     /* push audio from the write buffer */
     switch_frame_t * fr = pvt->_writer_frames.pick();
 
index bd17d3622b93eac1c7c7feb61ff0add5a81c313e..405161d3f2d3f4d54ba909ae52741f30c4971ef6 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -49,7 +49,7 @@ bool Fax::adjustForFax()
 {
     /* Don't worry, let the man work */
     DBG(FUNC, PVT_FMT(_pvt->target(),"Channel is now being adjusted for fax!"));
-    
+
     try
     {
         ScopedPvtLock lock(_pvt);
@@ -106,7 +106,7 @@ bool Fax::sendFax(switch_core_session_t * session, const char *data)
         ScopedPvtLock lock(_pvt);
 
         std::string id;
-        
+
         if(fax_args.size() == 2)
         {
             id = fax_args[1];
@@ -122,7 +122,7 @@ bool Fax::sendFax(switch_core_session_t * session, const char *data)
 
         if(!_pvt->call()->_flags.check(Kflags::REALLY_CONNECTED) && !_pvt->loopWhileFlagTimed(Kflags::REALLY_CONNECTED, timeout, false))
             return false;
-        
+
         if(!startFaxTX(orig_addr))
         {
             LOG(ERROR, PVT_FMT(_pvt->target(), "r (unable to start send fax)"));
@@ -137,13 +137,13 @@ bool Fax::sendFax(switch_core_session_t * session, const char *data)
                         % fax_files[i].c_str());
             }
         }
-        
+
         _fax_cond.reset();
 
         lock.unlock();
 
         _fax_cond.wait();
-        
+
         switch_channel_set_variable(channel, "KFaxSent", ((_fax_result == kfaxrEndOfTransmission) ? "yes" : "no"));
         switch_channel_set_variable(channel, "KFaxResult", (Verbose::faxResult((KFaxResult)_fax_result).c_str()));
 
@@ -211,7 +211,7 @@ bool Fax::receiveFax(switch_core_session_t * session, const char *data)
             LOG(ERROR, PVT_FMT(_pvt->target(), "r (unable to start receive fax)"));
             return false;
         }
-        
+
         _fax_cond.reset();
 
         lock.unlock();
@@ -232,7 +232,7 @@ bool Fax::receiveFax(switch_core_session_t * session, const char *data)
         LOG(ERROR, PVT_FMT(_pvt->target(), "r (%s)") % err._msg.c_str());
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_pvt->target(), "r"));
 
     return true;
@@ -454,7 +454,7 @@ bool SMS::justAlloc(unsigned int count)
 
         if(!caller_profile)
         {
-            _pvt->destroy(session);        
+            _pvt->destroy(session);
             LOG(ERROR, PVT_FMT(_pvt->target(), "r (Cannot create caller profile)"));
             return false;
         }
@@ -474,7 +474,7 @@ bool SMS::justAlloc(unsigned int count)
 
         switch_channel_set_name(channel, name.c_str());
         switch_channel_set_caller_profile(channel, caller_profile);
-    
+
         //DBG(FUNC, PVT_FMT(_pvt->target(), "Connect inbound SMS channel %s") % name.c_str());
 
         switch_channel_set_state(channel, CS_INIT);
@@ -482,7 +482,7 @@ bool SMS::justAlloc(unsigned int count)
 
         _owners.push_front(session);
     }
-    
+
     return true;
 }
 
@@ -557,7 +557,7 @@ bool SMS::sendSMS(switch_core_session_t * session, const char *data)
     DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) c"));
 
     volatile bool finished = false;
-    volatile KGsmCallCause result = kgccNone; 
+    volatile KGsmCallCause result = kgccNone;
 
     try
     {
@@ -596,8 +596,8 @@ bool SMS::sendSMS(switch_core_session_t * session, const char *data)
             conf = true;
         }
 
-        // get options/values 
-        
+        // get options/values
+
         _send_sms._dest = dest;
         _send_sms._conf = conf;
         _send_sms._body = sms_args[2];
@@ -612,7 +612,7 @@ bool SMS::sendSMS(switch_core_session_t * session, const char *data)
 
         if(status)
             _cond.signal();
-    
+
         while (!finished)
         {
             usleep(200000);
@@ -755,12 +755,12 @@ bool SMS::onSMSData(K3L_EVENT *e)
                 {
                     LOG(ERROR, PVT_FMT(_pvt->target(), "unable to receive SMS from '%s', something wrong!") % _got_sms._from);
                     LOG(ERROR, PVT_FMT(_pvt->target(), "disabling SMS processing to prevent messages from being lost."));
-    
+
                     _can_receive = false;
                 }
             }
         }
-        
+
         if(_can_receive)
         {
             /* stats update! */
@@ -777,7 +777,7 @@ bool SMS::onSMSData(K3L_EVENT *e)
                 statistics<SMSStatistics>()->incrementBroadcast();
             }
         }
-   
+
         /* reset data stuff */
         _got_sms.clear();
     }
@@ -817,7 +817,7 @@ bool SMS::onSMSSendResult(K3L_EVENT *e)
 int SMS::smsThread(void * sms_ptr)
 {
     SMS * sms = static_cast < SMS * > (sms_ptr);
-    
+
     Board::KhompPvt * pvt = static_cast < Board::KhompPvt * > (sms->_pvt);
 
     DBG(THRD, PVT_FMT(pvt->target(), "c"));
@@ -939,7 +939,7 @@ int SMS::smsThread(void * sms_ptr)
             {
                 sms->_result = kgccInvalidMessage;
             }
-            
+
             pvt->call()->_flags.clear(Kflags::SMS_DOING_UPLOAD);
 
             if (request_sms._cause)
index b5bcbdd9241af40d38d77b61f9ee2c544fdbb1a5..b7d62e180b31a678b2526c5b4838bff7bc92ae1a 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -147,7 +147,7 @@ bool Cli::parseCommands(int argc, char *argv[])
         /* khomp show channels */
         if(ARG_CMP(1, "channels"))
             return EXEC_CLI_CMD(Cli::KhompShowChannels);
-        
+
         /* khomp show links */
         if(ARG_CMP(1, "links"))
             return EXEC_CLI_CMD(Cli::KhompShowLinks);
@@ -168,7 +168,7 @@ bool Cli::parseCommands(int argc, char *argv[])
         if(ARG_CMP(1, "statistics"))
             return EXEC_CLI_CMD(Cli::KhompClearStatistics);
     }
-   
+
     /* khomp dump */
     else if(ARG_CMP(0, "dump"))
     {
@@ -176,7 +176,7 @@ bool Cli::parseCommands(int argc, char *argv[])
         if(ARG_CMP(1, "config"))
             return EXEC_CLI_CMD(Cli::KhompDumpConfig);
     }
+
     /* khomp reset */
     else if(ARG_CMP(0, "reset"))
     {
@@ -185,7 +185,7 @@ bool Cli::parseCommands(int argc, char *argv[])
             return EXEC_CLI_CMD(Cli::KhompResetLinks);
 
     }
-    
+
     /* khomp sms */
     else if(ARG_CMP(0, "sms"))
     {
@@ -263,7 +263,7 @@ bool Cli::parseCommands(int argc, char *argv[])
         if(ARG_CMP(1, "raw"))
             return EXEC_CLI_CMD(Cli::KhompSendRawCommand);
     }
-    
+
     /* khomp select */
     else if(ARG_CMP(0, "select"))
     {
@@ -278,14 +278,14 @@ bool Cli::parseCommands(int argc, char *argv[])
     {
         if(ARG_CMP(1, "on") || ARG_CMP(1, "off"))
             return EXEC_CLI_CMD(Cli::KhompKommuterOnOff);
-        
+
         if(ARG_CMP(1, "count"))
             return EXEC_CLI_CMD(Cli::KhompKommuterCount);
     }
-    
+
     /* if everything fails, i'm here to support */
     printKhompUsage();
-    
+
     return false;
 }
 
@@ -335,12 +335,12 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
 
     Cli::OutputType output_type = Cli::VERBOSE;
     if(ARG_CMP(1, "concise")) output_type = Cli::CONCISE;
-    if(ARG_CMP(1, "xml")) 
+    if(ARG_CMP(1, "xml"))
     {
         output_type = Cli::XML;
         createRoot("summary");
     }
-        
+
     class_type classe = ( !_on_cli_term ? C_MESSAGE : C_CLI );
     K3L_API_CONFIG apiCfg;
 
@@ -375,7 +375,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
             {
                 /* summary/k3lapi */
                 switch_xml_t xk3lapi = switch_xml_add_child_d(root, "k3lapi",0);
-                
+
                 /* summary/k3lapi/version */
                 switch_xml_t xk3l_version = switch_xml_add_child_d(xk3lapi,"version", 0);
                 switch_xml_set_attr_d(xk3l_version,"major",STR(FMT("%d") % apiCfg.MajorVersion));
@@ -465,7 +465,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
     {
         if (output_type == Cli::VERBOSE)
             K::Logger::Logg2(classe,stream, " ------------------------------------------------------------------");
-      
+
         if (output_type == Cli::XML)
         {
             printXMLOutput(stream);
@@ -546,7 +546,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
 
                             /* boards/board/general */
                             switch_xml_t xgeneral = switch_xml_add_child_d(xdev,"general",0);
-    
+
                             /* boards/board/general/type */
                             switch_xml_t xtype = switch_xml_add_child_d(xgeneral,"type",0);
                             switch_xml_set_txt_d(xtype,tipo.c_str());
@@ -568,7 +568,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
 
                             /* boards/board/hardware/dsps */
                             switch_xml_t xdsps = switch_xml_add_child_d(xhardware,"dsps",0);
-                           
+
                             /* boards/board/hardware/dsps/dsp (0) */
                             switch_xml_t xdsp0 = switch_xml_add_child_d(xdsps,"dsp",0);
                             switch_xml_set_attr_d(xdsp0,"id","0");
@@ -644,7 +644,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
 
                             /* boards/board/general  */
                             switch_xml_t xgeneral = switch_xml_add_child_d(xdev,"general",0);
-    
+
                             /* boards/board/general/type  */
                             switch_xml_t xtype = switch_xml_add_child_d(xgeneral,"type",0);
                             switch_xml_set_txt_d(xtype,tipo.c_str());
@@ -663,7 +663,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
 
                             /* boards/hardware */
                             switch_xml_t xhardware = switch_xml_add_child_d(xdev,"hardware",0);
-                            
+
                             /* boards/board/hardware/dsps */
                             switch_xml_t xdsps = switch_xml_add_child_d(xhardware,"dsps",0);
 
@@ -740,7 +740,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
 
                             /* boards/board/general */
                             switch_xml_t xgeneral = switch_xml_add_child_d(xdev,"general",0);
-    
+
                             /* boards/board/general/type */
                             switch_xml_t xtype = switch_xml_add_child_d(xgeneral,"type",0);
                             switch_xml_set_txt_d(xtype,tipo.c_str());
@@ -808,7 +808,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
                             K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - %s%s|")
                                 % dspCfg.DspVersion % dspCfg.FwVersion
                                 % std::string(std::max<int>(55 - size, 0), ' '));
-                            
+
                         } break;
 
                         case Cli::CONCISE:
@@ -826,7 +826,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
 
                             /* boards/board/general */
                             switch_xml_t xgeneral = switch_xml_add_child_d(xdev,"general",0);
-    
+
                             /* boards/board/general/type */
                             switch_xml_t xtype = switch_xml_add_child_d(xgeneral,"type",0);
                             switch_xml_set_txt_d(xtype,tipo.c_str());
@@ -841,7 +841,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
 
                             /* boards/board/hardware */
                             switch_xml_t xhardware = switch_xml_add_child_d(xdev,"hardware",0);
-                            
+
                             /* boards/board/hardware/dsps */
                             switch_xml_t xdsps = switch_xml_add_child_d(xhardware,"dsps",0);
 
@@ -875,7 +875,7 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[])
 
     if (output_type == Cli::VERBOSE)
         K::Logger::Logg2(classe,stream, " ------------------------------------------------------------------");
-      
+
     if (output_type == Cli::XML)
     {
         printXMLOutput(stream);
@@ -903,33 +903,33 @@ bool Cli::_KhompShowCalls::execute(int argc, char *argv[])
         return false;
     }
 
-    int device = argv[2] ? atoi(argv[2]) : -1; 
-    int object = argv[3] ? atoi(argv[3]) : -1; 
+    int device = argv[2] ? atoi(argv[2]) : -1;
+    int object = argv[3] ? atoi(argv[3]) : -1;
 
     int d = -1;
     int o = -1;
 
     if (device != -1)
-    {    
+    {
         d = device;
 
         if (!Globals::k3lapi.valid_device(d))
-        {    
+        {
             K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such device %d!") % d);
             return false;
-        }    
-    }   
+        }
+    }
 
     if (object != -1)
-    {    
+    {
         o = object;
 
         if (!Globals::k3lapi.valid_channel(d,o))
-        {    
+        {
             K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such chanel %d for device %d!") % o % d);
             return false;
-        }    
-    } 
+        }
+    }
 
     /* keep the channels reponse */
     std::string buffer("");
@@ -937,27 +937,27 @@ bool Cli::_KhompShowCalls::execute(int argc, char *argv[])
     try
     {
         /**/ if (d != -1 && o != -1)
-        {    
+        {
             showCalls(d,o,buffer);
-        }    
+        }
         else if (d != -1 && o == -1)
-        {    
-            for (unsigned int i = 0; i < Globals::k3lapi.channel_count(d); i++) 
-            {    
+        {
+            for (unsigned int i = 0; i < Globals::k3lapi.channel_count(d); i++)
+            {
                 buffer += " ------------------------------------------------------------------------\n";
                 showCalls(d,i,buffer);
-            }    
-        }    
+            }
+        }
         else if (d == -1 && o == -1)
-        {    
-            for (unsigned int i = 0; i < Globals::k3lapi.device_count(); i++) 
-            {    
+        {
+            for (unsigned int i = 0; i < Globals::k3lapi.device_count(); i++)
+            {
                 buffer += " ------------------------------------------------------------------------\n";
                 for (unsigned int j = 0; j < Globals::k3lapi.channel_count(i); j++)
                 {
                     showCalls(i,j,buffer);
                 }
-            }    
+            }
         }
     }
     catch(K3LAPITraits::invalid_channel & err)
@@ -998,7 +998,7 @@ bool Cli::_KhompChannelsDisconnect::forceDisconnect(unsigned int device, unsigne
     catch (ScopedLockFailed & err)
     {
         K::Logger::Logg2(C_CLI,stream,FMT("error: channel %d at device %d could not be locked: %s!")
-        % channel 
+        % channel
         % device
         % err._msg.c_str());
     }
@@ -1015,54 +1015,54 @@ bool Cli::_KhompChannelsDisconnect::execute(int argc, char *argv[])
     }
 
     switch (argc)
-    {    
+    {
         case 3:
-        {    
+        {
             if (!ARG_CMP(2, "all"))
-            {    
+            {
                 K::Logger::Logg2(C_CLI, stream, "usage: khomp channels disconnect < all | <boardid> < all | <channelid> > >");
                 return false;
-            }    
+            }
 
             K::Logger::Logg2(C_CLI, stream, "NOTICE: Disconnecting all channels on all boards!");
 
             for (unsigned int dev = 0; dev < Globals::k3lapi.device_count(); dev++)
-            {    
+            {
                 for (unsigned int chan = 0; chan < Globals::k3lapi.channel_count(dev); chan++)
                     forceDisconnect(dev,chan);
-            }    
+            }
             break;
-        }    
+        }
         case 4:
-        {    
+        {
             unsigned int dev = atoi(argv[2]);
 
             if (ARG_CMP(3, "all"))
-            {    
+            {
                 K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Disconnecting all channels on board %d!") % dev);
 
                 for (unsigned int chan = 0; chan < Globals::k3lapi.channel_count(dev); chan++)
                     forceDisconnect(dev,chan);
-            }    
+            }
 
             unsigned int channel = atoi(argv[3]);
 
             if (dev >= Globals::k3lapi.device_count())
-            {    
+            {
                 K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such device: %d!") % dev);
                 return false;
-            }    
+            }
+
 
-            
             K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Disconnecting channel %d on board %d!") % channel % dev);
 
             forceDisconnect(dev,channel);
             break;
-        }    
+        }
 
         default:
             break;
-    }   
+    }
 
     return true;
 }
@@ -1070,20 +1070,20 @@ bool Cli::_KhompChannelsDisconnect::execute(int argc, char *argv[])
 bool Cli::_KhompChannelsUnblock::execute(int argc, char *argv[])
 {
     if (argc != 4 && argc != 3)
-    {    
+    {
         printUsage(stream);
         return false;
-    }    
+    }
 
     switch (argc)
-    {    
+    {
         case 3:
-        {    
+        {
             K::Logger::Logg2(C_CLI, stream, "NOTICE: Unblocking all channels on all devices!");
             for (unsigned int dev = 0; dev < Globals::k3lapi.device_count(); dev++)
-            {    
+            {
                 for (unsigned int chan = 0; chan < Globals::k3lapi.channel_count(dev); chan++)
-                {    
+                {
                     try
                     {
                         Globals::k3lapi.command(dev,chan,CM_UNLOCK_INCOMING);
@@ -1092,32 +1092,32 @@ bool Cli::_KhompChannelsUnblock::execute(int argc, char *argv[])
                     catch(K3LAPI::failed_command &e)
                     {
                         if (K::Logger::Logg.classe(C_WARNING).enabled())
-                        {   
+                        {
                             LOG(WARNING, FMT("Command '%s' has failed with error '%s'.")
                                     % Verbose::commandName(e.code) % Verbose::status((KLibraryStatus)e.rc));
-                        }   
+                        }
 
                         return false;
                     }
-                }    
-            }    
+                }
+            }
             break;
-        }    
+        }
         case 4:
-        {    
+        {
             int dev = atoi (argv[2]);
 
             if ( !SAFE_strcasecmp(argv[3], "all") )
-            {    
+            {
                 if (!Globals::k3lapi.valid_device( dev ))
-                {    
+                {
                     K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find device: %d!") % dev );
                     return false;
-                }    
+                }
 
                 K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Unblocking all channels on device %d!") % dev);
 
-                for (unsigned int i = 0; i < Globals::k3lapi.channel_count(dev); i++) 
+                for (unsigned int i = 0; i < Globals::k3lapi.channel_count(dev); i++)
                 {
                     try
                     {
@@ -1127,24 +1127,24 @@ bool Cli::_KhompChannelsUnblock::execute(int argc, char *argv[])
                     catch(K3LAPI::failed_command &e)
                     {
                         if (K::Logger::Logg.classe(C_WARNING).enabled())
-                        {   
+                        {
                             LOG(WARNING, FMT("Command '%s' has failed with error '%s'.")
                                     % Verbose::commandName(e.code) % Verbose::status((KLibraryStatus)e.rc));
-                        }   
+                        }
 
                         return false;
                     }
                 }
-            } 
-            else 
-            {    
+            }
+            else
+            {
                 int obj = atoi (argv[3]);
 
                 if (!Globals::k3lapi.valid_channel(dev, obj))
-                {    
+                {
                     K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such channel %d at device %d!") % obj % dev);
                     return false;
-                }    
+                }
 
                 K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Unblocking channel %d on device %d!") % obj % dev);
 
@@ -1156,20 +1156,20 @@ bool Cli::_KhompChannelsUnblock::execute(int argc, char *argv[])
                 catch(K3LAPI::failed_command &e)
                 {
                     if (K::Logger::Logg.classe(C_WARNING).enabled())
-                    {   
+                    {
                         LOG(WARNING, FMT("Command '%s' has failed with error '%s'.")
                                 % Verbose::commandName(e.code) % Verbose::status((KLibraryStatus)e.rc));
-                    }   
+                    }
 
                     return false;
                 }
-            }    
+            }
             break;
-        }    
+        }
         default:
             break;
-    }    
-    
+    }
+
     return true;
 }
 
@@ -1204,7 +1204,7 @@ void Cli::_KhompShowStatistics::cliStatistics(unsigned int device, OutputType ou
         {
             K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.object % err.device );
         }
-    }    
+    }
 }
 
 void Cli::_KhompShowStatistics::cliDetailedStatistics(unsigned int device, unsigned int channel, OutputType output_type)
@@ -1241,7 +1241,7 @@ void Cli::_KhompShowStatistics::cliDetailedStatistics(unsigned int device, unsig
 
 bool Cli::_KhompShowStatistics::execute(int argc, char *argv[])
 {
-    if (argc < 2 || argc > 5) 
+    if (argc < 2 || argc > 5)
     {
         printUsage(stream);
         return false;
@@ -1249,50 +1249,50 @@ bool Cli::_KhompShowStatistics::execute(int argc, char *argv[])
 
     unsigned int dev = UINT_MAX;
     unsigned int obj = UINT_MAX;
-    int detailed = 0, verbose  = 0, as_xml = 0; 
+    int detailed = 0, verbose  = 0, as_xml = 0;
     OutputType output_type = Cli::VERBOSE;
 
-    detailed = ((argc > 2)  && (!strcasecmp(argv[2], "detailed")) ? 1 : 0 ); 
-    verbose  = ((argc > 2)  && (!strcasecmp(argv[2], "verbose"))  ? 1 : 0 ); 
-    as_xml   = ((argc > 2)  && (!strcasecmp(argv[2], "xml"))      ? 1 : 0 ); 
+    detailed = ((argc > 2)  && (!strcasecmp(argv[2], "detailed")) ? 1 : 0 );
+    verbose  = ((argc > 2)  && (!strcasecmp(argv[2], "verbose"))  ? 1 : 0 );
+    as_xml   = ((argc > 2)  && (!strcasecmp(argv[2], "xml"))      ? 1 : 0 );
 
-    try  
-    {   
+    try
+    {
         if(argc > (2+detailed+verbose+as_xml))
         {
             dev = Strings::tolong(argv[2+detailed+verbose+as_xml]);
             if (!Globals::k3lapi.valid_device(dev))
-            {    
+            {
                 K::Logger::Logg2(C_CLI, stream, "ERROR: No such device!");
                 return false;
-            }    
+            }
         }
 
         if (argc > (3+detailed+verbose+as_xml))
-        {   
+        {
             std::string object(argv[3+detailed+verbose+as_xml]);
             obj = Strings::tolong(object);
 
             if (!Globals::k3lapi.valid_channel(dev, obj))
-            {    
+            {
                 K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % obj % dev );
                 return false;
-            }  
+            }
         }
-    }    
+    }
     catch (Strings::invalid_value e)
-    {    
+    {
         K::Logger::Logg2(C_CLI, stream, "ERROR: Invalid numeric value!");
         return false;
     }
 
     if(detailed) output_type = Cli::DETAILED;
-    if(as_xml) 
+    if(as_xml)
     {
         createRoot("statistics");
         output_type = Cli::XML;
     }
-    
+
     std::string header;
     header.append( " ------------------------------------------------------------------------------------\n");
     header.append( "|----------------------------- Khomp Endpoint Statistics ----------------------------|\n");
@@ -1418,13 +1418,13 @@ void Cli::_KhompShowChannels::showChannel(unsigned int device, unsigned int chan
         ScopedPvtLock lock(pvt);
 
         std::string tmp_call = Globals::k3lutil.callStatus(
-                pvt->target().device, 
-                pvt->target().object, 
+                pvt->target().device,
+                pvt->target().object,
                 (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN));
 
         std::string tmp_chan = Globals::k3lutil.channelStatus(
-                pvt->target().device, 
-                pvt->target().object, 
+                pvt->target().device,
+                pvt->target().object,
                 (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN));
 
 
@@ -1433,7 +1433,7 @@ void Cli::_KhompShowChannels::showChannel(unsigned int device, unsigned int chan
             case Cli::VERBOSE:
             {
                 if (pvt->getSignaling() == ksigGSM)
-                {    
+                {
                     K3L_GSM_CHANNEL_STATUS gsmStatus;
 
                     if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess)
@@ -1446,34 +1446,34 @@ void Cli::_KhompShowChannels::showChannel(unsigned int device, unsigned int chan
 
                     std::string tmp_antenna_level;
 
-                    for (unsigned int i = 0; i < sign_size; i++) 
-                        tmp_antenna_level += '*'; 
+                    for (unsigned int i = 0; i < sign_size; i++)
+                        tmp_antenna_level += '*';
 
-                    for (unsigned int i = sign_size; i < full_size; i++) 
-                        tmp_antenna_level += ' '; 
+                    for (unsigned int i = sign_size; i < full_size; i++)
+                        tmp_antenna_level += ' ';
 
                     tmp_chan += " (";
                     tmp_chan += (strlen(gsmStatus.OperName) != 0 ? gsmStatus.OperName : "...");
-                    tmp_chan += ")"; 
+                    tmp_chan += ")";
 
                     K::Logger::Logg2(C_CLI, stream, FMT("| %d,%02d | %8s | %8s | %-23s | %02d%% |%s|")
                             % device % channel %  pvt->getStateString() % tmp_call % tmp_chan
                             % sign_numb % tmp_antenna_level);
-                }    
-                else 
-                {    
+                }
+                else
+                {
                     K::Logger::Logg2(C_CLI, stream, FMT("| %d,%02d | %8s | %8s | %-40s |")
                             % device % channel % pvt->getStateString() % tmp_call % tmp_chan);
-                }    
+                }
 
             } break;
 
-            case Cli::CONCISE:   
+            case Cli::CONCISE:
             {
                 std::string state = pvt->getStateString();
 
                 if (pvt->getSignaling() == ksigGSM)
-                {    
+                {
                     K3L_GSM_CHANNEL_STATUS gsmStatus;
 
                     if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess)
@@ -1486,12 +1486,12 @@ void Cli::_KhompShowChannels::showChannel(unsigned int device, unsigned int chan
                     K::Logger::Logg2(C_CLI, stream, FMT("B%02dC%02d:%s:%s:%s:%d%%:%s")
                             % device % channel % state % tmp_call % tmp_chan
                             % sign_numb % gsm_registry);
-                }    
-                else 
-                {    
+                }
+                else
+                {
                     K::Logger::Logg2(C_CLI, stream, FMT("B%02dC%02d:%s:%s:%s")
                             % device % channel %  state % tmp_call % tmp_chan);
-                }    
+                }
 
             } break;
 
@@ -1504,7 +1504,7 @@ void Cli::_KhompShowChannels::showChannel(unsigned int device, unsigned int chan
                 /* device/channel/fs_state */
                 switch_xml_t xstate = switch_xml_add_child_d(xchannel,"fs_state",0);
                 switch_xml_set_txt_d(xstate, pvt->getStateString().c_str());
-               
+
                 /* device/channel/call */
                 switch_xml_t xcall = switch_xml_add_child_d(xchannel,"call",0);
                 switch_xml_set_txt_d(xcall, tmp_call.c_str());
@@ -1514,7 +1514,7 @@ void Cli::_KhompShowChannels::showChannel(unsigned int device, unsigned int chan
                 switch_xml_set_txt_d(xstatus, tmp_chan.c_str());
 
                 if (pvt->getSignaling() == ksigGSM)
-                {   
+                {
                     K3L_GSM_CHANNEL_STATUS gsmStatus;
 
                     if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess)
@@ -1530,24 +1530,24 @@ void Cli::_KhompShowChannels::showChannel(unsigned int device, unsigned int chan
                     /* device/channel/registry */
                     switch_xml_t xgsm_registry = switch_xml_add_child_d(xchannel, "registry", 9);
                     switch_xml_set_txt_d(xgsm_registry, gsm_registry.c_str());
-                }    
-            
+                }
+
             } break;
 
             default:
-                /* do nothing */ 
+                /* do nothing */
                 break;
         }
 
-    }    
+    }
     catch (K3LAPITraits::invalid_channel & err)
     {
         K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.object % err.device );
     }
     catch (...)
-    {    
+    {
         K::Logger::Logg2(C_CLI, stream, "ERROR: Unexpected error..., skipping");
-    }   
+    }
 }
 
 void Cli::_KhompShowChannels::showChannels(unsigned int device, OutputType output_type)
@@ -1572,7 +1572,7 @@ bool Cli::_KhompShowChannels::execute(int argc, char *argv[])
     OutputType output_type = Cli::VERBOSE;
 
     bool onlyShowOneChannel = false;
-    unsigned int channelToShow = 0; 
+    unsigned int channelToShow = 0;
 
     if (argc > 5)
     {
@@ -1580,39 +1580,39 @@ bool Cli::_KhompShowChannels::execute(int argc, char *argv[])
         return false;
     }
 
-    concise = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "concise")) ? 1 : 0 ); 
-    verbose = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "verbose")) ? 1 : 0 ); 
-    as_xml  = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "xml"))     ? 1 : 0 ); 
+    concise = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "concise")) ? 1 : 0 );
+    verbose = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "verbose")) ? 1 : 0 );
+    as_xml  = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "xml"))     ? 1 : 0 );
 
     if (argc >= (3 + concise + verbose + as_xml))
-    {    
+    {
         dev = atoi (argv[2 + concise + verbose + as_xml]);
 
         if (!Globals::k3lapi.valid_device(dev))
-        {    
+        {
             K::Logger::Logg2(C_CLI, stream, "ERROR: no such device!");
             return false;
-        }    
-        
+        }
+
         if (argc == ( 4 + concise + verbose + as_xml))
         {
             onlyShowOneChannel = true;
             channelToShow = atoi (argv[3 + concise + verbose + as_xml]);
-        }    
-    }    
+        }
+    }
 
     if (concise == 0 && as_xml == 0)
-    {    
+    {
         K::Logger::Logg2(C_CLI, stream, " -----------------------------------------------------------------------");
         K::Logger::Logg2(C_CLI, stream, "|-------------------- Khomp Channels and Connections -------------------|");
         K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|");
         K::Logger::Logg2(C_CLI, stream, "|  hw  |freeSWITCH|   call   |                   channel                |");
         K::Logger::Logg2(C_CLI, stream, "|  id  |  status  |  status  |                   status                 |");
         K::Logger::Logg2(C_CLI, stream, " -----------------------------------------------------------------------");
-    } 
+    }
 
     if (concise != 0) output_type = Cli::CONCISE;
-    if (as_xml  != 0) 
+    if (as_xml  != 0)
     {
         output_type = Cli::XML;
 
@@ -1621,9 +1621,9 @@ bool Cli::_KhompShowChannels::execute(int argc, char *argv[])
     }
 
     if ( onlyShowOneChannel )
-    {    
+    {
         if ( channelToShow <  Globals::k3lapi.channel_count(dev) )
-        {    
+        {
             if(output_type == Cli::XML)
             {
                 /* channels/device */
@@ -1632,21 +1632,21 @@ bool Cli::_KhompShowChannels::execute(int argc, char *argv[])
             }
 
             showChannel (dev, channelToShow, output_type);
-        }    
-        else 
-        {    
+        }
+        else
+        {
             K::Logger::Logg2(C_CLI, stream, "ERROR: no such channel!");
-        }    
-    }    
+        }
+    }
     else if (dev == UINT_MAX)
-    {    
+    {
         for (dev = 0; dev < Globals::k3lapi.device_count(); dev++)
         {
             showChannels(dev, output_type);
         }
-    }    
-    else 
-    {    
+    }
+    else
+    {
         showChannels ( dev, output_type);
     }
 
@@ -1675,21 +1675,21 @@ std::string Cli::_KhompShowLinks::getLinkStatus(int dev, int obj, Verbose::Prese
 
     std::string res;
 
-    try  
-    {    
+    try
+    {
         const K3L_LINK_CONFIG & conf = Globals::k3lapi.link_config(dev, obj);
-        
+
         res = Globals::k3lutil.linkStatus(dev, obj, fmt);
 
         if (conf.ReceivingClock & 0x01)
            res += (fmt == Verbose::EXACT ? ",sync" : " (sync)");
-    }    
-    catch (K3LAPITraits::invalid_target & e) 
-    {    
+    }
+    catch (K3LAPITraits::invalid_target & e)
+    {
         res = "<error>";
-    }    
+    }
 
-    return res; 
+    return res;
 }
 
 void Cli::_KhompShowLinks::showLinks(unsigned int device, OutputType output_type)
@@ -1702,7 +1702,7 @@ void Cli::_KhompShowLinks::showLinks(unsigned int device, OutputType output_type
         case 1:
         {
             std::string str_link0 = getLinkStatus(device, 0, (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN));
-        
+
             switch(output_type)
             {
                 case Cli::VERBOSE:
@@ -1720,7 +1720,7 @@ void Cli::_KhompShowLinks::showLinks(unsigned int device, OutputType output_type
                     /* device */
                     xdev = switch_xml_add_child_d(root,"device",0);
                     switch_xml_set_attr_d(xdev,"id",STR(FMT("%d") % device));
-                  
+
                     /* device/links */
                     switch_xml_t xlinks = switch_xml_add_child_d(xdev,"links",0);
 
@@ -1760,7 +1760,7 @@ void Cli::_KhompShowLinks::showLinks(unsigned int device, OutputType output_type
                     /* device */
                     xdev = switch_xml_add_child_d(root,"device",0);
                     switch_xml_set_attr_d(xdev,"id",STR(FMT("%d") % device));
-                  
+
                     /* device/links */
                     switch_xml_t xlinks = switch_xml_add_child_d(xdev,"links",0);
 
@@ -1853,11 +1853,11 @@ void Cli::_KhompShowLinks::showErrors(unsigned int device, OutputType output_typ
                     /* device */
                     xdev = switch_xml_add_child_d(root,"device",0);
                     switch_xml_set_attr_d(xdev,"id",STR(FMT("%d") % device));
-                  
+
                     /* device/errors */
                     switch_xml_t xerrors = switch_xml_add_child_d(xdev,"errors",0);
 
-                    /* device/errors/link (0) */ 
+                    /* device/errors/link (0) */
                     switch_xml_t xlinks0 = switch_xml_add_child_d(xerrors,"link",0);
                     switch_xml_set_attr_d(xlinks0,"id","0");
 
@@ -1872,7 +1872,7 @@ void Cli::_KhompShowLinks::showErrors(unsigned int device, OutputType output_typ
                         switch_xml_set_txt_d(xnumber0,STR(FMT("%d") % i->second));
                     }
 
-                    /* device/errors/link (1) */ 
+                    /* device/errors/link (1) */
                     switch_xml_t xlinks1 = switch_xml_add_child_d(xerrors,"link",0);
                     switch_xml_set_attr_d(xlinks1,"id","1");
 
@@ -1920,11 +1920,11 @@ void Cli::_KhompShowLinks::showErrors(unsigned int device, OutputType output_typ
                     /* device */
                     xdev = switch_xml_add_child_d(root,"device",0);
                     switch_xml_set_attr_d(xdev,"id",STR(FMT("%d") % device));
-                  
+
                     /* device/errors */
                     switch_xml_t xerrors = switch_xml_add_child_d(xdev,"errors",0);
 
-                    /* device/errors/link (0) */ 
+                    /* device/errors/link (0) */
                     switch_xml_t xlinks0 = switch_xml_add_child_d(xerrors,"link",0);
                     switch_xml_set_attr_d(xlinks0,"id","0");
 
@@ -2035,7 +2035,7 @@ bool Cli::_KhompShowLinks::execute(int argc, char *argv[])
         K::Logger::Logg2(C_CLI, stream, " ------------------------------------------------------------------------");
     }
 
-    if (as_xml) 
+    if (as_xml)
     {
         printXMLOutput(stream);
         clearRoot();
@@ -2052,8 +2052,8 @@ void Cli::_KhompClearLinks::clearLink(unsigned int device, unsigned int link)
     }
     catch(K3LAPI::failed_command & e)
     {
-        K::Logger::Logg2(C_CLI, stream, 
-                FMT("ERROR: Command has failed with error '%s'") 
+        K::Logger::Logg2(C_CLI, stream,
+                FMT("ERROR: Command has failed with error '%s'")
                 % Verbose::status((KLibraryStatus)e.rc).c_str());
     }
 }
@@ -2067,7 +2067,7 @@ bool Cli::_KhompClearLinks::execute(int argc, char *argv[])
     }
 
     unsigned int dev = UINT_MAX;
-    unsigned int obj = UINT_MAX;    
+    unsigned int obj = UINT_MAX;
 
     if(argc > 2)
     {
@@ -2075,7 +2075,7 @@ bool Cli::_KhompClearLinks::execute(int argc, char *argv[])
 
         if (!Globals::k3lapi.valid_device(dev))
         {
-            K::Logger::Logg2(C_CLI, stream, 
+            K::Logger::Logg2(C_CLI, stream,
                     FMT("ERROR: no such device %d!") % dev);
             return false;
         }
@@ -2086,7 +2086,7 @@ bool Cli::_KhompClearLinks::execute(int argc, char *argv[])
 
             if(!Globals::k3lapi.valid_link(dev, obj))
             {
-                K::Logger::Logg2(C_CLI, stream, 
+                K::Logger::Logg2(C_CLI, stream,
                       FMT("ERROR: No such link %d on device %d!") % obj % dev);
                 return false;
             }
@@ -2095,7 +2095,7 @@ bool Cli::_KhompClearLinks::execute(int argc, char *argv[])
 
     if(dev == UINT_MAX)
     {
-        K::Logger::Logg2(C_CLI, stream, 
+        K::Logger::Logg2(C_CLI, stream,
                 "NOTICE: Reseting error count of all links...");
 
         for (unsigned int d = 0; d < Globals::k3lapi.device_count(); d++)
@@ -2110,7 +2110,7 @@ bool Cli::_KhompClearLinks::execute(int argc, char *argv[])
     {
         if (obj == UINT_MAX)
         {
-            K::Logger::Logg2(C_CLI, stream, 
+            K::Logger::Logg2(C_CLI, stream,
                 FMT("NOTICE: Reseting error count of all links on device %d...")
                 % dev);
             unsigned int link_count = Globals::k3lutil.physicalLinkCount(dev, true);
@@ -2120,8 +2120,8 @@ bool Cli::_KhompClearLinks::execute(int argc, char *argv[])
         }
         else
         {
-            K::Logger::Logg2(C_CLI, stream, 
-                FMT("NOTICE: Reseting error count of link %d on device %d...") 
+            K::Logger::Logg2(C_CLI, stream,
+                FMT("NOTICE: Reseting error count of link %d on device %d...")
                 % obj % dev);
 
             clearLink(dev, obj);
@@ -2143,7 +2143,7 @@ bool Cli::_KhompClearStatistics::execute(int argc, char *argv[])
     {
 
     unsigned int dev = UINT_MAX;
-    unsigned int obj = UINT_MAX;    
+    unsigned int obj = UINT_MAX;
 
     if(argc > 2)
     {
@@ -2151,7 +2151,7 @@ bool Cli::_KhompClearStatistics::execute(int argc, char *argv[])
 
         if (!Globals::k3lapi.valid_device(dev))
         {
-            K::Logger::Logg2(C_CLI, stream, 
+            K::Logger::Logg2(C_CLI, stream,
                     FMT("ERROR: no such device %d!") % dev);
             return false;
         }
@@ -2163,7 +2163,7 @@ bool Cli::_KhompClearStatistics::execute(int argc, char *argv[])
 
             if(!Globals::k3lapi.valid_channel(dev, obj))
             {
-                K::Logger::Logg2(C_CLI, stream, 
+                K::Logger::Logg2(C_CLI, stream,
                       FMT("ERROR: No such channel %d on device %d!") % obj % dev);
                 return false;
             }
@@ -2176,7 +2176,7 @@ bool Cli::_KhompClearStatistics::execute(int argc, char *argv[])
 
         for (unsigned int d = 0; d < Globals::k3lapi.device_count(); d++)
         {
-            for (unsigned int o = 0; o < Globals::k3lapi.channel_count(d); o++) 
+            for (unsigned int o = 0; o < Globals::k3lapi.channel_count(d); o++)
                 Board::get(d, o)->clearStatistics();
         }
     }
@@ -2185,8 +2185,8 @@ bool Cli::_KhompClearStatistics::execute(int argc, char *argv[])
         if (obj == UINT_MAX)
         {
             K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Reseting statistics of all channels from board %d...") % dev);
-            
-            for (unsigned int o = 0; o < Globals::k3lapi.channel_count(dev); o++) 
+
+            for (unsigned int o = 0; o < Globals::k3lapi.channel_count(dev); o++)
                 Board::get(dev, o)->clearStatistics();
         }
         else
@@ -2208,7 +2208,7 @@ bool Cli::_KhompClearStatistics::execute(int argc, char *argv[])
 
 bool Cli::_KhompDumpConfig::execute(int argc, char *argv[])
 {
-    if (argc != 2) 
+    if (argc != 2)
     {
         printUsage(stream);
         return false;
@@ -2223,7 +2223,7 @@ bool Cli::_KhompDumpConfig::execute(int argc, char *argv[])
     for (Config::StringSet::const_iterator itr = opts.begin(); itr != opts.end(); ++itr)
     {   try
         {
-            if(removeUnavaible((*itr))) continue;                
+            if(removeUnavaible((*itr))) continue;
             K::Logger::Logg2(C_CLI, stream, FMT("| %-24s => %42s |")
                     % (*itr) % Globals::options.get(&(Opt::_options), (*itr)));
         }
@@ -2231,7 +2231,7 @@ bool Cli::_KhompDumpConfig::execute(int argc, char *argv[])
         {
             K::Logger::Logg(C_ERROR, FMT("%s (%s)") % e.what() % (*itr));
         }
-    }    
+    }
 
     K::Logger::Logg2(C_CLI, stream, " ------------------------------------------------------------------------");
 
@@ -2246,8 +2246,8 @@ void Cli::_KhompResetLinks::resetLink(unsigned int device, unsigned int link)
     }
     catch(K3LAPI::failed_command & e)
     {
-        K::Logger::Logg2(C_CLI, stream, 
-                FMT("ERROR: Command has failed with error '%s'") 
+        K::Logger::Logg2(C_CLI, stream,
+                FMT("ERROR: Command has failed with error '%s'")
                 % Verbose::status((KLibraryStatus)e.rc).c_str());
     }
 }
@@ -2261,7 +2261,7 @@ bool Cli::_KhompResetLinks::execute(int argc, char *argv[])
     }
 
     unsigned int dev = UINT_MAX;
-    unsigned int obj = UINT_MAX;    
+    unsigned int obj = UINT_MAX;
 
     if(argc > 2)
     {
@@ -2269,7 +2269,7 @@ bool Cli::_KhompResetLinks::execute(int argc, char *argv[])
 
         if (!Globals::k3lapi.valid_device(dev))
         {
-            K::Logger::Logg2(C_CLI, stream, 
+            K::Logger::Logg2(C_CLI, stream,
                     FMT("ERROR: no such device %d!") % dev);
             return false;
         }
@@ -2280,7 +2280,7 @@ bool Cli::_KhompResetLinks::execute(int argc, char *argv[])
 
             if(!Globals::k3lapi.valid_link(dev, obj))
             {
-                K::Logger::Logg2(C_CLI, stream, 
+                K::Logger::Logg2(C_CLI, stream,
                       FMT("ERROR: No such link %d on device %d!") % obj % dev);
                 return false;
             }
@@ -2289,7 +2289,7 @@ bool Cli::_KhompResetLinks::execute(int argc, char *argv[])
 
     if(dev == UINT_MAX)
     {
-        K::Logger::Logg2(C_CLI, stream, 
+        K::Logger::Logg2(C_CLI, stream,
                 "NOTICE: Reseting all links...");
 
         for (unsigned int d = 0; d < Globals::k3lapi.device_count(); d++)
@@ -2304,7 +2304,7 @@ bool Cli::_KhompResetLinks::execute(int argc, char *argv[])
     {
         if (obj == UINT_MAX)
         {
-            K::Logger::Logg2(C_CLI, stream, 
+            K::Logger::Logg2(C_CLI, stream,
                 FMT("NOTICE: Reseting all links on device %d...")
                 % dev);
             unsigned int link_count = Globals::k3lutil.physicalLinkCount(dev, true);
@@ -2314,8 +2314,8 @@ bool Cli::_KhompResetLinks::execute(int argc, char *argv[])
         }
         else
         {
-            K::Logger::Logg2(C_CLI, stream, 
-                FMT("NOTICE: Reseting link %d on device %d...") 
+            K::Logger::Logg2(C_CLI, stream,
+                FMT("NOTICE: Reseting link %d on device %d...")
                 % obj % dev);
 
             resetLink(dev, obj);
@@ -2409,7 +2409,7 @@ bool Cli::_KhompSMS::execute(int argc, char *argv[])
         }
         return false;
     }
-        
+
     K::Logger::Logg2(C_CLI, stream, "Message sent successfully!");
 
     return true;
@@ -2431,25 +2431,25 @@ bool Cli::_KhompLogConsole::execute(int argc, char *argv[])
     unsigned int total_args = argc - 2; /* remove "khomp log console" */
 
     if (extra == "no")
-    {    
+    {
         invert = true;
         --total_args;
-    }    
+    }
     else if (extra == "just")
-    {    
+    {
         unique = true;
         --total_args;
-    }    
+    }
 
     unsigned int first_args = argc - total_args;
 
     std::string options;
 
-    for (unsigned int i = first_args; i < (unsigned int)argc; i++) 
-    {    
+    for (unsigned int i = first_args; i < (unsigned int)argc; i++)
+    {
         options += argv[i];
-        options += ","; 
-    }    
+        options += ",";
+    }
 
     K::Logger::processLogConsole(stream, options, invert, unique);
     return true;
@@ -2562,7 +2562,7 @@ bool Cli::_KhompLogStatus::execute(int argc, char *argv[])
 
     if (!m2.empty()) K::Logger::Logg2(C_CLI, stream, FMT("Enabled log-on-disk messages: %s.") % m2.merge(", "));
     else /* ----- */ K::Logger::Logg2(C_CLI, stream, "There are no log-on-disk messages enabled.");
-   
+
     if (Globals::flag_trace_rdsi) K::Logger::Logg2(C_CLI, stream, "The ISDN (RDSI) low-level tracing is enabled.");
 
     K::Logger::Logg2(C_CLI, stream, "             ");
@@ -2579,9 +2579,9 @@ bool Cli::_KhompLogRotate::execute(int argc, char *argv[])
     }
 
     if (!K::Logger::rotate())
-    {    
+    {
         return false;
-    }    
+    }
 
     return true;
 }
@@ -2601,11 +2601,11 @@ bool Cli::_KhompLogTraceK3L::execute(int argc, char *argv[])
 
          if (str_on  == argv[3]) value = true;
     else if (str_off == argv[3]) value = false;
-    else 
-    {    
+    else
+    {
         K::Logger::Logg2(C_CLI, stream, "ERROR: Please use 'on' or 'off' to enable or disable.");
         return false;
-    }    
+    }
 
     K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: %sbling k3l debug messages.") % (value ? "Ena" : "Disa"));
 
@@ -2619,7 +2619,7 @@ bool Cli::_KhompLogTraceK3L::execute(int argc, char *argv[])
     K::LogConfig::set(logfile, "K3L", "Fax",          value);
 
     if (K::LogConfig::commit(logfile))
-    {    
+    {
         try
         {
             Globals::k3lapi.command(-1, -1, CM_LOG_UPDATE);
@@ -2628,7 +2628,7 @@ bool Cli::_KhompLogTraceK3L::execute(int argc, char *argv[])
         {
             LOG(ERROR,"Error while send command CM_LOG_UPDATE");
         }
-    } 
+    }
 
     return true;
 }
@@ -2761,7 +2761,7 @@ bool Cli::_KhompLogTraceR2::execute(int argc, char *argv[])
 
 bool Cli::_KhompGet::execute(int argc, char *argv[])
 {
-    if (argc < 2) 
+    if (argc < 2)
     {
         printUsage(stream);
         return false;
@@ -2769,20 +2769,20 @@ bool Cli::_KhompGet::execute(int argc, char *argv[])
 
     std::string arg(argv[1]);
 
-    try  
-    {    
+    try
+    {
        std::string res = Globals::options.get(&Opt::_options, (const char*) argv[1]);
        K::Logger::Logg2(C_CLI, stream, FMT("Result for command %s is %s.") % std::string(argv[1]) % res);
-    }catch(Config::Failure &e){ 
+    }catch(Config::Failure &e){
        K::Logger::Logg2(C_CLI, stream, e.what());
-    }    
+    }
 
     return true;
 }
 
 bool Cli::_KhompSet::execute(int argc, char *argv[])
 {
-    if (argc < 3) 
+    if (argc < 3)
     {
         printUsage(stream);
         return false;
@@ -2790,31 +2790,31 @@ bool Cli::_KhompSet::execute(int argc, char *argv[])
 
     std::string args;
 
-    const unsigned int first = 2; 
+    const unsigned int first = 2;
 
-    for (unsigned int i = first; i < (unsigned int)argc; i++) 
-    {    
+    for (unsigned int i = first; i < (unsigned int)argc; i++)
+    {
         if (i != first) { args += " "; }
 
         args += argv[i];
-    }    
+    }
 
-    try  
-    {    
+    try
+    {
         Globals::options.process(&Opt::_options, (const char *) argv[1], (const char *) args.c_str());
         const Config::Options::Messages msgs = Globals::options.commit(&Opt::_options, (const char *)argv[1]);
 
-        for (Config::Options::Messages::const_iterator i = msgs.begin(); i != msgs.end(); ++i) 
+        for (Config::Options::Messages::const_iterator i = msgs.begin(); i != msgs.end(); ++i)
         {
             K::Logger::Logg2(C_ERROR, stream, FMT("%s.") % (*i));
         }
 
         K::Logger::Logg2(C_CLI, stream, FMT("Setting %s for value %s") % argv[1] % argv[2]);
-    }    
+    }
     catch (Config::Failure &e)
-    {    
+    {
         K::Logger::Logg2(C_ERROR,stream, FMT("config processing error: %s.") % e.what());
-    }    
+    }
 
     return true;
 }
@@ -2875,10 +2875,10 @@ bool Cli::_KhompSendCommand::execute(int argc, char *argv[])
     catch(K3LAPI::failed_command &e)
     {
         if (K::Logger::Logg.classe(C_WARNING).enabled())
-        {   
+        {
             LOG(WARNING, FMT("Command '%s' has failed with error '%s'.")
                 % Verbose::commandName(e.code) % Verbose::status((KLibraryStatus)e.rc));
-        }   
+        }
 
         return false;
     }
@@ -2888,7 +2888,7 @@ bool Cli::_KhompSendCommand::execute(int argc, char *argv[])
 
 bool Cli::_KhompSendRawCommand::execute(int argc, char *argv[])
 {
-    if (argc < 6) 
+    if (argc < 6)
     {
         printUsage(stream);
         return false;
@@ -2897,30 +2897,30 @@ bool Cli::_KhompSendRawCommand::execute(int argc, char *argv[])
     unsigned int dev = atoi (argv[3]);
 
     if (dev >= Globals::k3lapi.device_count())
-    {    
+    {
         K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such device: %d!") % dev);
         return false;
-    }    
+    }
 
     unsigned int dsp = atoi (argv[4]);
 
     if (dsp >= 2)
-    {    
+    {
         K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Invalid DSP number: %d!") % dsp);
         return false;
-    }    
+    }
 
     const unsigned int base = 5;
     char commands[(argc - base)];
 
-    for (int i = base, j = 0; i < argc; i++, j++) 
-    {    
+    for (int i = base, j = 0; i < argc; i++, j++)
+    {
         if (sscanf(argv[i], "%hhx", &(commands[j])) != 1)
-        {    
+        {
             K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Invalid hexadecimal sequence: '%s'!") % argv[i]);
             return false;
-        }    
-    }    
+        }
+    }
 
     try
     {
@@ -2929,18 +2929,18 @@ bool Cli::_KhompSendRawCommand::execute(int argc, char *argv[])
     catch(K3LAPI::failed_raw_command &e)
     {
         if (K::Logger::Logg.classe(C_WARNING).enabled())
-        {   
+        {
             LOG(WARNING, FMT("(dev=%d,dsp=%d): Raw command '%s' has failed with error '%s'.")
-            % e.dev 
-            % e.dsp 
-            % Strings::hexadecimal(std::string((char*) commands,(argc - base))) 
+            % e.dev
+            % e.dsp
+            % Strings::hexadecimal(std::string((char*) commands,(argc - base)))
             % Verbose::status((KLibraryStatus)e.rc));
-        }   
+        }
 
         return false;
     }
 
-   return true; 
+   return true;
 }
 
 bool Cli::_KhompSelectSim::execute(int argc, char *argv[])
@@ -2962,7 +2962,7 @@ bool Cli::_KhompSelectSim::execute(int argc, char *argv[])
 
         if (!Globals::k3lapi.valid_device(dev))
         {
-            K::Logger::Logg2(C_CLI, stream, 
+            K::Logger::Logg2(C_CLI, stream,
                     FMT("ERROR: no such device %d!") % dev);
             return false;
         }
@@ -2980,7 +2980,7 @@ bool Cli::_KhompSelectSim::execute(int argc, char *argv[])
 
         if(!Board::get(dev, obj)->application(SELECT_SIM_CARD, NULL, num_str.c_str()))
         {
-            K::Logger::Logg2(C_CLI, stream, "ERROR: Unable to select sim card"); 
+            K::Logger::Logg2(C_CLI, stream, "ERROR: Unable to select sim card");
             return false;
         }
     }
@@ -2996,7 +2996,7 @@ bool Cli::_KhompSelectSim::execute(int argc, char *argv[])
     }
     catch(...)
     {
-        K::Logger::Logg2(C_CLI, stream, "ERROR: Unable to select sim card"); 
+        K::Logger::Logg2(C_CLI, stream, "ERROR: Unable to select sim card");
         return false;
     }
 
@@ -3016,13 +3016,13 @@ bool Cli::_KhompKommuterOnOff::execute(int argc, char *argv[])
         case -1: K::Logger::Logg2(C_CLI, stream, "ERROR: libkwd.so required for kommuter could not be found." ); return false;
         case 0:  K::Logger::Logg2(C_CLI, stream, "ERROR: none Kommuter was found on the system." );              return false;
     }
-    
+
     if (Opt::_options._kommuter_activation() == "auto")
     {
         K::Logger::Logg2(C_CLI, stream, "ERROR: Kommuter is set to be started automatically by kommuter-activation configuration.");
         return false;
     }
-    
+
     bool on_off = ARG_CMP(1, "on") ? true : false;
 
     int ret = 0;
@@ -3046,14 +3046,14 @@ bool Cli::_KhompKommuterOnOff::execute(int argc, char *argv[])
                 switch(e.rc)
                 {
                 case ksInvalidParams:
-                    K::Logger::Logg2(C_CLI,stream,FMT("ERROR: invalid timeout '%d' for Kommuter device '%d' timeout. Mininum is 0, maximum is 255.") 
+                    K::Logger::Logg2(C_CLI,stream,FMT("ERROR: invalid timeout '%d' for Kommuter device '%d' timeout. Mininum is 0, maximum is 255.")
                 % timeout % kommuter);
                     break;
                 default:
                     K::Logger::Logg2(C_CLI,stream,FMT("ERROR: could not start the kommuter device number '%d'.") % kommuter);
                     break;
                 }
-            } 
+            }
             catch(...)
             {
                 K::Logger::Logg2(C_CLI, stream, FMT("ERROR: could not start the Kommuter device number '%d'.") % kommuter);
@@ -3064,17 +3064,17 @@ bool Cli::_KhompKommuterOnOff::execute(int argc, char *argv[])
         {
             DBG(FUNC, D("kommuter watchdog timer not created because timeout is 0."));
             return false;
-        }        
-        
+        }
+
         if (start_timer)
-        {    
+        {
             if (!Globals::global_timer)
-            {    
+            {
                 K::Logger::Logg2(C_CLI, stream , "Error creating the timer for kommuter.");
                 return true;
-            }    
+            }
             else if (Board::kommuter._kwtd_timer_on)
-            {    
+            {
                 Globals::global_timer->restart( Board::kommuter._kwtd_timer_index, true );
                 DBG(FUNC, D("kommuter watchdog timer restarted."));
             }
@@ -3084,20 +3084,20 @@ bool Cli::_KhompKommuterOnOff::execute(int argc, char *argv[])
                 Board::kommuter._kwtd_timer_on = true;
                 DBG(FUNC, D("kommuter watchdog timer created and started."));
             }
-        }    
-    }    
-    else 
-    {    
+        }
+    }
+    else
+    {
         K::Logger::Logg2(C_CLI, stream, "NOTICE: Deactivating Kommuters.");
 
         if (Board::kommuter._kwtd_timer_on)
-        {    
+        {
             Globals::global_timer->del( Board::kommuter._kwtd_timer_index);
             Board::kommuter._kwtd_timer_on = false;
-        }    
+        }
 
         for(int kommuter = 0; kommuter < Board::kommuter._kommuter_count; kommuter++)
-        {    
+        {
             try
             {
                 Globals::k3lapi.command(-1, kommuter, CM_STOP_WATCHDOG);
@@ -3106,12 +3106,12 @@ bool Cli::_KhompKommuterOnOff::execute(int argc, char *argv[])
             catch(K3LAPI::failed_command & e)
             {
                 K::Logger::Logg2(C_CLI,stream,FMT("ERROR: Kommuter device '%d' was not initialized.") % kommuter);
-            } 
+            }
             catch(...)
             {
                 K::Logger::Logg2(C_CLI, stream,FMT("ERROR: could not disable kommuter device '%d' for some unknow reason.") % kommuter);
             }
-        }    
+        }
     }
 
     return false;
@@ -3127,13 +3127,13 @@ bool Cli::_KhompKommuterCount::execute(int argc, char *argv[])
 
     if(Board::kommuter._kommuter_count == -1)
     {
-        K::Logger::Logg2(C_CLI, stream, 
+        K::Logger::Logg2(C_CLI, stream,
                 "ERROR: libkwd.so required for kommuter could not be found." );
         return false;
     }
 
-    K::Logger::Logg2(C_CLI, stream, 
-            FMT("Kommuter devices detected = [%d]") 
+    K::Logger::Logg2(C_CLI, stream,
+            FMT("Kommuter devices detected = [%d]")
             % Board::kommuter._kommuter_count);
 
     return true;
index ea526366a34e6ca6a5d18cc605c79ff69dc8841b..ad2b105772bccf9eb008119df49245f89db12494 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
index d43ff53beecfe849f51856ca122acc8c270d7aff..b5d22a261eb19fc05ad8697043e146a0a3fecb5f 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
index e60056fb9fe9f5ef64b266107c83353fc13ea9ec..c8058e8e2debf7a53102cee0c8219d620759ee14 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -60,8 +60,8 @@ Board::KhompPvt::KhompPvt(K3LAPIBase::GenericTarget & target) :
   _session(NULL),
   _caller_profile(NULL),
   _reader_frames(&_read_codec),
-  _writer_frames(&_write_codec) 
-{    
+  _writer_frames(&_write_codec)
+{
     _read_codec.implementation = NULL;
     _write_codec.implementation = NULL;
 
@@ -74,7 +74,7 @@ Board::KhompPvt::KhompPvt(K3LAPIBase::GenericTarget & target) :
 
 bool Board::initializeK3L(void)
 {
-    LOG(MESSAGE, "starting K3L API ..."); 
+    LOG(MESSAGE, "starting K3L API ...");
 
     /* Start the API and connect to KServer */
     k3lSetGlobalParam (klpResetFwOnStartup, 1);
@@ -90,8 +90,8 @@ bool Board::initializeK3L(void)
         return false;
     }
 
-    LOG(MESSAGE, "the K3L API have been started!"); 
-    
+    LOG(MESSAGE, "the K3L API have been started!");
+
     return true;
 }
 
@@ -107,7 +107,7 @@ bool Board::finalizeK3L(void)
         LOG(ERROR, "K3L not stopped");
         return false;
     }
-    LOG(MESSAGE, "K3L stopped.."); 
+    LOG(MESSAGE, "K3L stopped..");
     return true;
 }
 
@@ -133,7 +133,7 @@ bool Board::initializeHandlers(void)
     k3lRegisterEventHandler( khompEventCallback );
     k3lRegisterAudioListener( NULL, khompAudioListener );
 
-    LOG(MESSAGE, "K3l event and audio handlers registered."); 
+    LOG(MESSAGE, "K3l event and audio handlers registered.");
 
     return true;
 }
@@ -159,7 +159,7 @@ bool Board::finalizeHandlers(void)
                                it_dev != _boards.end();
                                it_dev++)
     {
-        Board * device = *it_dev;        
+        Board * device = *it_dev;
         // stop event handler for device
         ChanEventHandler * evt_handler = device->_event_handler;
         evt_handler->fifo()->_shutdown = true;
@@ -179,7 +179,7 @@ bool Board::finalizeHandlers(void)
     /* wait every thread to finalize */
     sleep(1);
 
-    LOG(MESSAGE, "K3l event and audio handlers unregistered."); 
+    LOG(MESSAGE, "K3l event and audio handlers unregistered.");
 
     return true;
 
@@ -190,7 +190,7 @@ void Board::initializeBoards(void)
 
     for (unsigned dev = 0; dev < Globals::k3lapi.device_count(); dev++)
     {
-        LOG(MESSAGE,FMT("loading device %d..." ) % dev); 
+        LOG(MESSAGE,FMT("loading device %d..." ) % dev);
 
         switch(Globals::k3lapi.device_type(dev))
         {
@@ -226,17 +226,17 @@ void Board::initializeBoards(void)
                     break;
             default:
                 _boards.push_back(new Board(dev));
-                LOG(ERROR,FMT("device type %d unknown" ) %  Globals::k3lapi.device_type(dev)); 
+                LOG(ERROR,FMT("device type %d unknown" ) %  Globals::k3lapi.device_type(dev));
                 break;
         }
-        
+
         _boards.back()->initializeChannels();
     }
 }
 
 void Board::initializeChannels(void)
 {
-    LOG(MESSAGE, "loading channels ..."); 
+    LOG(MESSAGE, "loading channels ...");
 
     for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++)
     {
@@ -253,7 +253,7 @@ void Board::initializeChannels(void)
                 DBG(FUNC, FMT("signaling %d unknown") % Globals::k3lapi.channel_config(_device_id, obj).Signaling);
                 break;
         }
-        
+
         _channels.push_back(pvt);
 
         pvt->cleanup();
@@ -262,7 +262,7 @@ void Board::initializeChannels(void)
 
 void Board::finalizeBoards(void)
 {
-    LOG(MESSAGE, "finalizing boards ..."); 
+    LOG(MESSAGE, "finalizing boards ...");
 
     for (VectorBoard::iterator it_dev = _boards.begin();
                                it_dev != _boards.end();
@@ -282,7 +282,7 @@ void Board::finalizeBoards(void)
 
 void Board::finalizeChannels()
 {
-    LOG(MESSAGE, "finalizing channels ..."); 
+    LOG(MESSAGE, "finalizing channels ...");
     for (VectorChannel::iterator it_obj = _channels.begin();
          it_obj != _channels.end();
          it_obj++)
@@ -443,27 +443,27 @@ std::string Board::KhompPvt::PvtStatistics::getDetailedRates()
     if (_pvt->call()->statistics()->_total_idle_time > 0)
     {
         occupation_rate = 100 * (
-            _pvt->call()->statistics()->_total_time_incoming + 
+            _pvt->call()->statistics()->_total_time_incoming +
             _pvt->call()->statistics()->_total_time_outgoing
             ) / (
-            _pvt->call()->statistics()->_total_idle_time + 
-            _pvt->call()->statistics()->_total_time_incoming + 
+            _pvt->call()->statistics()->_total_idle_time +
+            _pvt->call()->statistics()->_total_time_incoming +
             _pvt->call()->statistics()->_total_time_outgoing);
     }
 
     strBuffer.append(STG(FMT("Occupation rate: \t\t%0.2f%%\n") % occupation_rate));
 
-    if (call_incoming > 0) 
-    {    
+    if (call_incoming > 0)
+    {
         std::string str_calls_incoming_mean = timeToString ( (time_t) (_pvt->call()->statistics()->_total_time_incoming / call_incoming) );
         strBuffer.append(STG(FMT("Mean duration time of incoming calls: %s\n") % str_calls_incoming_mean));
-    }    
+    }
 
-    if (call_outgoing > 0) 
-    {    
+    if (call_outgoing > 0)
+    {
         std::string str_calls_outgoing_mean = timeToString ( (time_t) (_pvt->call()->statistics()->_total_time_outgoing / call_outgoing) );
         strBuffer.append(STG(FMT("Mean duration time of outgoing calls: %s\n") % str_calls_outgoing_mean));
-    }    
+    }
 
     return strBuffer;
 }
@@ -483,42 +483,42 @@ switch_xml_t Board::KhompPvt::PvtStatistics::getDetailedRatesXML()
     if (_pvt->call()->statistics()->_total_idle_time > 0)
     {
         occupation_rate = 100 * (
-            _pvt->call()->statistics()->_total_time_incoming + 
+            _pvt->call()->statistics()->_total_time_incoming +
             _pvt->call()->statistics()->_total_time_outgoing
             ) / (
-            _pvt->call()->statistics()->_total_idle_time + 
-            _pvt->call()->statistics()->_total_time_incoming + 
+            _pvt->call()->statistics()->_total_idle_time +
+            _pvt->call()->statistics()->_total_time_incoming +
             _pvt->call()->statistics()->_total_time_outgoing);
     }
 
     switch_xml_t xoccupation = switch_xml_add_child_d(xrates,"oucpation",0);
     switch_xml_set_txt_d(xoccupation,STR(FMT("%d") % occupation_rate));
 
-    if (call_incoming > 0) 
-    {    
+    if (call_incoming > 0)
+    {
         std::string str_calls_incoming_mean = timeToString ( (time_t) (_pvt->call()->statistics()->_total_time_incoming / call_incoming) );
         switch_xml_t xmean_in = switch_xml_add_child_d(xrates,"incoming",0);
         switch_xml_set_txt_d(xmean_in,str_calls_incoming_mean.c_str());
-    }    
+    }
 
-    if (call_outgoing > 0) 
-    {    
+    if (call_outgoing > 0)
+    {
         std::string str_calls_outgoing_mean = timeToString ( (time_t) (_pvt->call()->statistics()->_total_time_outgoing / call_outgoing) );
         switch_xml_t xmean_out = switch_xml_add_child_d(xrates,"outgoing",0);
         switch_xml_set_txt_d(xmean_out,str_calls_outgoing_mean.c_str());
-    }    
+    }
 
     return xrates;
 }
 
 std::string Board::KhompPvt::PvtStatistics::getDetailed()
-{ 
+{
     /* skip inactive channels */
     //if (_pvt->getSignaling() == ksigInactive) return "";
 
     /* buffer our data to return at the end */
     std::string strBuffer;
-            
+
     strBuffer.append(_pvt->call()->statistics()->getDetailed());
 
     /* this values come from kserver */
@@ -534,7 +534,7 @@ std::string Board::KhompPvt::PvtStatistics::getDetailed()
     strBuffer.append(STG(FMT("Number of calls failed: \t%d\n") % call_fails));
 
     strBuffer.append(getDetailedRates());
-    
+
     return strBuffer;
 }
 
@@ -566,14 +566,14 @@ switch_xml_t Board::KhompPvt::PvtStatistics::getDetailedXML()
     return xch;
 }
 
-std::string Board::KhompPvt::PvtStatistics::getRow() 
+std::string Board::KhompPvt::PvtStatistics::getRow()
 {
     /* skip inactive channels */
     //if (_pvt->getSignaling() == ksigInactive) return "";
 
     time_t action_time;
     time (&action_time);
-   
+
     action_time -= _pvt->call()->statistics()->_base_time;
 
     uint32 calls_incoming = Globals::k3lapi.channel_stats(
@@ -582,7 +582,7 @@ std::string Board::KhompPvt::PvtStatistics::getRow()
             _pvt->target().device, _pvt->target().object, kcsiOutbound);
     uint32 call_fails     = Globals::k3lapi.channel_stats(
             _pvt->target().device, _pvt->target().object, kcsiOutFailed);
-    
+
     std::string string_time = "  n/a  ";
     std::string call_type   = "  none  ";
 
@@ -592,19 +592,19 @@ std::string Board::KhompPvt::PvtStatistics::getRow()
         call_type = "outgoing";
 
     if (_pvt->owner())
-    {    
+    {
         string_time = timeToString(action_time);
-    }    
+    }
 
     return  STG(FMT("| %d,%02d | %8d | %8d | %8d | %7d | %10s | %8s | %8s |")
-            % _pvt->target().device 
-            % _pvt->target().object 
-            % calls_incoming 
-            % calls_outgoing 
+            % _pvt->target().device
+            % _pvt->target().object
+            % calls_incoming
+            % calls_outgoing
             % _pvt->call()->statistics()->_channel_fails
-            % call_fails 
-            % _pvt->getStateString() 
-            % call_type 
+            % call_fails
+            % _pvt->getStateString()
+            % call_type
             % string_time);
 }
 
@@ -612,7 +612,7 @@ switch_xml_t Board::KhompPvt::PvtStatistics::getNode()
 {
     time_t action_time;
     time (&action_time);
-   
+
     action_time -= _pvt->call()->statistics()->_base_time;
 
     uint32 calls_incoming = Globals::k3lapi.channel_stats(
@@ -621,7 +621,7 @@ switch_xml_t Board::KhompPvt::PvtStatistics::getNode()
             _pvt->target().device, _pvt->target().object, kcsiOutbound);
     uint32 call_fails     = Globals::k3lapi.channel_stats(
             _pvt->target().device, _pvt->target().object, kcsiOutFailed);
-    
+
     std::string string_time = "  n/a  ";
     std::string call_type   = "  none  ";
 
@@ -631,9 +631,9 @@ switch_xml_t Board::KhompPvt::PvtStatistics::getNode()
         call_type = "outgoing";
 
     if (_pvt->owner())
-    {    
+    {
         string_time = timeToString(action_time);
-    }    
+    }
 
     /* device/channel */
     switch_xml_t xchn = switch_xml_new("channel");
@@ -685,9 +685,9 @@ switch_status_t Board::KhompPvt::justAlloc(bool is_answering, switch_memory_pool
         {
 #if SWITCH_LESS_THAN(1,0,6)
             session(switch_core_session_request(Globals::khomp_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL));
-#else            
+#else
             session(switch_core_session_request(Globals::khomp_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL));
-#endif            
+#endif
         }
         else
         {
@@ -698,7 +698,7 @@ switch_status_t Board::KhompPvt::justAlloc(bool is_answering, switch_memory_pool
     {
         /* Create a new session on outgoing call */
         call()->_flags.set(Kflags::IS_OUTGOING);
-#if SWITCH_LESS_THAN(1,0,6)        
+#if SWITCH_LESS_THAN(1,0,6)
         session(switch_core_session_request(Globals::khomp_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool));
 #else
         session(switch_core_session_request(Globals::khomp_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, SOF_NONE, pool));
@@ -772,7 +772,7 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile)
     try
     {
         switch_channel_t *channel = getFSChannel();
-        
+
         if(call()->_flags.check(Kflags::IS_INCOMING))
         {
             std::string exten("s");
@@ -792,14 +792,14 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile)
                     return SWITCH_STATUS_FALSE;
                 }
 
-                switch(MatchExtension::findExtension(exten, context, contexts, _call->_dest_addr, _call->_orig_addr)) 
+                switch(MatchExtension::findExtension(exten, context, contexts, _call->_dest_addr, _call->_orig_addr))
                 {
                     case MatchExtension::MATCH_NONE:
                         destroy();
                         owner(NULL);
                         LOG(ERROR, PVT_FMT(_target, "r (unable to find exten/context on incoming call %s/%s)")
                                 % _call->_dest_addr % (contexts.size() >= 1 ? contexts[0] : "default"));
-                        return SWITCH_STATUS_FALSE; 
+                        return SWITCH_STATUS_FALSE;
                     default:
                         DBG(FUNC, PVT_FMT(_target, "our: dialplan '%s', context '%s', exten '%s'") % Opt::_options._dialplan() % context % exten);
                         break;
@@ -812,7 +812,7 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile)
                 exten = call()->_dest_addr;
                 DBG(FUNC, PVT_FMT(target(), "already found our: dialplan '%s', context '%s', exten '%s'") % Opt::_options._dialplan() % call()->_incoming_context % exten);
             }
-            
+
             _caller_profile = switch_caller_profile_new(switch_core_session_get_pool(_session),
                     "Khomp",                           //username
                     Opt::_options._dialplan().c_str(), //dialplan
@@ -880,14 +880,14 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile)
     {
         destroy();
         owner(NULL);
-        DBG(FUNC, PVT_FMT(target(), "r (%s)") % err._msg.c_str()); 
+        DBG(FUNC, PVT_FMT(target(), "r (%s)") % err._msg.c_str());
         return SWITCH_STATUS_FALSE;
     }
 
     DBG(FUNC, PVT_FMT(target(), "r"));
     return SWITCH_STATUS_SUCCESS;
 }
-        
+
 int Board::KhompPvt::makeCall(std::string params)
 {
     DBG(FUNC, PVT_FMT(target(), "Dialing to %s from %s")
@@ -896,7 +896,7 @@ int Board::KhompPvt::makeCall(std::string params)
 
     /* Lets make the call! */
     std::string full_params;
-    
+
     if(!_call->_dest_addr.empty())
         full_params += STG(FMT(" dest_addr=\"%s\"")
                 % _call->_dest_addr);
@@ -970,7 +970,7 @@ bool Board::KhompPvt::indicateBusyUnlocked(int cause, bool sent_signaling)
         }
         else
         {
-            DBG(FUNC, PVT_FMT(target(), "r (already playing something: %d)") 
+            DBG(FUNC, PVT_FMT(target(), "r (already playing something: %d)")
                     % call()->_indication);
             return false;
         }
@@ -979,7 +979,7 @@ bool Board::KhompPvt::indicateBusyUnlocked(int cause, bool sent_signaling)
     setHangupCause(cause, false);
 
     call()->_indication = INDICA_BUSY;
-        
+
     DBG(FUNC, PVT_FMT(target(), "r"));
 
     return true;
@@ -993,13 +993,13 @@ void Board::KhompPvt::destroy(switch_core_session_t * s)
     {
         if(!_session)
             return;
-    
+
         tmp_session = _session;
     }
     else
     {
         tmp_session = s;
-        
+
     }
 
     switch_core_session_destroy(&tmp_session);
@@ -1012,7 +1012,7 @@ void Board::KhompPvt::destroyAll()
         switch_core_session_set_private(_session, NULL);
         _session = NULL;
     }
-    
+
     owner(NULL);
 
     if(_caller_profile)
@@ -1072,17 +1072,17 @@ bool Board::KhompPvt::cleanup(CleanupType type)
 
     _reader_frames.clear();
     _writer_frames.clear();
-    
+
     call()->_flags.clear(Kflags::CONNECTED);
-    
+
     //call()->_flags.clear(Kflags::BRIDGED);
-    
+
     call()->_flags.clear(Kflags::DROP_COLLECT);
-    
+
     call()->_flags.clear(Kflags::OUT_OF_BAND_DTMFS);
 
     call()->_flags.clear(Kflags::WAIT_SEND_DTMF);
-    
+
     call()->_flags.clear(Kflags::GEN_PBX_RING);
     call()->_flags.clear(Kflags::GEN_CO_RING);
 
@@ -1095,7 +1095,7 @@ bool Board::KhompPvt::cleanup(CleanupType type)
     {
         LOG(ERROR, PVT_FMT(_target, "Unable to get device: %d!") % err.device);
     }
-        
+
     call()->_idx_pbx_ring.reset();
     call()->_idx_co_ring.reset();
 
@@ -1125,12 +1125,12 @@ bool Board::KhompPvt::cleanup(CleanupType type)
             setVolume("input" , Opt::_options._input_volume());
 
         if(call()->_output_volume >= -10 && call()->_output_volume <= 10)
-            setVolume("output", Opt::_options._output_volume());        
+            setVolume("output", Opt::_options._output_volume());
 
         return _call->clear();
     case CLN_SOFT:
         if(call()->_cadence != PLAY_FASTBUSY)
-        {    
+        {
             /* pára cadências e limpa estado das flags */
             stopCadence();
         }
@@ -1231,7 +1231,7 @@ void Board::applyGlobalVolume(void)
     DBG(FUNC, "c");
 
     for (unsigned int dev = 0; dev < Globals::k3lapi.device_count(); dev++)
-    {    
+    {
         for (unsigned int obj = 0; obj < Globals::k3lapi.channel_count(dev); obj++)
         {
             try
@@ -1243,13 +1243,13 @@ void Board::applyGlobalVolume(void)
             {
                 DBG(FUNC, OBJ_FMT(dev, obj, "Channel not found"));
             }
-        }    
-    }    
-    
+        }
+    }
+
     DBG(FUNC, "r");
 }
 
-bool Board::KhompPvt::startCadence(CadencesType type) 
+bool Board::KhompPvt::startCadence(CadencesType type)
 {
     DBG(FUNC, PVT_FMT(target(), "c"));
 
@@ -1263,30 +1263,30 @@ bool Board::KhompPvt::startCadence(CadencesType type)
 
 
     if (tone != "")
-    {    
+    {
         call()->_cadence = type;
 
         CadencesMapType::iterator i = Opt::_cadences.find(tone);
         std::string cmd_params;
 
         if (i != Opt::_cadences.end())
-        {    
+        {
             CadenceType cadence = (*i).second;
 
             if (cadence.ring == 0 && cadence.ring_s == 0)
-            {    
+            {
                 cmd_params = "cadence_times=\"continuous\" mixer_track=1";
-            }    
+            }
             else if (cadence.ring_ext == 0 && cadence.ring_ext_s == 0)
-            {    
+            {
                 cmd_params = STG(FMT("cadence_times=\"%d,%d\" mixer_track=1")
                     % cadence.ring % cadence.ring_s);
-            }    
-            else 
-            {    
+            }
+            else
+            {
                 cmd_params = STG(FMT("cadence_times=\"%d,%d,%d,%d\" mixer_track=1")
                     % cadence.ring % cadence.ring_s % cadence.ring_ext % cadence.ring_ext_s);
-            }    
+            }
 
             command(KHOMP_LOG,CM_START_CADENCE,cmd_params.c_str());
         }
@@ -1392,7 +1392,7 @@ bool Board::KhompPvt::obtainRX(bool with_delay)
     {
         LOG(ERROR, PVT_FMT(target(), "ERROR sending mixer command!"));
         return false;
-    }    
+    }
 
     return true;
 }
@@ -1418,7 +1418,7 @@ bool Board::KhompPvt::obtainTX()
     {
         LOG(ERROR, PVT_FMT(target(), "ERROR sending mixer command!"));
         return false;
-    }    
+    }
 
     return true;
 }
@@ -1451,7 +1451,7 @@ bool Board::KhompPvt::sendDtmf(std::string digit)
     }
 
     DBG(FUNC, PVT_FMT(target(), "sending dtmf (%s)") % digit);
-    
+
     call()->_flags.set(Kflags::WAIT_SEND_DTMF);
 
     return command(KHOMP_LOG, CM_DIAL_DTMF, digit.c_str());
@@ -1477,7 +1477,7 @@ std::string Board::KhompPvt::getStateString(void)
         typedef std::string S;
 
         switch (state)
-        {    
+        {
             case CS_NEW:               return S("new");
             case CS_INIT:              return S("init");
             case CS_ROUTING:           return S("routing");
@@ -1494,7 +1494,7 @@ std::string Board::KhompPvt::getStateString(void)
             case CS_NONE:              return S("none");
             default:
                 return STG(FMT("none (%d)") % state);
-        }    
+        }
     }
     catch(Board::KhompPvt::InvalidSwitchChannel & err)
     {
@@ -1510,9 +1510,9 @@ bool Board::KhompPvt::dtmfSuppression(bool enable)
     if (enable) call()->_flags.set(Kflags::OUT_OF_BAND_DTMFS);
     else        call()->_flags.clear(Kflags::OUT_OF_BAND_DTMFS);
 
-    DBG(FUNC, PVT_FMT(_target, "flag OUT_OF_BAND_DTMFS is : %s") % 
+    DBG(FUNC, PVT_FMT(_target, "flag OUT_OF_BAND_DTMFS is : %s") %
         (call()->_flags.check(Kflags::OUT_OF_BAND_DTMFS) ? "true" : "false"));
-    
+
     return true;
 }
 
@@ -1549,8 +1549,8 @@ void Board::KhompPvt::pbxRingGen(Board::KhompPvt * pvt)
 {
     DBG(FUNC, PVT_FMT(pvt->target(), "Generating pbx ring"));
 
-    try 
-    {   
+    try
+    {
         ScopedPvtLock lock(pvt);
 
         if (!pvt->call()->_flags.check(Kflags::GEN_PBX_RING))
@@ -1560,7 +1560,7 @@ void Board::KhompPvt::pbxRingGen(Board::KhompPvt * pvt)
             return;
 
         pvt->startCadence(PLAY_RINGBACK);
-    }   
+    }
     catch (...)
     {
         LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock!"));
@@ -1571,19 +1571,19 @@ void Board::KhompPvt::coRingGen(Board::KhompPvt * pvt)
 {
     DBG(FUNC, PVT_FMT(pvt->target(), "Generating co ring"));
 
-    try 
-    {   
+    try
+    {
         ScopedPvtLock lock(pvt);
 
         if (!pvt->call()->_flags.check(Kflags::GEN_CO_RING))
             return;
 
         pvt->startCadence(PLAY_RINGBACK);
-    }   
+    }
     catch (...)
     {
         LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock the pvt !"));
-    }  
+    }
 }
 
 int Board::KhompPvt::getActiveChannel(bool invalid_as_not_found)
@@ -1598,7 +1598,7 @@ bool Board::KhompPvt::setCollectCall()
     // NEEDS LOCK !?
 
     std::vector< TriState > confvalues;
+
     // temporary!
     const char * tmp_var = NULL;
 
@@ -1613,7 +1613,7 @@ bool Board::KhompPvt::setCollectCall()
 
     freeFSGlobalVar(&tmp_var);
 
-    try 
+    try
     {
         // get local filter configuration value
         tmp_var = switch_channel_get_variable(getFSChannel(), "KDropCollectCall");
@@ -1622,7 +1622,7 @@ bool Board::KhompPvt::setCollectCall()
     }
     catch(Board::KhompPvt::InvalidSwitchChannel & err)
     {
-        LOG(ERROR, PVT_FMT(_target, "Cannot obtain the channel variable: %s") % err._msg.c_str()); 
+        LOG(ERROR, PVT_FMT(_target, "Cannot obtain the channel variable: %s") % err._msg.c_str());
     }
 
     // store last state assigned
@@ -1731,7 +1731,7 @@ bool Board::KhompPvt::onNewCall(K3L_EVENT *e)
             setHangupCause(SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL);
             cleanup(CLN_FAIL);
             reportFailToReceive(fail_code);
-            
+
             LOG(ERROR, PVT_FMT(target(), "r (Initilization Error on start!)"));
             return false;
         }
@@ -1755,7 +1755,7 @@ bool Board::KhompPvt::onNewCall(K3L_EVENT *e)
 
 bool Board::KhompPvt::onDisconnect(K3L_EVENT *e)
 {
-    DBG(FUNC, PVT_FMT(_target, "c"));   
+    DBG(FUNC, PVT_FMT(_target, "c"));
 
 /*
     try
@@ -1770,7 +1770,7 @@ bool Board::KhompPvt::onDisconnect(K3L_EVENT *e)
     }
 */
 
-    DBG(FUNC, PVT_FMT(_target, "r"));   
+    DBG(FUNC, PVT_FMT(_target, "r"));
     return true;
 }
 
@@ -1782,39 +1782,39 @@ bool Board::KhompPvt::onAudioStatus(K3L_EVENT *e)
         {
             if(call()->_flags.check(Kflags::GEN_PBX_RING))
             {
-                DBG(FUNC, PVT_FMT(_target, "PBX ringback being disabled..."));   
+                DBG(FUNC, PVT_FMT(_target, "PBX ringback being disabled..."));
                 ScopedPvtLock lock(this);
 
                 call()->_flags.clear(Kflags::GEN_PBX_RING);
                 Board::board(_target.device)->_timers.del(call()->_idx_pbx_ring);
 
                 if(call()->_cadence != PLAY_VM_TONE)
-                {    
+                {
                     stopCadence();
                 }
 
                 if (!call()->_flags.check(Kflags::CONNECTED))
                 {
                     obtainRX(Opt::_options._suppression_delay());
-            
+
                     //Marcar para o Freeswitch que jah tem audio passando
                     if (call()->_flags.check(Kflags::IS_OUTGOING))
                         switch_channel_mark_pre_answered(getFSChannel());
 
                 }
             }
-            
+
             if (!call()->_is_progress_sent && call()->_flags.check(Kflags::HAS_CALL_FAIL))
             {
 
                 ScopedPvtLock lock(this);
 
-                DBG(FUNC, PVT_FMT(_target, "Audio status progress"));   
+                DBG(FUNC, PVT_FMT(_target, "Audio status progress"));
 
                 call()->_is_progress_sent = true;
                 //Sinaliza para o Freeswitch PROGRESS
 
-                DBG(FUNC, PVT_FMT(_target, "Pre answer"));   
+                DBG(FUNC, PVT_FMT(_target, "Pre answer"));
 
                 //pvt->signal_state(AST_CONTROL_PROGRESS);
                 switch_channel_pre_answer(getFSChannel());
@@ -1844,23 +1844,23 @@ bool Board::KhompPvt::onAudioStatus(K3L_EVENT *e)
 
 bool Board::KhompPvt::onCollectCall(K3L_EVENT *e)
 {
-    try  
-    {    
+    try
+    {
         ScopedPvtLock lock(this);
 
-        //TODO: AMI ? 
+        //TODO: AMI ?
         //K::internal::ami_event(pvt, EVENT_FLAG_CALL, "CollectCall",
           //      STG(FMT("Channel: Khomp/B%dC%d\r\n") % pvt->boardid % pvt->objectid));
 
         if (Opt::_options._drop_collect_call() || _call->_flags.check(Kflags::DROP_COLLECT))
-        {     
+        {
             /* disconnect! */
             //TODO: SCE_HIDE !?
             command(KHOMP_LOG,CM_DISCONNECT);
 //           command(KHOMP_LOG,CM_DISCONNECT,SCE_HIDE);
 
-        }    
-    }    
+        }
+    }
     catch (ScopedLockFailed & err)
     {
         LOG(ERROR, PVT_FMT(_target, "unable to lock %s!") % err._msg.c_str() );
@@ -1890,15 +1890,15 @@ bool Board::KhompPvt::setupConnection()
 {
     if(!call()->_flags.check(Kflags::IS_INCOMING) && !call()->_flags.check(Kflags::IS_OUTGOING))
     {
-        DBG(FUNC, PVT_FMT(_target, "Channel already disconnected"));   
+        DBG(FUNC, PVT_FMT(_target, "Channel already disconnected"));
         return false;
     }
 
     if(call()->_cadence != PLAY_VM_TONE)
-    {    
+    {
         stopCadence();
     }
-        
+
     if (call()->_indication != INDICA_NONE)
     {
         call()->_indication = INDICA_NONE;
@@ -1926,12 +1926,12 @@ bool Board::KhompPvt::setupConnection()
 
     /* Sinalizar para o Freeswitch o atendimento */
 
-    DBG(FUNC, PVT_FMT(_target, "Call will be answered."));   
+    DBG(FUNC, PVT_FMT(_target, "Call will be answered."));
 
     if(call()->_flags.check(Kflags::IS_INCOMING))
     {
         switch_channel_answer(getFSChannel());
-    }   
+    }
     else if(call()->_flags.check(Kflags::IS_OUTGOING))
     {
         switch_channel_mark_answered(getFSChannel());
@@ -1950,7 +1950,7 @@ bool Board::KhompPvt::onConnect(K3L_EVENT *e)
     try
     {
         ScopedPvtLock lock(this);
-    
+
         return setupConnection();
     }
     catch (ScopedLockFailed & err)
@@ -1968,7 +1968,7 @@ bool Board::KhompPvt::onConnect(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(_target, "r (unable to get device: %d!)") % err.device);
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "r"));
 
     return true;
@@ -1976,8 +1976,8 @@ bool Board::KhompPvt::onConnect(K3L_EVENT *e)
 
 bool Board::KhompPvt::onCallSuccess(K3L_EVENT *e)
 {
-    DBG(FUNC, PVT_FMT(_target, "c"));   
+    DBG(FUNC, PVT_FMT(_target, "c"));
+
     try
     {
         ScopedPvtLock lock(this);
@@ -2008,7 +2008,7 @@ bool Board::KhompPvt::onCallFail(K3L_EVENT *e)
        ScopedPvtLock lock(this);
 
         call()->_flags.set(Kflags::HAS_CALL_FAIL);
-    
+
        //TODO: Notificar o Freeswitch: call fail
 
         cleanup(CLN_SOFT);
@@ -2018,7 +2018,7 @@ bool Board::KhompPvt::onCallFail(K3L_EVENT *e)
        LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() );
        return false;
    }
-   
+
    DBG(FUNC, PVT_FMT(_target, "r"));
 
    return true;
@@ -2027,14 +2027,14 @@ bool Board::KhompPvt::onCallFail(K3L_EVENT *e)
 bool Board::KhompPvt::onNoAnswer(K3L_EVENT *e)
 {
     /* TODO: Destroy sessions and channels */
-    DBG(FUNC, PVT_FMT(_target, "No one answered the call."));   
+    DBG(FUNC, PVT_FMT(_target, "No one answered the call."));
 
-    // TODO: Set channel variable if we get this event 
-    // TODO: Fire an event so ESL can get it? 
-    // Call Analyser has to be enabled on k3lconfig 
-    DBG(FUNC, PVT_FMT(_target, "Detected: \"%s\"") %  Verbose::callStartInfo((KCallStartInfo)e->AddInfo).c_str());   
+    // TODO: Set channel variable if we get this event
+    // TODO: Fire an event so ESL can get it?
+    // Call Analyser has to be enabled on k3lconfig
+    DBG(FUNC, PVT_FMT(_target, "Detected: \"%s\"") %  Verbose::callStartInfo((KCallStartInfo)e->AddInfo).c_str());
 
-    // Fire a custom event about this 
+    // Fire a custom event about this
     /* MUST USE THE NEW EVENT SYSTEM
     switch_event_t * event;
     if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, KHOMP_EVENT_MAINT) == SWITCH_STATUS_SUCCESS)
@@ -2060,33 +2060,33 @@ bool Board::KhompPvt::onDtmfDetected(K3L_EVENT *e)
         ScopedPvtLock lock(this);
 
         if (call()->_flags.check(Kflags::IS_INCOMING) || call()->_flags.check(Kflags::IS_OUTGOING)) /* is a valid call? */
-        {    
+        {
             char digit = (char) e->AddInfo;
 
-            //TODO: WTHeck ? 
+            //TODO: WTHeck ?
             //if (!call()->_flags.check(Kflags::OUT_OF_BAND_DTMFS) && !call()->_flags.check(Kflags::BRIDGED))
             if (!call()->_flags.check(Kflags::OUT_OF_BAND_DTMFS))
-            {    
+            {
                 /* we do not queue dtmfs as we do not need to resend them */
                 DBG(FUNC, PVT_FMT(_target, "r (not queueing dtmf, not needed.)"));
                 return true;
-            }    
+            }
 
             if (Opt::_options._ignore_letter_dtmfs())
-            {    
+            {
                 switch (e->AddInfo)
-                {    
-                    case 'A': case 'a': 
-                    case 'B': case 'b': 
-                    case 'C': case 'c': 
-                    case 'D': case 'd': 
+                {
+                    case 'A': case 'a':
+                    case 'B': case 'b':
+                    case 'C': case 'c':
+                    case 'D': case 'd':
                         DBG(FUNC, PVT_FMT(_target, "r (not queueing dtmf, letter digit ignored!)"));
                         return true;
                     default:
                         break;
-                }    
+                }
             }
-            
+
             signalDTMF(e->AddInfo);
         }
     }
@@ -2112,10 +2112,10 @@ bool Board::KhompPvt::onDtmfSendFinish(K3L_EVENT *e)
         {
             if(!call()->_queued_digits_buffer.empty())
             {
-                DBG(FUNC, PVT_FMT(target(), "sending dtmf (%s)") 
+                DBG(FUNC, PVT_FMT(target(), "sending dtmf (%s)")
                         % call()->_queued_digits_buffer);
 
-                command(KHOMP_LOG, CM_DIAL_DTMF, 
+                command(KHOMP_LOG, CM_DIAL_DTMF,
                         call()->_queued_digits_buffer.c_str());
 
                 /* clear the buffer that has been send */
@@ -2123,18 +2123,18 @@ bool Board::KhompPvt::onDtmfSendFinish(K3L_EVENT *e)
             }
             else
             {
-                DBG(FUNC, PVT_FMT(target(), 
+                DBG(FUNC, PVT_FMT(target(),
                         "finished sending some digits, cleaning up!"));
                 call()->_flags.clear(Kflags::WAIT_SEND_DTMF);
             }
-        } 
+        }
     }
     catch (ScopedLockFailed & err)
     {
         LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() );
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "r"));
 
     return true;
@@ -2159,7 +2159,7 @@ bool Board::KhompPvt::eventHandler(K3L_EVENT *e)
     case EV_CHANNEL_FAIL:
         ret = onChannelRelease(e);
         break;
-    
+
     case EV_NEW_CALL:
         ret = onNewCall(e);
         break;
@@ -2179,7 +2179,7 @@ bool Board::KhompPvt::eventHandler(K3L_EVENT *e)
     case EV_DISCONNECT:
         ret = onDisconnect(e);
         break;
-    
+
     case EV_AUDIO_STATUS:
         ret = onAudioStatus(e);
         break;
@@ -2219,8 +2219,8 @@ bool Board::KhompPvt::eventHandler(K3L_EVENT *e)
 
 bool Board::KhompPvt::indicateProgress()
 {
-    DBG(FUNC, PVT_FMT(_target, "c")); 
-    
+    DBG(FUNC, PVT_FMT(_target, "c"));
+
     int ret = false;
 
     try
@@ -2247,7 +2247,7 @@ bool Board::KhompPvt::indicateProgress()
         LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() );
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "r"));
 
     return ret;
@@ -2255,7 +2255,7 @@ bool Board::KhompPvt::indicateProgress()
 
 bool Board::KhompPvt::indicateRinging()
 {
-    DBG(FUNC, PVT_FMT(_target, "c")); 
+    DBG(FUNC, PVT_FMT(_target, "c"));
 
     bool ret = false;
     try
@@ -2264,11 +2264,11 @@ bool Board::KhompPvt::indicateRinging()
 
         /* already playing! */
         if (call()->_indication != INDICA_NONE)
-        {    
-            DBG(FUNC, PVT_FMT(_target, "r (already playing something: %d)") 
+        {
+            DBG(FUNC, PVT_FMT(_target, "r (already playing something: %d)")
                     % call()->_indication);
             return false;
-        }    
+        }
 
         // any collect calls ?
         setCollectCall();
@@ -2278,7 +2278,7 @@ bool Board::KhompPvt::indicateRinging()
         bool send_ringback = true;
 
         if (!call()->_flags.check(Kflags::CONNECTED))
-        {    
+        {
             int ringback_value = RingbackDefs::RB_SEND_DEFAULT;
 
             bool do_drop_call = Opt::_options._drop_collect_call()
@@ -2290,19 +2290,19 @@ bool Board::KhompPvt::indicateRinging()
                 DBG(FUNC, PVT_FMT(_target, "ringback value adjusted to refuse collect call: %d") % ringback_value);
             }
 
-            // send ringback too? 
+            // send ringback too?
             send_ringback = sendPreAudio(ringback_value);
 
             if (!send_ringback)
             {
-                // warn the developer which may be debugging some "i do not have ringback!" issue. 
+                // warn the developer which may be debugging some "i do not have ringback!" issue.
                 DBG(FUNC, PVT_FMT(_target, " not sending pre connection audio"));
             }
 
         }
 
         if (send_ringback)
-        {    
+        {
             call()->_flags.set(Kflags::GEN_CO_RING);
             call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_options._ringback_co_delay(), &Board::KhompPvt::coRingGen,this);
 
@@ -2312,8 +2312,8 @@ bool Board::KhompPvt::indicateRinging()
             /* start stream if it is not already */
             startStream();
 
-            ret = true; 
-        }   
+            ret = true;
+        }
 
     }
     catch (ScopedLockFailed & err)
@@ -2327,7 +2327,7 @@ bool Board::KhompPvt::indicateRinging()
         return false;
     }
 
-    
+
     DBG(FUNC, PVT_FMT(_target, "r"));
     return ret;
 }
@@ -2366,7 +2366,7 @@ bool Board::KhompPvt::doChannelHangup(CommandRequest &cmd)
 
         if (call()->_flags.check(Kflags::IS_INCOMING))
         {
-            DBG(FUNC, PVT_FMT(_target, "disconnecting incoming channel"));   
+            DBG(FUNC, PVT_FMT(_target, "disconnecting incoming channel"));
 
             //disconnected = command(KHOMP_LOG, CM_DISCONNECT);
         }
@@ -2374,7 +2374,7 @@ bool Board::KhompPvt::doChannelHangup(CommandRequest &cmd)
         {
             if(call()->_cleanup_upon_hangup)
             {
-                DBG(FUNC, PVT_FMT(_target, "disconnecting not allocated outgoing channel..."));   
+                DBG(FUNC, PVT_FMT(_target, "disconnecting not allocated outgoing channel..."));
 
                 disconnected = command(KHOMP_LOG, CM_DISCONNECT);
                 cleanup(KhompPvt::CLN_HARD);
@@ -2383,7 +2383,7 @@ bool Board::KhompPvt::doChannelHangup(CommandRequest &cmd)
             }
             else
             {
-                DBG(FUNC, PVT_FMT(_target, "disconnecting outgoing channel..."));   
+                DBG(FUNC, PVT_FMT(_target, "disconnecting outgoing channel..."));
 
                 disconnected = command(KHOMP_LOG, CM_DISCONNECT);
             }
@@ -2408,14 +2408,14 @@ bool Board::KhompPvt::doChannelHangup(CommandRequest &cmd)
         stopStream();
 
         stopListen();
-        
+
     }
     catch (ScopedLockFailed & err)
     {
         LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() );
         return false;
     }
-    
+
 
     DBG(FUNC, PVT_FMT(_target, "r"));
     return true;
@@ -2447,11 +2447,11 @@ bool Board::KhompPvt::commandHandler(CommandRequest &cmd)
 
     case CommandRequest::ACTION:
         break;
-    
+
     default:
         ret = false;
     }
-    
+
     DBG(STRM, PVT_FMT(target(), "r"));
     return ret;
 }
@@ -2503,15 +2503,15 @@ int Board::eventThread(void *void_evt)
         {
             if(!board(devid)->eventHandler(evt.obj(), evt.event()))
             {
-                LOG(ERROR, D("(d=%d) Error on event (%d) \"%s\"") 
-                        % devid 
+                LOG(ERROR, D("(d=%d) Error on event (%d) \"%s\"")
+                        % devid
                         % evt.event()->Code
                         % Globals::verbose.event(evt.obj(), evt.event()));
             }
         }
         catch (K3LAPITraits::invalid_device & invalid)
         {
-            LOG(ERROR, D("invalid device on event '%s'") 
+            LOG(ERROR, D("invalid device on event '%s'")
                 % Verbose::eventName(evt.event()->Code).c_str());
         }
 
@@ -2570,12 +2570,12 @@ int Board::commandThread(void *void_evt)
 extern "C" int32 Kstdcall khompEventCallback(int32 obj, K3L_EVENT * e)
 {
     //if (K::Logger::Logg.classe(C_EVENT).enabled())
-    //    std::string msg = Globals::verbose.event (obj, e) + "."; 
+    //    std::string msg = Globals::verbose.event (obj, e) + ".";
     LOGC(EVENT, FMT("%s.") % Globals::verbose.event(obj, e));
 
     switch(e->Code)
     {
-    case EV_WATCHDOG_COUNT: 
+    case EV_WATCHDOG_COUNT:
         Board::kommuter.initialize(e);
         break;
     case EV_HARDWARE_FAIL:
index 413a4e31790c1e62e18ef60ddbdfc4cf4d9b6555..74d813b4c37cb5e026ad591c3b158d43dcf1cba7 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -53,7 +53,7 @@ int BoardFXO::KhompPvtFXO::makeCall(std::string params)
 
     /* we always have audio */
     call()->_flags.set(Kflags::HAS_PRE_AUDIO);
-    
+
     if(callFXO()->_call_info_drop == 0 && !callFXO()->_call_info_report)
     {
         command(KHOMP_LOG, CM_DISABLE_CALL_ANSWER_INFO);
@@ -66,7 +66,7 @@ int BoardFXO::KhompPvtFXO::makeCall(std::string params)
         callFXO()->_flags.set(Kflags::CALL_WAIT_SEIZE);
 
         if (!command(KHOMP_LOG, CM_SEIZE, call()->_orig_addr.c_str()))
-            return ksFail;            
+            return ksFail;
 
         int timeout = 150;
 
@@ -81,8 +81,8 @@ int BoardFXO::KhompPvtFXO::makeCall(std::string params)
         callFXO()->_flags.set(Kflags::WAIT_SEND_DTMF);
 
         if (!command(KHOMP_LOG, CM_DIAL_DTMF, callFXO()->_pre_digits.c_str()))
-            return ksFail;            
-        
+            return ksFail;
+
         if(!loopWhileFlagTimed(Kflags::WAIT_SEND_DTMF, timeout))
             return ksFail;
 
@@ -105,7 +105,7 @@ int BoardFXO::KhompPvtFXO::makeCall(std::string params)
 
         /* we want the audio as soon as dialing ends */
         callFXO()->_flags.set(Kflags::EARLY_RINGBACK);
-    
+
         if (!command(KHOMP_LOG, CM_DIAL_DTMF, call()->_dest_addr.c_str()))
             return ksFail;
     }
@@ -200,7 +200,7 @@ bool BoardFXO::KhompPvtFXO::doChannelAnswer(CommandRequest &cmd)
 bool BoardFXO::KhompPvtFXO::onNewCall(K3L_EVENT *e)
 {
     DBG(FUNC,PVT_FMT(_target,"(FXO) c"));
-   
+
     bool ret = true;
 
     try
@@ -278,7 +278,7 @@ bool BoardFXO::KhompPvtFXO::onChannelRelease(K3L_EVENT *e)
         }
 
         command(KHOMP_LOG, CM_ENABLE_CALL_ANSWER_INFO);
-   
+
         ret = KhompPvt::onChannelRelease(e);
     }
     catch(ScopedLockFailed & err)
@@ -286,8 +286,8 @@ bool BoardFXO::KhompPvtFXO::onChannelRelease(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(target(), "(FXO) r (unable to lock %s!)") % err._msg.c_str() );
         return false;
     }
-    
-    DBG(FUNC, PVT_FMT(_target, "(FXO) r"));   
+
+    DBG(FUNC, PVT_FMT(_target, "(FXO) r"));
     return ret;
 }
 
@@ -322,7 +322,7 @@ bool BoardFXO::KhompPvtFXO::onCallSuccess(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(target(), "(FXO) r (%s)") % err._msg.c_str() );
         return false;
     }
-        
+
     DBG(FUNC, PVT_FMT(_target, "(FXO) r"));
 
     return ret;
@@ -330,7 +330,7 @@ bool BoardFXO::KhompPvtFXO::onCallSuccess(K3L_EVENT *e)
 
 bool BoardFXO::KhompPvtFXO::onCallFail(K3L_EVENT *e)
 {
-    bool ret = true; 
+    bool ret = true;
     try
     {
         ScopedPvtLock lock(this);
@@ -364,13 +364,13 @@ bool BoardFXO::KhompPvtFXO::onAudioStatus(K3L_EVENT *e)
             DBG(STRM, PVT_FMT(_target, "Fax detected"));
 
             /* hadn't we did this already? */
-            bool already_detected = call()->_flags.check(Kflags::FAX_DETECTED);            
+            bool already_detected = call()->_flags.check(Kflags::FAX_DETECTED);
 
             time_t time_was = call()->_call_statistics->_base_time;
             time_t time_now = time(NULL);
 
             bool detection_timeout = (time_now > (time_was + (time_t) (Opt::_options._fax_adjustment_timeout())));
-            
+
             BEGIN_CONTEXT
             {
                 ScopedPvtLock lock(this);
@@ -456,7 +456,7 @@ bool BoardFXO::KhompPvtFXO::onDtmfDetected(K3L_EVENT *e)
         if (callFXO()->_flags.check(Kflags::WAIT_SEND_DTMF) ||
                 callFXO()->_flags.check(Kflags::CALL_WAIT_SEIZE))
         {
-            /* waiting digit or seize means DEADLOCK if we try to 
+            /* waiting digit or seize means DEADLOCK if we try to
              *  queue something below. */
             DBG(FUNC, PVT_FMT(_target, "not queueing dtmf, waiting stuff!"));
             return true;
@@ -580,8 +580,8 @@ bool BoardFXO::KhompPvtFXO::onCallAnswerInfo(K3L_EVENT *e)
         {
             if (callFXO()->_call_info_report)
             {
-                //TODO: HOW WE TREAT THAT 
-                // make the channel export this 
+                //TODO: HOW WE TREAT THAT
+                // make the channel export this
                 setAnswerInfo(info_code);
             }
 
@@ -675,7 +675,7 @@ bool BoardFXO::KhompPvtFXO::setupConnection()
 bool BoardFXO::KhompPvtFXO::autoGainControl(bool enable)
 {
     bool ret = KhompPvt::autoGainControl(enable);
-    
+
     /* enable this AGC also, can be very useful */
     ret &= command(KHOMP_LOG, (enable ? CM_ENABLE_PLAYER_AGC : CM_DISABLE_PLAYER_AGC));
     return ret;
@@ -690,7 +690,7 @@ void BoardFXO::KhompPvtFXO::setAnswerInfo(int answer_info)
         DBG(FUNC, PVT_FMT(_target,"signaled unknown call answer info '%d', using 'Unknown'...") % answer_info);
         value = "Unknown";
     }
-   
+
     DBG(FUNC,PVT_FMT(_target,"KCallAnswerInfo: %s") % value);
 
     try
@@ -717,10 +717,10 @@ bool BoardFXO::KhompPvtFXO::indicateBusyUnlocked(int cause, bool sent_signaling)
     {
         /* already connected or sent signaling... */
         mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy);
-        
+
         if(!call()->_flags.check(Kflags::CONNECTED) && !sent_signaling)
         {
-            /* we are talking about branches, not trunks */ 
+            /* we are talking about branches, not trunks */
             command(KHOMP_LOG, CM_CONNECT);
             callFXO()->_busy_disconnect = Board::board(_target.device)->_timers.add(Opt::_options._fxo_busy_disconnection(), &BoardFXO::KhompPvtFXO::busyDisconnect, this);
         }
@@ -732,22 +732,22 @@ bool BoardFXO::KhompPvtFXO::indicateBusyUnlocked(int cause, bool sent_signaling)
     }
 
     DBG(FUNC,PVT_FMT(_target, "(FXO) r"));
-    return true; 
+    return true;
 }
 
 void BoardFXO::KhompPvtFXO::busyDisconnect(Board::KhompPvt * pvt)
 {
     DBG(FUNC, PVT_FMT(pvt->target(), "Disconnecting FXO"));
 
-    try 
-    {   
+    try
+    {
         ScopedPvtLock lock(pvt);
         pvt->command(KHOMP_LOG, CM_DISCONNECT);
-    }   
+    }
     catch (...)
     {
         LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock the pvt !"));
-    }  
+    }
 }
 
 void BoardFXO::KhompPvtFXO::reportFailToReceive(int fail_code)
index a568c986c59ec3b1740cc7955ae4e92678dc4a88..a57dc813c611c0535fffdbabd9a8e659194f7706 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -88,7 +88,7 @@ bool BoardGSM::KhompPvtGSM::onChannelRelease(K3L_EVENT *e)
 
         call()->_flags.clear(Kflags::HAS_PRE_AUDIO);
         command(KHOMP_LOG, CM_ENABLE_CALL_ANSWER_INFO);
-   
+
         ret = KhompPvt::onChannelRelease(e);
     }
     catch(ScopedLockFailed & err)
@@ -96,8 +96,8 @@ bool BoardGSM::KhompPvtGSM::onChannelRelease(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(target(), "(GSM) r (unable to lock %s!)") % err._msg.c_str() );
         return false;
     }
-    
-    DBG(FUNC, PVT_FMT(_target, "(GSM) r"));   
+
+    DBG(FUNC, PVT_FMT(_target, "(GSM) r"));
     return ret;
 }
 
@@ -132,7 +132,7 @@ bool BoardGSM::KhompPvtGSM::onCallSuccess(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(target(), "(GSM) r (%s)") % err._msg.c_str() );
         return false;
     }
-        
+
     DBG(FUNC, PVT_FMT(_target, "(GSM) r"));
 
     return ret;
@@ -147,7 +147,7 @@ void BoardGSM::KhompPvtGSM::setAnswerInfo(int answer_info)
         DBG(FUNC, PVT_FMT(_target,"signaled unknown call answer info '%d', using 'Unknown'...") % answer_info);
         value = "Unknown";
     }
-   
+
     DBG(FUNC,PVT_FMT(_target,"KCallAnswerInfo: %s") % value);
 
     try
@@ -195,8 +195,8 @@ bool BoardGSM::KhompPvtGSM::onCallAnswerInfo(K3L_EVENT *e)
         {
             if (callGSM()->_call_info_report)
             {
-                //TODO: HOW WE TREAT THAT 
-                // make the channel export this 
+                //TODO: HOW WE TREAT THAT
+                // make the channel export this
                 setAnswerInfo(info_code);
             }
 
@@ -224,7 +224,7 @@ bool BoardGSM::KhompPvtGSM::onDtmfDetected(K3L_EVENT *e)
     try
     {
         ScopedPvtLock lock(this);
-        
+
 
     }
     catch (ScopedLockFailed & err)
@@ -238,12 +238,12 @@ bool BoardGSM::KhompPvtGSM::onDtmfDetected(K3L_EVENT *e)
 bool BoardGSM::KhompPvtGSM::onNewCall(K3L_EVENT *e)
 {
     DBG(FUNC,PVT_FMT(_target,"(GSM) c"));
-    
+
     try
     {
         ScopedPvtLock lock(this);
 
-        bool ret = KhompPvtGSM::onNewCall(e); 
+        bool ret = KhompPvtGSM::onNewCall(e);
 
     }
     catch(ScopedLockFailed & err)
@@ -262,7 +262,7 @@ bool BoardGSM::KhompPvtGSM::onNewCall(K3L_EVENT *e)
 
 bool BoardGSM::KhompPvtGSM::onCallFail(K3L_EVENT *e)
 {
-    bool ret = true; 
+    bool ret = true;
     try
     {
         ScopedPvtLock lock(this);
@@ -306,7 +306,7 @@ bool BoardGSM::KhompPvtGSM::onDisconnect(K3L_EVENT *e)
 int BoardGSM::KhompPvtGSM::makeCall(std::string params)
 {
     DBG(FUNC,PVT_FMT(_target, "(GSM) c"));
-    
+
     if(callGSM()->_call_info_drop == 0 && !callGSM()->_call_info_report)
     {
         command(KHOMP_LOG, CM_DISABLE_CALL_ANSWER_INFO);
@@ -366,7 +366,7 @@ bool BoardGSM::KhompPvtGSM::doChannelHangup(CommandRequest &cmd)
 
         int owner_nr = 0;
 
-        command(KHOMP_LOG, CM_DISCONNECT, 
+        command(KHOMP_LOG, CM_DISCONNECT,
                 STG(FMT("gsm_call_ref=%d") % (int)owner_nr).c_str());
 
 
@@ -476,8 +476,8 @@ bool BoardGSM::KhompPvtGSM::indicateBusyUnlocked(int cause, bool sent_signaling)
     }
 
     DBG(FUNC,PVT_FMT(_target, "(GSM) r"));
-    
-    return true; 
+
+    return true;
 }
 
 void BoardGSM::KhompPvtGSM::reportFailToReceive(int fail_code)
@@ -500,9 +500,9 @@ int BoardGSM::KhompPvtGSM::causeFromCallFail(int fail)
 {
     int switch_cause = SWITCH_CAUSE_USER_BUSY;
 
-    if (fail <= 127) 
+    if (fail <= 127)
         switch_cause = fail;
-    else 
+    else
         switch_cause = SWITCH_CAUSE_INTERWORKING;
 
     return switch_cause;
@@ -512,10 +512,10 @@ int BoardGSM::KhompPvtGSM::callFailFromCause(int cause)
 {
     int k3l_fail = -1; // default
 
-    if (cause <= 127) 
+    if (cause <= 127)
         k3l_fail = cause;
     else
-        k3l_fail = kgccInterworking; 
+        k3l_fail = kgccInterworking;
 
     return k3l_fail;
 }
@@ -531,36 +531,36 @@ bool BoardGSM::KhompPvtGSM::validContexts(
     }
 
     if (!extra_context.empty())
-    {    
+    {
         if (!_group_context.empty())
-        {    
+        {
             std::string pvt_context(_group_context);
-            pvt_context += "-"; 
+            pvt_context += "-";
             pvt_context += extra_context;
             contexts.push_back(pvt_context);
-        }    
+        }
 
         if (!Opt::_options._context_gsm_call().empty())
-        {    
+        {
             std::string context(Opt::_options._context_gsm_call());
-            context += "-"; 
+            context += "-";
             context += extra_context;
             contexts.push_back(_group_context);
         }
 
         if (!Opt::_options._context2_gsm_call().empty())
-        {    
+        {
             std::string context(Opt::_options._context2_gsm_call());
-            context += "-"; 
+            context += "-";
             context += extra_context;
             contexts.push_back(_group_context);
-        }    
-    }  
+        }
+    }
 
     contexts.push_back(Opt::_options._context_gsm_call());
     contexts.push_back(Opt::_options._context2_gsm_call());
 
-    for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) 
+    for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++)
         replaceTemplate((*i), "CC", _target.object);
 
     bool ret = Board::KhompPvt::validContexts(contexts,extra_context);
index b5f68132e61a8fadd7293ee10352aeab3a39abbc..0aa2979cf89ce86a8ecae5c278315674edbc0f8f 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -103,7 +103,7 @@ bool BoardE1::KhompPvtE1::onChannelRelease(K3L_EVENT *e)
         return false;
     }
 
-    DBG(FUNC, PVT_FMT(_target, "(E1) r"));   
+    DBG(FUNC, PVT_FMT(_target, "(E1) r"));
     return ret;
 }
 
@@ -121,7 +121,7 @@ bool BoardE1::KhompPvtE1::onCallSuccess(K3L_EVENT *e)
 
         if (call()->_pre_answer)
         {
-            dtmfSuppression(Opt::_options._out_of_band_dtmfs()&& !call()->_flags.check(Kflags::FAX_DETECTED));     
+            dtmfSuppression(Opt::_options._out_of_band_dtmfs()&& !call()->_flags.check(Kflags::FAX_DETECTED));
 
             startListen();
             startStream();
@@ -145,7 +145,7 @@ bool BoardE1::KhompPvtE1::onCallSuccess(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to get device: %d!)") % err.device);
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "(E1) r"));
 
     return ret;
@@ -164,13 +164,13 @@ bool BoardE1::KhompPvtE1::onAudioStatus(K3L_EVENT *e)
             DBG(STRM, PVT_FMT(_target, "Fax detected"));
 
             /* hadn't we did this already? */
-            bool already_detected = call()->_flags.check(Kflags::FAX_DETECTED);            
+            bool already_detected = call()->_flags.check(Kflags::FAX_DETECTED);
 
             time_t time_was = call()->_call_statistics->_base_time;
             time_t time_now = time(NULL);
 
             bool detection_timeout = (time_now > (time_was + (time_t) (Opt::_options._fax_adjustment_timeout())));
-            
+
             DBG(STRM, PVT_FMT(_target, "is set? (%s) timeout? (%s)")
                             % (already_detected ? "true" : "false") % (detection_timeout ? "true" : "false"));
 
@@ -183,15 +183,15 @@ bool BoardE1::KhompPvtE1::onAudioStatus(K3L_EVENT *e)
                     break;
 
                 if (callE1()->_call_info_drop != 0 || callE1()->_call_info_report)
-                {    
+                {
                     /* we did not detected fax yet, send answer info! */
                     setAnswerInfo(Board::KhompPvt::CI_FAX);
 
                     if (callE1()->_call_info_drop & Board::KhompPvt::CI_FAX)
-                    {    
+                    {
                         /* fastest way to force a disconnection */
                         command(KHOMP_LOG,CM_DISCONNECT);//,SCE_HIDE);
-                    }    
+                    }
                 }
 
                 if (Opt::_options._auto_fax_adjustment())
@@ -218,7 +218,7 @@ bool BoardE1::KhompPvtE1::onAudioStatus(K3L_EVENT *e)
     }
 
     bool ret = KhompPvt::onAudioStatus(e);
-    
+
     DBG(STRM, PVT_FMT(_target, "(E1) r"));
 
     return ret;
@@ -227,14 +227,14 @@ bool BoardE1::KhompPvtE1::onAudioStatus(K3L_EVENT *e)
 bool BoardE1::KhompPvtE1::onCallAnswerInfo(K3L_EVENT *e)
 {
     DBG(FUNC, PVT_FMT(_target, "(E1) c"));
-    try  
-    {    
+    try
+    {
         ScopedPvtLock lock(this);
 
         int info_code = -1;
 
         switch (e->AddInfo)
-        {    
+        {
             case kcsiCellPhoneMessageBox:
                 info_code = CI_MESSAGE_BOX;
                 break;
@@ -253,25 +253,25 @@ bool BoardE1::KhompPvtE1::onCallAnswerInfo(K3L_EVENT *e)
             default:
                 DBG(FUNC, PVT_FMT(_target, "got an unknown call answer info '%d', ignoring...") % e->AddInfo);
                 break;
-        }    
+        }
 
         if (info_code != -1)
-        {    
+        {
             if (callE1()->_call_info_report)
-            {    
-                //TODO: HOW WE TREAT THAT 
-                // make the channel export this 
+            {
+                //TODO: HOW WE TREAT THAT
+                // make the channel export this
                 setAnswerInfo(info_code);
-            }    
+            }
 
             if (callE1()->_call_info_drop & info_code)
-            {    
-                // fastest way to force a disconnection 
+            {
+                // fastest way to force a disconnection
                 //K::util::sendCmd(pvt->boardid, pvt->objectid, CM_DISCONNECT, true, false);
                 command(KHOMP_LOG,CM_DISCONNECT/*,SCE_HIDE ?*/);
-            }    
-        }    
-    }    
+            }
+        }
+    }
     catch (ScopedLockFailed & err)
     {
         LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to lock %s!)") % err._msg.c_str() );
@@ -298,7 +298,7 @@ bool BoardE1::KhompPvtE1::onDisconnect(K3L_EVENT *e)
             if(Opt::_options._disconnect_delay()== 0)
             {
                 DBG(FUNC, PVT_FMT(_target, "queueing disconnecting outgoing channel!"));
-                command(KHOMP_LOG, CM_DISCONNECT);       
+                command(KHOMP_LOG, CM_DISCONNECT);
             }
             else
             {
@@ -308,11 +308,11 @@ bool BoardE1::KhompPvtE1::onDisconnect(K3L_EVENT *e)
         }
         else
         {
-            /* in the case of a disconnect confirm is needed and a call 
+            /* in the case of a disconnect confirm is needed and a call
             was not started e.g. just after a ev_seizure_start */
             command(KHOMP_LOG, CM_DISCONNECT);
         }
-        
+
         ret = KhompPvt::onDisconnect(e);
 
     }
@@ -335,19 +335,19 @@ void BoardE1::KhompPvtE1::delayedDisconnect(Board::KhompPvt * pvt)
 {
     DBG(FUNC,PVT_FMT(pvt->target(), "Delayed disconnect"));
 
-    try  
-    {    
+    try
+    {
         ScopedPvtLock lock(pvt);
 
         DBG(FUNC, PVT_FMT(pvt->target(), "queueing disconnecting outgoing channel after delaying!"));
 
         pvt->command(KHOMP_LOG,CM_DISCONNECT);
         pvt->cleanup(CLN_HARD);
-    }        
+    }
     catch (...)
     {
         LOG(ERROR, PVT_FMT(pvt->target(), "r (unable to lock the pvt !)"));
-    }       
+    }
 }
 
 bool BoardE1::onLinkStatus(K3L_EVENT *e)
@@ -378,30 +378,30 @@ bool BoardE1::KhompPvtISDN::onSyncUserInformation(K3L_EVENT *e)
     {
         KUserInformationEx * info = (KUserInformationEx *) (((char*)e) + sizeof(K3L_EVENT));
         callISDN()->_uui_descriptor = (long int) info->ProtocolDescriptor;
-        
+
         /* clean string */
         callISDN()->_uui_information.clear();
 
         if (info->UserInfoLength)
-        {    
+        {
             /* append to a clean string */
-            for (unsigned int i = 0; i < info->UserInfoLength; ++i) 
+            for (unsigned int i = 0; i < info->UserInfoLength; ++i)
                 callISDN()->_uui_information += STG(FMT("%02hhx") % ((unsigned char) info->UserInfo[i]));
-        }    
+        }
     }
     else
     {
         KUserInformation * info = (KUserInformation *) (((char*)e) + sizeof(K3L_EVENT));
         callISDN()->_uui_descriptor = info->ProtocolDescriptor;
-        
+
         /* clean string */
         callISDN()->_uui_information.clear();
 
         if (info->UserInfoLength)
-        {    
-            for (unsigned int i = 0; i < info->UserInfoLength; ++i) 
+        {
+            for (unsigned int i = 0; i < info->UserInfoLength; ++i)
                 callISDN()->_uui_information += STG(FMT("%02hhx") % ((unsigned char) info->UserInfo[i]));
-        }    
+        }
     }
 
     return true;
@@ -454,19 +454,19 @@ bool BoardE1::KhompPvtISDN::onIsdnProgressIndicator(K3L_EVENT *e)
 
 bool BoardE1::KhompPvtISDN::onNewCall(K3L_EVENT *e)
 {
-    DBG(FUNC,PVT_FMT(_target, "(ISDN) c"));   
+    DBG(FUNC,PVT_FMT(_target, "(ISDN) c"));
 
     bool isdn_reverse_charge = false;
     std::string isdn_reverse_charge_str;
     bool ret;
-   
+
     try
     {
-        callISDN()->_isdn_orig_type_of_number = Globals::k3lapi.get_param(e, "isdn_orig_type_of_number"); 
-        callISDN()->_isdn_orig_numbering_plan = Globals::k3lapi.get_param(e, "isdn_orig_numbering_plan"); 
-        callISDN()->_isdn_dest_type_of_number = Globals::k3lapi.get_param(e, "isdn_dest_type_of_number"); 
-        callISDN()->_isdn_dest_numbering_plan = Globals::k3lapi.get_param(e, "isdn_dest_numbering_plan"); 
-        callISDN()->_isdn_orig_presentation   = Globals::k3lapi.get_param(e, "isdn_orig_presentation"); 
+        callISDN()->_isdn_orig_type_of_number = Globals::k3lapi.get_param(e, "isdn_orig_type_of_number");
+        callISDN()->_isdn_orig_numbering_plan = Globals::k3lapi.get_param(e, "isdn_orig_numbering_plan");
+        callISDN()->_isdn_dest_type_of_number = Globals::k3lapi.get_param(e, "isdn_dest_type_of_number");
+        callISDN()->_isdn_dest_numbering_plan = Globals::k3lapi.get_param(e, "isdn_dest_numbering_plan");
+        callISDN()->_isdn_orig_presentation   = Globals::k3lapi.get_param(e, "isdn_orig_presentation");
         isdn_reverse_charge_str = Globals::k3lapi.get_param(e, "isdn_reverse_charge");
         isdn_reverse_charge = Strings::toboolean(isdn_reverse_charge_str);
     }
@@ -487,7 +487,7 @@ bool BoardE1::KhompPvtISDN::onNewCall(K3L_EVENT *e)
         {
             bool pvt_locked = true;
             bool is_ok = false;
-        
+
             DBG(FUNC, PVT_FMT(_target, "Session has not been destroyed yet, waiting for khompDestroy"));
 
             for(unsigned int sleeps = 0; sleeps < 20; sleeps++)
@@ -516,7 +516,7 @@ bool BoardE1::KhompPvtISDN::onNewCall(K3L_EVENT *e)
                 }
 
                 pvt_locked = true;
-            
+
                 if(!session())
                 {
                     is_ok = true;
@@ -536,11 +536,11 @@ bool BoardE1::KhompPvtISDN::onNewCall(K3L_EVENT *e)
         }
 
         if(isdn_reverse_charge)
-        { 
+        {
             call()->_collect_call = true;
         }
 
-        ret = KhompPvtE1::onNewCall(e); 
+        ret = KhompPvtE1::onNewCall(e);
     }
     catch(ScopedLockFailed & err)
     {
@@ -548,7 +548,7 @@ bool BoardE1::KhompPvtISDN::onNewCall(K3L_EVENT *e)
         return false;
     }
 
-    DBG(FUNC, PVT_FMT(_target, "(ISDN) r"));   
+    DBG(FUNC, PVT_FMT(_target, "(ISDN) r"));
 
     return ret;
 }
@@ -633,7 +633,7 @@ bool BoardE1::KhompPvtISDN::sendPreAudio(int rb_value)
         return false;
 
 
-    DBG(FUNC,PVT_FMT(_target, "doing the ISDN pre_connect"));   
+    DBG(FUNC,PVT_FMT(_target, "doing the ISDN pre_connect"));
 
     if (call()->_flags.check(Kflags::HAS_PRE_AUDIO))
     {
@@ -673,7 +673,7 @@ bool BoardE1::KhompPvtISDN::sendDtmf(std::string digit)
     }
 
     bool ret = KhompPvtE1::sendDtmf(callISDN()->_digits_buffer);
-        
+
     callISDN()->_digits_buffer.clear();
 
     return ret;
@@ -698,7 +698,7 @@ int BoardE1::KhompPvtE1::makeCall(std::string params)
     else
     {
         LOG(ERROR, PVT_FMT(target(), "Fail on make call"));
-    }   
+    }
 
     return ret;
 }
@@ -762,8 +762,8 @@ bool BoardE1::KhompPvtE1::indicateBusyUnlocked(int cause, bool sent_signaling)
     }
 
     DBG(FUNC,PVT_FMT(_target, "(E1) r"));
-    
-    return true; 
+
+    return true;
 }
 
 void BoardE1::KhompPvtE1::setAnswerInfo(int answer_info)
@@ -771,11 +771,11 @@ void BoardE1::KhompPvtE1::setAnswerInfo(int answer_info)
     const char * value = answerInfoToString(answer_info);
 
     if (value == NULL)
-    {    
+    {
         DBG(FUNC, PVT_FMT(_target, "signaled unknown call answer info '%d', using 'Unknown'...") % answer_info);
         value = "Unknown";
-    }   
-    
+    }
+
     DBG(FUNC,PVT_FMT(_target, "KCallAnswerInfo: %s") % value);
 
     try
@@ -784,7 +784,7 @@ void BoardE1::KhompPvtE1::setAnswerInfo(int answer_info)
     }
     catch(Board::KhompPvt::InvalidSwitchChannel & err)
     {
-        LOG(ERROR,PVT_FMT(_target, "%s") % err._msg.c_str()); 
+        LOG(ERROR,PVT_FMT(_target, "%s") % err._msg.c_str());
     }
 }
 
@@ -801,10 +801,10 @@ bool BoardE1::KhompPvtE1::setupConnection()
     Board::board(_target.device)->_timers.del(callE1()->_idx_disconnect);
 
     bool fax_detected = callE1()->_flags.check(Kflags::FAX_DETECTED) || (callE1()->_var_fax_adjust == T_TRUE);
-    
+
     bool res_out_of_band_dtmf = (call()->_var_dtmf_state == T_UNKNOWN || fax_detected ?
         Opt::_options._suppression_delay()&& Opt::_options._out_of_band_dtmfs()&& !fax_detected : (call()->_var_dtmf_state == T_TRUE));
-    
+
     bool res_echo_cancellator = (call()->_var_echo_state == T_UNKNOWN || fax_detected ?
         Opt::_options._echo_canceller()&& !fax_detected : (call()->_var_echo_state == T_TRUE));
 
@@ -815,7 +815,7 @@ bool BoardE1::KhompPvtE1::setupConnection()
     {
         obtainRX(res_out_of_band_dtmf);
 
-        /* esvazia buffers de leitura/escrita */ 
+        /* esvazia buffers de leitura/escrita */
         cleanupBuffers();
 
         if (!call()->_flags.check(Kflags::KEEP_DTMF_SUPPRESSION))
@@ -831,7 +831,7 @@ bool BoardE1::KhompPvtE1::setupConnection()
 
         startStream();
 
-        DBG(FUNC, PVT_FMT(_target, "(E1) Audio callbacks initialized successfully"));  
+        DBG(FUNC, PVT_FMT(_target, "(E1) Audio callbacks initialized successfully"));
     }
 
     return Board::KhompPvt::setupConnection();
@@ -866,8 +866,8 @@ bool BoardE1::KhompPvtE1::validContexts(
 
     contexts.push_back(Opt::_options._context_digital());
 
-    for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) 
-    {    
+    for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++)
+    {
         replaceTemplate((*i), "LL", ((_target.object)/30));
         replaceTemplate((*i), "CCC", _target.object);
     }
@@ -881,13 +881,13 @@ bool BoardE1::KhompPvtE1::validContexts(
 
 int BoardE1::KhompPvtISDN::makeCall(std::string params)
 {
-    DBG(FUNC,PVT_FMT(_target, "(ISDN) c"));   
+    DBG(FUNC,PVT_FMT(_target, "(ISDN) c"));
 
     CallISDN * call = callISDN();
 
     if(call->_uui_descriptor != -1)
     {
-        DBG(FUNC,PVT_FMT(_target, "got userinfo"));   
+        DBG(FUNC,PVT_FMT(_target, "got userinfo"));
 
         /* grab this information first, avoiding latter side-effects */
         const bool        info_extd = call->_uui_extended;
@@ -896,7 +896,7 @@ int BoardE1::KhompPvtISDN::makeCall(std::string params)
         const size_t      info_size = std::min<size_t>(call->_uui_information.size(), (info_extd ? KMAX_USER_USER_EX_LEN : KMAX_USER_USER_LEN) << 1) >> 1;
 
         bool res = true;
-    
+
         if(info_extd)
         {
             KUserInformationEx info;
@@ -905,13 +905,13 @@ int BoardE1::KhompPvtISDN::makeCall(std::string params)
             info.UserInfoLength = info_size;
 
             for (unsigned int pos = 0u, index = 0u; pos < info_size; index+=2, ++pos)
-                info.UserInfo[pos] = (unsigned char)Strings::toulong(info_data.substr(index,2), 16); 
+                info.UserInfo[pos] = (unsigned char)Strings::toulong(info_data.substr(index,2), 16);
 
             if (!command(KHOMP_LOG, CM_USER_INFORMATION_EX, (const char *) &info))
             {
-                LOG(ERROR,PVT_FMT(_target, "UUI could not be sent before dialing!"));   
+                LOG(ERROR,PVT_FMT(_target, "UUI could not be sent before dialing!"));
             }
-        } 
+        }
         else
         {
             KUserInformation info;
@@ -920,59 +920,59 @@ int BoardE1::KhompPvtISDN::makeCall(std::string params)
             info.UserInfoLength = info_size;
 
             for (unsigned int pos = 0u, index = 0u; pos < info_size; index+=2, ++pos)
-                info.UserInfo[pos] = (unsigned char)Strings::toulong(info_data.substr(index,2), 16); 
+                info.UserInfo[pos] = (unsigned char)Strings::toulong(info_data.substr(index,2), 16);
 
             if (!command(KHOMP_LOG, CM_USER_INFORMATION, (const char *) &info))
             {
-                LOG(ERROR,PVT_FMT(_target, "UUI could not be sent before dialing!"));   
+                LOG(ERROR,PVT_FMT(_target, "UUI could not be sent before dialing!"));
             }
         }
 
-        call->_uui_extended = false; 
+        call->_uui_extended = false;
         call->_uui_descriptor = -1;
         call->_uui_information.clear();
     }
 
-    if (!callISDN()->_isdn_orig_type_of_number.empty()) 
+    if (!callISDN()->_isdn_orig_type_of_number.empty())
     {
-        params += "isdn_orig_type_of_number=\""; 
-        params += callISDN()->_isdn_orig_type_of_number; 
-        params += "\" "; 
+        params += "isdn_orig_type_of_number=\"";
+        params += callISDN()->_isdn_orig_type_of_number;
+        params += "\" ";
     }
 
-    if (!callISDN()->_isdn_dest_type_of_number.empty()) 
-    { 
-        params += "isdn_dest_type_of_number=\""; 
-        params += callISDN()->_isdn_dest_type_of_number; 
-        params += "\" "; 
+    if (!callISDN()->_isdn_dest_type_of_number.empty())
+    {
+        params += "isdn_dest_type_of_number=\"";
+        params += callISDN()->_isdn_dest_type_of_number;
+        params += "\" ";
     }
 
-    if (!callISDN()->_isdn_orig_numbering_plan.empty()) 
-    { 
-        params += "isdn_orig_numbering_plan=\""; 
-        params += callISDN()->_isdn_orig_numbering_plan; 
-        params += "\" "; 
+    if (!callISDN()->_isdn_orig_numbering_plan.empty())
+    {
+        params += "isdn_orig_numbering_plan=\"";
+        params += callISDN()->_isdn_orig_numbering_plan;
+        params += "\" ";
     }
 
-    if (!callISDN()->_isdn_dest_numbering_plan.empty()) 
-    { 
-        params += "isdn_dest_numbering_plan=\""; 
-        params += callISDN()->_isdn_dest_numbering_plan; 
-        params += "\" "; 
+    if (!callISDN()->_isdn_dest_numbering_plan.empty())
+    {
+        params += "isdn_dest_numbering_plan=\"";
+        params += callISDN()->_isdn_dest_numbering_plan;
+        params += "\" ";
     }
 
     if (!callISDN()->_isdn_orig_presentation.empty())
-    { 
-        params += "isdn_orig_presentation=\"";   
-        params += callISDN()->_isdn_orig_presentation; 
-        params += "\" "; 
+    {
+        params += "isdn_orig_presentation=\"";
+        params += callISDN()->_isdn_orig_presentation;
+        params += "\" ";
     }
 
     int ret = KhompPvtE1::makeCall(params);
 
     call->_cleanup_upon_hangup = (ret == ksInvalidParams || ret == ksBusy);
-    
-    DBG(FUNC,PVT_FMT(_target, "(ISDN) r"));   
+
+    DBG(FUNC,PVT_FMT(_target, "(ISDN) r"));
 
     return ret;
 }
@@ -983,7 +983,7 @@ void BoardE1::KhompPvtISDN::reportFailToReceive(int fail_code)
 
     if(fail_code != -1)
     {
-        DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio")); 
+        DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio"));
 
         if(sendRingBackStatus(fail_code) == RingbackDefs::RBST_UNSUPPORTED)
         {
@@ -1052,7 +1052,7 @@ bool BoardE1::KhompPvtISDN::doChannelAnswer(CommandRequest &cmd)
 
 int BoardE1::KhompPvtR2::makeCall(std::string params)
 {
-    DBG(FUNC,PVT_FMT(_target, "(R2) c"));   
+    DBG(FUNC,PVT_FMT(_target, "(R2) c"));
 
     if (callR2()->_r2_category != -1)
         params += STG(FMT(" r2_categ_a=\"%ld\"")
@@ -1061,8 +1061,8 @@ int BoardE1::KhompPvtR2::makeCall(std::string params)
     int ret = KhompPvtE1::makeCall(params);
 
     call()->_cleanup_upon_hangup = (ret == ksInvalidParams);
-    
-    DBG(FUNC,PVT_FMT(_target, "(R2) r"));   
+
+    DBG(FUNC,PVT_FMT(_target, "(R2) r"));
 
     return ret;
 }
@@ -1088,7 +1088,7 @@ bool BoardE1::KhompPvtR2::doChannelAnswer(CommandRequest &cmd)
 
         // do we have to send ringback? yes we need !!!
         if(do_send_ring)
-        {       
+        {
             call()->_flags.clear(Kflags::NEEDS_RINGBACK_CMD);
 
             //TODO: callFailFromCause ??
@@ -1103,7 +1103,7 @@ bool BoardE1::KhompPvtR2::doChannelAnswer(CommandRequest &cmd)
             command(KHOMP_LOG, CM_CONNECT);
         }
 
-        if(!do_send_ring && has_drop_collect_call) 
+        if(!do_send_ring && has_drop_collect_call)
         {
             usleep(75000);
 
@@ -1114,10 +1114,10 @@ bool BoardE1::KhompPvtR2::doChannelAnswer(CommandRequest &cmd)
                 stopStream();
 
                 if (call()->_indication == INDICA_NONE)
-                {    
+                {
                     call()->_indication = INDICA_BUSY;
                     mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy);
-                }    
+                }
 
                 DBG(FUNC, PVT_FMT(_target,"forcing disconnect for collect call"));
                 forceDisconnect();
@@ -1170,7 +1170,7 @@ bool BoardE1::KhompPvtR2::doChannelHangup(CommandRequest &cmd)
             }
             else
             {
-                DBG(FUNC,PVT_FMT(_target, "disconnecting outgoing channel...")); 
+                DBG(FUNC,PVT_FMT(_target, "disconnecting outgoing channel..."));
 
                 disconnected = command(KHOMP_LOG, CM_DISCONNECT);
             }
@@ -1212,9 +1212,9 @@ int BoardE1::KhompPvtISDN::causeFromCallFail(int fail)
 {
     int switch_cause = SWITCH_CAUSE_USER_BUSY;
 
-    if (fail <= 127) 
+    if (fail <= 127)
         switch_cause = fail;
-    else 
+    else
         switch_cause = SWITCH_CAUSE_INTERWORKING;
 
     return switch_cause;
@@ -1226,7 +1226,7 @@ void BoardE1::KhompPvtR2::reportFailToReceive(int fail_code)
 
     if (Opt::_options._r2_strict_behaviour()&& fail_code != -1)
     {
-        DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio")); 
+        DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio"));
 
         if(sendRingBackStatus(fail_code) == RingbackDefs::RBST_UNSUPPORTED)
         {
@@ -1386,15 +1386,15 @@ int BoardE1::KhompPvtR2::callFailFromCause(int cause)
 {
     int k3l_fail = -1; // default
 
-    try  
-    {    
+    try
+    {
         bool handled = false;
 
         switch (_r2_country)
-        {    
+        {
             case Verbose::R2_COUNTRY_ARG:
                 switch (cause)
-                {    
+                {
                     case SWITCH_CAUSE_UNALLOCATED_NUMBER:
                     case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET:
                     case SWITCH_CAUSE_NO_ROUTE_DESTINATION:
@@ -1441,13 +1441,13 @@ int BoardE1::KhompPvtR2::callFailFromCause(int cause)
                     default:
                         k3l_fail = kgbArLineOutOfOrder;
                         break;
-                }    
+                }
                 handled = true;
                 break;
 
             case Verbose::R2_COUNTRY_BRA:
                 switch (cause)
-                {    
+                {
                     case SWITCH_CAUSE_UNALLOCATED_NUMBER:
                     case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET:
                     case SWITCH_CAUSE_NO_ROUTE_DESTINATION:
@@ -1661,7 +1661,7 @@ int BoardE1::KhompPvtR2::callFailFromCause(int cause)
                 break;
 
         }
-    
+
         if (!handled)
             throw std::runtime_error("");
     }
@@ -1677,9 +1677,9 @@ int BoardE1::KhompPvtISDN::callFailFromCause(int cause)
 {
     int k3l_fail = -1; // default
 
-    if (cause <= 127) 
+    if (cause <= 127)
         k3l_fail = cause;
-    else 
+    else
         k3l_fail = kq931cInterworking;
 
     return k3l_fail;
@@ -1687,7 +1687,7 @@ int BoardE1::KhompPvtISDN::callFailFromCause(int cause)
 
 RingbackDefs::RingbackStType BoardE1::KhompPvtR2::sendRingBackStatus(int rb_value)
 {
-    DBG(FUNC,PVT_FMT(_target, "(p=%p) this is the r2 ringback procedure") % this);   
+    DBG(FUNC,PVT_FMT(_target, "(p=%p) this is the r2 ringback procedure") % this);
 
     std::string cause = (rb_value == -1 ? "" : STG(FMT("r2_cond_b=\"%d\"") % rb_value));
     return (command(KHOMP_LOG, CM_RINGBACK, cause.c_str()) ?
@@ -1696,12 +1696,12 @@ RingbackDefs::RingbackStType BoardE1::KhompPvtR2::sendRingBackStatus(int rb_valu
 
 bool BoardE1::KhompPvtR2::sendPreAudio(int rb_value)
 {
-    DBG(FUNC,PVT_FMT(_target, "must send R2 preaudio ?"));   
+    DBG(FUNC,PVT_FMT(_target, "must send R2 preaudio ?"));
     if(!KhompPvtE1::sendPreAudio(rb_value))
         return false;
 
 
-    DBG(FUNC,PVT_FMT(_target, "doing the R2 pre_connect wait..."));   
+    DBG(FUNC,PVT_FMT(_target, "doing the R2 pre_connect wait..."));
 
     /* wait some ms, just to be sure the command has been sent. */
     usleep(Opt::_options._r2_preconnect_wait()* 1000);
@@ -1724,30 +1724,30 @@ bool BoardE1::KhompPvtR2::sendPreAudio(int rb_value)
 
 void BoardE1::KhompPvtR2::numberDialTimer(Board::KhompPvt * pvt)
 {
-    try 
-    {   
+    try
+    {
         ScopedPvtLock lock(pvt);
 
         if (!pvt->call()->_flags.check(Kflags::NUMBER_DIAL_ONGOING) ||
              pvt->call()->_flags.check(Kflags::NUMBER_DIAL_FINISHD))
-        {   
+        {
             return;
-        }   
+        }
 
         pvt->call()->_flags.set(Kflags::NUMBER_DIAL_FINISHD);
 
         static_cast<BoardE1::KhompPvtR2*>(pvt)->callR2()->_incoming_exten.clear();
         pvt->command(KHOMP_LOG, CM_END_OF_NUMBER);
-    }   
+    }
     catch (...)
-    {   
+    {
         // TODO: log something.
-    }   
+    }
 }
 
 bool BoardE1::KhompPvtR2::indicateRinging()
 {
-    DBG(FUNC, PVT_FMT(_target, "(R2) c")); 
+    DBG(FUNC, PVT_FMT(_target, "(R2) c"));
 
     bool ret = false;
     try
@@ -1756,10 +1756,10 @@ bool BoardE1::KhompPvtR2::indicateRinging()
 
         /* already playing! */
         if (call()->_indication != INDICA_NONE)
-        {    
+        {
             DBG(FUNC, PVT_FMT(_target, "(R2) r (already playing something: %d)") % call()->_indication);
             return false;
-        }    
+        }
 
         // any collect calls ?
         setCollectCall();
@@ -1769,7 +1769,7 @@ bool BoardE1::KhompPvtR2::indicateRinging()
         bool send_ringback = true;
 
         if (!call()->_flags.check(Kflags::CONNECTED))
-        {    
+        {
             int ringback_value = RingbackDefs::RB_SEND_DEFAULT;
 
             bool do_drop_call = Opt::_options._drop_collect_call()
@@ -1783,19 +1783,19 @@ bool BoardE1::KhompPvtR2::indicateRinging()
 
             const char *condition_string = getFSChannelVar("KR2SendCondition");
 
-            try  
-            {    
+            try
+            {
                 if (condition_string)
-                {    
+                {
                     ringback_value = Strings::toulong(condition_string);
                     DBG(FUNC, PVT_FMT(_target, "KR2SendCondition adjusted ringback value to %d") % ringback_value);
-                }    
-            }    
+                }
+            }
             catch (Strings::invalid_value e)
-            {    
+            {
                 LOG(ERROR, PVT_FMT(_target, "invalid value '%s', adjusted in KR2SendCondition: not a valid number.")
                         % condition_string);
-            }    
+            }
 
             if (Opt::_options._r2_strict_behaviour())
             {
@@ -1814,7 +1814,7 @@ bool BoardE1::KhompPvtR2::indicateRinging()
         }
 
         if (send_ringback)
-        {             
+        {
             DBG(FUNC, PVT_FMT(_target, "Send ringback!"));
 
             call()->_flags.set(Kflags::GEN_CO_RING);
@@ -1826,8 +1826,8 @@ bool BoardE1::KhompPvtR2::indicateRinging()
             /* start stream if it is not already */
             startStream();
 
-            ret = true; 
-        }   
+            ret = true;
+        }
 
     }
     catch (ScopedLockFailed & err)
@@ -1845,14 +1845,14 @@ bool BoardE1::KhompPvtR2::indicateRinging()
         LOG(ERROR, PVT_FMT(_target, "(R2) r (unable to get device: %d!)") % err.device);
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "(R2) r"));
     return ret;
 }
 
 bool BoardE1::KhompPvtR2::onNewCall(K3L_EVENT *e)
 {
-    DBG(FUNC,PVT_FMT(_target, "(R2) c"));   
+    DBG(FUNC,PVT_FMT(_target, "(R2) c"));
 
     std::string r2_categ_a;
 
@@ -1865,13 +1865,13 @@ bool BoardE1::KhompPvtR2::onNewCall(K3L_EVENT *e)
         if (status == ksSuccess && !r2_categ_a.empty())
         {
 
-            try 
-            { 
-                callR2()->_r2_category = Strings::toulong(r2_categ_a); 
+            try
+            {
+                callR2()->_r2_category = Strings::toulong(r2_categ_a);
             }
-            catch (Strings::invalid_value e) 
-            { 
-                /* do nothing */ 
+            catch (Strings::invalid_value e)
+            {
+                /* do nothing */
             };
 
             /* channel will know if is a collect call or not */
@@ -1898,7 +1898,7 @@ bool BoardE1::KhompPvtR2::onNewCall(K3L_EVENT *e)
                 DBG(FUNC,PVT_FMT(_target, "Setting DROP_COLLECT flag"));
             }
 
-            freeFSGlobalVar(&drop_str);            
+            freeFSGlobalVar(&drop_str);
 
             // keeping the hardcore mode
             if (do_drop_collect && call()->_collect_call)
@@ -1910,7 +1910,7 @@ bool BoardE1::KhompPvtR2::onNewCall(K3L_EVENT *e)
             }
             else
             {
-                // send ringback too! 
+                // send ringback too!
                 sendPreAudio(RingbackDefs::RB_SEND_DEFAULT);
                 startStream();
             }
@@ -1926,7 +1926,7 @@ bool BoardE1::KhompPvtR2::onNewCall(K3L_EVENT *e)
         return false;
     }
 
-    DBG(FUNC,PVT_FMT(_target, "(R2) r"));   
+    DBG(FUNC,PVT_FMT(_target, "(R2) r"));
 
     return true;
 }
@@ -1953,7 +1953,7 @@ bool BoardE1::KhompPvtR2::onCallSuccess(K3L_EVENT *e)
     }
     catch(Board::KhompPvt::InvalidSwitchChannel & err)
     {
-        LOG(ERROR,PVT_FMT(_target, "%s") % err._msg.c_str()); 
+        LOG(ERROR,PVT_FMT(_target, "%s") % err._msg.c_str());
         return false;
     }
 
@@ -1997,15 +1997,15 @@ bool BoardE1::KhompPvtR2::onNumberDetected(K3L_EVENT *e)
 {
     DBG(FUNC, PVT_FMT(_target, "(digit=%d) c") % e->AddInfo);
 
-    try  
-    {    
+    try
+    {
         ScopedPvtLock lock(this);
 
         if (call()->_flags.check(Kflags::NUMBER_DIAL_FINISHD))
             return false;
 
         if (!call()->_flags.check(Kflags::NUMBER_DIAL_ONGOING))
-        {    
+        {
             DBG(FUNC, PVT_FMT(_target, "incoming number start..."));
 
             call()->_flags.set(Kflags::NUMBER_DIAL_ONGOING);
@@ -2013,11 +2013,11 @@ bool BoardE1::KhompPvtR2::onNumberDetected(K3L_EVENT *e)
 
             callR2()->_idx_number_dial = Board::board(_target.device)->_timers.add(4000,
                 &BoardE1::KhompPvtR2::numberDialTimer, this, TM_VAL_CALL);
-        }    
-        else 
-        {    
+        }
+        else
+        {
             Board::board(_target.device)->_timers.restart(callR2()->_idx_number_dial);
-        }    
+        }
 
         callR2()->_incoming_exten += e->AddInfo;
 
@@ -2034,7 +2034,7 @@ bool BoardE1::KhompPvtR2::onNumberDetected(K3L_EVENT *e)
         std::string tmp_orig("");
 
         switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, callR2()->_incoming_exten,tmp_orig, false, false))
-        {    
+        {
             case MatchExtension::MATCH_EXACT:
             case MatchExtension::MATCH_NONE:
                 call()->_flags.set(Kflags::NUMBER_DIAL_FINISHD);
@@ -2049,13 +2049,13 @@ bool BoardE1::KhompPvtR2::onNumberDetected(K3L_EVENT *e)
                 DBG(FUNC, "didn't match exact extension, waiting...");
                 // cannot say anything exact about the number, do nothing...
                 break;
-        }    
-    }    
+        }
+    }
     catch (ScopedLockFailed & err)
-    {    
+    {
         LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() );
         return false;
-    }    
+    }
     catch (K3LAPITraits::invalid_device & err)
     {
         LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device);
@@ -2181,7 +2181,7 @@ void BoardE1::KhompPvtFXS::loadOptions()
         parseBranchOptions(it3->second);
     }
 
-    //TODO: Implementar o setVolume para levar em consideracao que o 
+    //TODO: Implementar o setVolume para levar em consideracao que o
     //       padrao pode ser o da FXS
     if (_input_volume != Opt::_options._input_volume())
         setVolume("input", _input_volume);
@@ -2361,7 +2361,7 @@ bool BoardE1::KhompPvtFXS::onSeizureStart(K3L_EVENT *e)
     try
     {
         ScopedPvtLock lock(this);
-    
+
         /* we always have audio */
         call()->_flags.set(Kflags::HAS_PRE_AUDIO);
 
@@ -2370,7 +2370,7 @@ bool BoardE1::KhompPvtFXS::onSeizureStart(K3L_EVENT *e)
         if (justAlloc(true) != SWITCH_STATUS_SUCCESS)
         {
             int fail_code = callFailFromCause(SWITCH_CAUSE_UNALLOCATED_NUMBER);
-            setHangupCause(SWITCH_CAUSE_UNALLOCATED_NUMBER);            
+            setHangupCause(SWITCH_CAUSE_UNALLOCATED_NUMBER);
             cleanup(CLN_FAIL);
             reportFailToReceive(fail_code);
             LOG(ERROR,PVT_FMT(_target, "(FXS) r (Initilization Error on alloc!)"));
@@ -2408,7 +2408,7 @@ bool BoardE1::KhompPvtFXS::onSeizureStart(K3L_EVENT *e)
         LOG(ERROR,PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() );
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "(FXS) r"));
 
     return ret;
@@ -2428,7 +2428,7 @@ bool BoardE1::KhompPvtFXS::onCallSuccess(K3L_EVENT *e)
 
         if (call()->_pre_answer)
         {
-            dtmfSuppression(Opt::_options._out_of_band_dtmfs());     
+            dtmfSuppression(Opt::_options._out_of_band_dtmfs());
 
             startListen();
             startStream();
@@ -2439,8 +2439,8 @@ bool BoardE1::KhompPvtFXS::onCallSuccess(K3L_EVENT *e)
             call()->_flags.set(Kflags::GEN_PBX_RING);
             call()->_idx_pbx_ring = Board::board(_target.device)->_timers.add(
                     Opt::_options._ringback_pbx_delay(),
-                    &Board::KhompPvt::pbxRingGen, 
-                    this, 
+                    &Board::KhompPvt::pbxRingGen,
+                    this,
                     TM_VAL_CALL);
         }
 
@@ -2460,7 +2460,7 @@ bool BoardE1::KhompPvtFXS::onCallSuccess(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(target(), "(FXS) r (%s)") % err._msg.c_str() );
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "(FXS) r"));
 
     return ret;
@@ -2473,10 +2473,10 @@ void BoardE1::KhompPvtFXS::dialTimer(KhompPvt * pvt)
     try
     {
         ScopedPvtLock lock(pvt);
-    
+
         KhompPvtFXS * pvt_fxs = static_cast<BoardE1::KhompPvtFXS*>(pvt);
 
-        if(!pvt_fxs->callFXS()->_flags.check(Kflags::FXS_DIAL_ONGOING) 
+        if(!pvt_fxs->callFXS()->_flags.check(Kflags::FXS_DIAL_ONGOING)
             || pvt_fxs->callFXS()->_flags.check(Kflags::FXS_DIAL_FINISHD))
             return;
 
@@ -2513,7 +2513,7 @@ void BoardE1::KhompPvtFXS::transferTimer(KhompPvt * pvt)
         if(pvt_fxs->callFXS()->_flash_transfer.empty())
         {
             DBG(FUNC, PVT_FMT(pvt->target(), "r (Number is empty)"));
-            
+
             if(!pvt_fxs->stopTransfer())
             {
                 pvt_fxs->cleanup(KhompPvt::CLN_HARD);
@@ -2524,7 +2524,7 @@ void BoardE1::KhompPvtFXS::transferTimer(KhompPvt * pvt)
             return;
         }
 
-        // begin context adjusting + processing 
+        // begin context adjusting + processing
         MatchExtension::ContextListType contexts;
 
         pvt_fxs->validContexts(contexts);
@@ -2552,7 +2552,7 @@ void BoardE1::KhompPvtFXS::transferTimer(KhompPvt * pvt)
             case MatchExtension::MATCH_NONE:
             {
                 DBG(FUNC, PVT_FMT(pvt_fxs->target(), "match none!"));
-                
+
                 if(!pvt_fxs->stopTransfer())
                 {
                     pvt_fxs->cleanup(KhompPvt::CLN_HARD);
@@ -2569,7 +2569,7 @@ void BoardE1::KhompPvtFXS::transferTimer(KhompPvt * pvt)
         LOG(ERROR, PVT_FMT(pvt->target(), "r (unable to lock %s!)") % err._msg.c_str());
         return;
     }
-    
+
     DBG(FUNC, PVT_FMT(pvt->target(), "r"));
 
 }
@@ -2588,20 +2588,20 @@ bool BoardE1::KhompPvtFXS::onChannelRelease(K3L_EVENT *e)
         /*
         if(!callFXS()->_uuid_other_session.empty() && session())
         {
-            
+
             //switch_core_session_t *hold_session;
 
-            //if ((hold_session = switch_core_session_locate(callFXS()->_uuid_other_session.c_str()))) 
+            //if ((hold_session = switch_core_session_locate(callFXS()->_uuid_other_session.c_str())))
             //{
             //    switch_channel_t * hold = switch_core_session_get_channel(hold_session);
             //    switch_channel_stop_broadcast(hold);
             //    switch_channel_wait_for_flag(hold, CF_BROADCAST, SWITCH_FALSE, 5000, NULL);
             //    switch_core_session_rwunlock(hold_session);
             //}
-            
+
             try
             {
-                // get other side of the bridge 
+                // get other side of the bridge
                 switch_core_session_t * peer_session = getFSLockedPartnerSession();
                 unlockPartner(peer_session);
                 DBG(FUNC, PVT_FMT(target(), "bridge with the new session"));
@@ -2628,7 +2628,7 @@ bool BoardE1::KhompPvtFXS::onChannelRelease(K3L_EVENT *e)
 
     DBG(FUNC, PVT_FMT(_target, "(FXS) r"));
     return ret;
+
 }
 /*
 bool BoardE1::KhompPvtFXS::startTransfer()
@@ -2646,23 +2646,23 @@ bool BoardE1::KhompPvtFXS::startTransfer()
         {
             stream = "silence";
         }
-        
+
         unlockPartner(peer_session);
 
         DBG(FUNC, PVT_FMT(target(), "stream=%s") % stream);
 
         if (stream && strcasecmp(stream, "silence"))
         {
-            // Freeswitch not get/put frames 
+            // Freeswitch not get/put frames
             //switch_channel_set_flag(channel, CF_HOLD);
             switch_ivr_broadcast(getUUID(peer_session), stream, SMF_ECHO_ALEG | SMF_LOOP);
         }
 
         callFXS()->_flags.set(Kflags::FXS_FLASH_TRANSFER);
-    
+
         startCadence(PLAY_PBX_TONE);
 
-        callFXS()->_idx_transfer = Board::board(_target.device)->_timers.add(Opt::_options._fxs_digit_timeout()* 1000, &BoardE1::KhompPvtFXS::transferTimer, this, TM_VAL_CALL);        
+        callFXS()->_idx_transfer = Board::board(_target.device)->_timers.add(Opt::_options._fxs_digit_timeout()* 1000, &BoardE1::KhompPvtFXS::transferTimer, this, TM_VAL_CALL);
 
     }
     catch(Board::KhompPvt::InvalidSwitchChannel & err)
@@ -2687,7 +2687,7 @@ bool BoardE1::KhompPvtFXS::stopTransfer()
     DBG(FUNC, PVT_FMT(target(), "c"));
 
     callFXS()->_flags.clear(Kflags::FXS_FLASH_TRANSFER);
-    
+
     callFXS()->_flash_transfer.clear();
 
     stopCadence();
@@ -2703,7 +2703,7 @@ bool BoardE1::KhompPvtFXS::stopTransfer()
 
     try
     {
-        // get other side of the bridge 
+        // get other side of the bridge
         switch_core_session_t * peer_session = getFSLockedPartnerSession();
         switch_channel_t * peer_channel = getFSChannel(peer_session);
 
@@ -2731,12 +2731,12 @@ static switch_status_t xferHook(switch_core_session_t *session)
 
     DBG(FUNC, D("state change=%d") % state);
 
-    if (state == CS_PARK) 
+    if (state == CS_PARK)
     {
         switch_core_event_hook_remove_state_change(session, xferHook);
 
         BoardE1::KhompPvtFXS * pvt = static_cast<BoardE1::KhompPvtFXS*>(switch_core_session_get_private(session));
-        
+
         if(!pvt)
         {
             DBG(FUNC, D("pvt is NULL"));
@@ -2758,17 +2758,17 @@ static switch_status_t xferHook(switch_core_session_t *session)
         }
         catch(ScopedLockFailed & err)
         {
-            LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock: %s!") %  err._msg.c_str());            
+            LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock: %s!") %  err._msg.c_str());
             return SWITCH_STATUS_FALSE;
         }
         catch(Board::KhompPvt::InvalidSwitchChannel & err)
         {
-            LOG(ERROR, PVT_FMT(pvt->target(), "%s!") %  err._msg.c_str());            
+            LOG(ERROR, PVT_FMT(pvt->target(), "%s!") %  err._msg.c_str());
             return SWITCH_STATUS_FALSE;
         }
 
     }
-    else if (state == CS_HANGUP) 
+    else if (state == CS_HANGUP)
     {
         switch_core_event_hook_remove_state_change(session, xferHook);
 
@@ -2795,7 +2795,7 @@ static switch_status_t xferHook(switch_core_session_t *session)
         //}
         //catch(ScopedLockFailed & err)
         //{
-        //   LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock: %s!") %  err._msg.c_str());            
+        //   LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock: %s!") %  err._msg.c_str());
         //}
 
     }
@@ -2823,7 +2823,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind)
 
     try
     {
-        // get other side of the bridge 
+        // get other side of the bridge
         switch_core_session_t * peer_session = getFSLockedPartnerSession();
         switch_channel_t * peer_channel = getFSChannel(peer_session);
 
@@ -2848,7 +2848,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind)
             else
             {
                 DBG(FUNC, PVT_FMT(target(), "first transfer"));
-                callFXS()->_uuid_other_session = getUUID(peer_session);    
+                callFXS()->_uuid_other_session = getUUID(peer_session);
                 const char *stream = NULL;
 
                 if (!(stream = switch_channel_get_hold_music(peer_channel)))
@@ -2866,7 +2866,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind)
                 else
                 {
                     switch_ivr_session_transfer(peer_session, "endless_playback:local_stream://moh,park", "inline", NULL);
-                    //switch_ivr_session_transfer(peer_session, "park", "inline", NULL);                
+                    //switch_ivr_session_transfer(peer_session, "park", "inline", NULL);
                 }
             }
 
@@ -2881,7 +2881,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind)
             call()->_flags.set(Kflags::GEN_CO_RING);
             startCadence(PLAY_RINGBACK);
 
-            
+
             //try
             //{
             //    call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_options._ringback_co_delay(), &Board::KhompPvt::coRingGen,this);
@@ -2890,7 +2890,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind)
             //{
              //   LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device);
             //}
-            
+
         }
     }
     catch(Board::KhompPvt::InvalidSwitchChannel & err)
@@ -2915,7 +2915,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e)
     {
         ScopedPvtLock lock(this);
 
-        if (call()->_flags.check(Kflags::IS_INCOMING) && 
+        if (call()->_flags.check(Kflags::IS_INCOMING) &&
                 callFXS()->_flags.check(Kflags::FXS_OFFHOOK) &&
                 !callFXS()->_flags.check(Kflags::FXS_DIAL_FINISHD))
         {
@@ -2990,7 +2990,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e)
                     DBG(FUNC, PVT_FMT(target(), "match none!"));
 
                     std::string invalid = "i";
-                    
+
                     Board::board(_target.device)->_timers.del(callFXS()->_idx_dial);
 
                     switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, invalid, call()->_orig_addr, true, false))
@@ -3030,7 +3030,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e)
             }
 
             callFXS()->_flash_transfer += e->AddInfo;
-    
+
             // begin context adjusting + processing
             MatchExtension::ContextListType contexts;
 
@@ -3038,7 +3038,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e)
 
             std::string tmp_exten;
             std::string tmp_context;
-            
+
             switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, callFXS()->_flash_transfer, call()->_orig_addr, false, false))
             {
                 case MatchExtension::MATCH_EXACT:
@@ -3101,7 +3101,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to get device: %d!)") % err.device);
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "(FXS) r"));
 
     return ret;
@@ -3126,7 +3126,7 @@ bool BoardE1::KhompPvtFXS::onDtmfSendFinish(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() );
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "(FXS) r"));
 
     return ret;
@@ -3198,7 +3198,7 @@ bool BoardE1::KhompPvtFXS::onFlashDetected(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() );
         return false;
     }
-    
+
     DBG(FUNC, PVT_FMT(_target, "(FXS) r"));
 
     return true;
@@ -3210,7 +3210,7 @@ int BoardE1::KhompPvtFXS::makeCall(std::string params)
 
     /* we always have audio */
     call()->_flags.set(Kflags::HAS_PRE_AUDIO);
-    
+
     if (Opt::_options._fxs_bina()&& !call()->_orig_addr.empty())
     {
         /* Sending Bina DTMF*/
@@ -3280,7 +3280,7 @@ int BoardE1::KhompPvtFXS::makeCall(std::string params)
 bool BoardE1::KhompPvtFXS::doChannelAnswer(CommandRequest &cmd)
 {
     DBG(FUNC, PVT_FMT(_target, "(FXS) c"));
-    
+
     bool ret = true;
 
     try
@@ -3310,7 +3310,7 @@ bool BoardE1::KhompPvtFXS::doChannelAnswer(CommandRequest &cmd)
 bool BoardE1::KhompPvtFXS::doChannelHangup(CommandRequest &cmd)
 {
     DBG(FUNC, PVT_FMT(_target, "(FXS) c"));
-    
+
     bool ret = true;
 
     bool answered     = true;
@@ -3319,15 +3319,15 @@ bool BoardE1::KhompPvtFXS::doChannelHangup(CommandRequest &cmd)
     try
     {
         ScopedPvtLock lock(this);
-       
+
         /*
         if(!callFXS()->_uuid_other_session.empty())
         {
             DBG(FUNC,PVT_FMT(_target, "unable to transfer"));
-            
+
             switch_core_session_t *hold_session;
 
-            if ((hold_session = switch_core_session_locate(callFXS()->_uuid_other_session.c_str()))) 
+            if ((hold_session = switch_core_session_locate(callFXS()->_uuid_other_session.c_str())))
             {
                 switch_channel_t *hold_channel = switch_core_session_get_channel(hold_session);
                 switch_core_session_rwunlock(hold_session);
@@ -3336,7 +3336,7 @@ bool BoardE1::KhompPvtFXS::doChannelHangup(CommandRequest &cmd)
                     switch_channel_hangup(hold_channel, (switch_call_cause_t)call()->_hangup_cause);
                 //switch_channel_hangup(hold_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
             }
-            callFXS()->_uuid_other_session.clear();            
+            callFXS()->_uuid_other_session.clear();
         }
         */
 
@@ -3366,7 +3366,7 @@ bool BoardE1::KhompPvtFXS::doChannelHangup(CommandRequest &cmd)
             }
             else
             {
-                DBG(FUNC,PVT_FMT(_target, "disconnecting outgoing channel...")); 
+                DBG(FUNC,PVT_FMT(_target, "disconnecting outgoing channel..."));
 
                 disconnected = command(KHOMP_LOG, CM_DISCONNECT);
             }
@@ -3521,7 +3521,7 @@ void BoardE1::KhompPvtFXS::reportFailToReceive(int fail_code)
 
     if(fail_code != -1)
     {
-        DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio")); 
+        DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio"));
 
         if(sendRingBackStatus(fail_code) == RingbackDefs::RBST_UNSUPPORTED)
         {
@@ -3542,7 +3542,7 @@ bool BoardE1::KhompPvtFXS::validContexts(
         MatchExtension::ContextListType & contexts, std::string extra_context)
 {
     DBG(FUNC,PVT_FMT(_target, "(FXS) c"));
-    
+
     if(!_context.empty())
         contexts.push_back(_context);
 
index 48e0010418a855d29a106bf8ab4f9616d9a13aae..a5c66afaeeaf37da757697701e69900c5ad339a6 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -72,7 +72,7 @@ bool BoardPassive::KhompPvtPassive::validContexts(
 bool BoardPassive::KhompPvtHI::onSeizureStart(K3L_EVENT *e)
 {
     DBG(FUNC,PVT_FMT(_target,"(HI) c"));
-   
+
     try
     {
         ScopedPvtLock lock(this);
@@ -154,15 +154,15 @@ bool BoardPassive::KhompPvtKPR::onNewCall(K3L_EVENT *e)
 
         Globals::k3lapi.get_param(e, "orig_addr", orig_addr);
         Globals::k3lapi.get_param(e, "dest_addr", dest_addr);
-        
+
         if(dest_addr.empty())
         {
             dest_addr="s";
         }
 
-        bool isdn_reverse_charge = false;        
+        bool isdn_reverse_charge = false;
         std::string isdn_reverse_charge_str;
-        int isdn_status = Globals::k3lapi.get_param(e, "isdn_reverse_charge", isdn_reverse_charge_str);        
+        int isdn_status = Globals::k3lapi.get_param(e, "isdn_reverse_charge", isdn_reverse_charge_str);
 
         if (isdn_status == ksSuccess && !isdn_reverse_charge_str.empty())
         {
@@ -198,7 +198,7 @@ bool BoardPassive::KhompPvtKPR::onNewCall(K3L_EVENT *e)
 
         if(isdn_reverse_charge || r2_category == kg2CollectCall)
         {
-            call()->_collect_call = true;            
+            call()->_collect_call = true;
         }
 
 #if SWITCH_LESS_THAN(1,0,6)
@@ -261,8 +261,8 @@ bool BoardPassive::KhompPvtKPR::onNewCall(K3L_EVENT *e)
         LOG(ERROR, PVT_FMT(target(), "(KPR) r (unable to lock %s!)") % err._msg.c_str() );
         return false;
     }
-    
-    DBG(FUNC, PVT_FMT(_target, "(KPR) r"));   
+
+    DBG(FUNC, PVT_FMT(_target, "(KPR) r"));
     return true;
 }
 
index 01d168948c0f00f9f65e79ec45e89b15ee26ea11..f7be368e05c0878f8eb8e97a915faab8591b539e 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
index c68518a81c31fec84743394437f4a01c00172617..cb66668e5bbe5808e0f35d5891c1c51b4b53ec2b 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -73,14 +73,14 @@ namespace K
     {
         return file.provide();
     }
-        
+
     bool Logger::start()
     {
         /* we love shortcuts! */
-        typedef LogManager::Option LogOpt; 
+        typedef LogManager::Option LogOpt;
 
         typedef LogOpt::Flags     Flags;
-        typedef LogOpt::InitFlags FL;  
+        typedef LogOpt::InitFlags FL;
 
         /* configures default log levels */
         Logger::Logg.classe(C_ERROR)
@@ -203,23 +203,23 @@ namespace K
         std::string new_gen;
 
         for (unsigned int i = 0;; i++)
-        {   
-            std::string tmp = base_path + STG(FMT("generic.%d.log") % i); 
+        {
+            std::string tmp = base_path + STG(FMT("generic.%d.log") % i);
 
             if (access(tmp.c_str(), R_OK|W_OK) != 0 && errno == ENOENT)
-            {   
+            {
                 new_gen = tmp;
                 break;
-            }   
-        }   
+            }
+        }
 
         std::string old_gen = base_path + "generic.log";
 
         if (rename(old_gen.c_str(), new_gen.c_str()) != 0)
-        {   
+        {
             Logger::Logg(C_ERROR, FMT("unable to move generic log file: %s.") % strerror(errno));
             return false;
-        }   
+        }
 
         Globals::logs_being_rotated = true;
 
@@ -250,8 +250,8 @@ namespace K
 
         Strings::Merger strs;
 
-        for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++) 
-        {    
+        for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++)
+        {
             std::string tok = Strings::trim(*i);
 
             /**/ if ((tok) == "errors")     flag_errors   = true;
@@ -264,14 +264,14 @@ namespace K
             else if ((tok) == "link")       flag_link     = true;
             else if ((tok) == "cas")        flag_cas      = true;
             else if ((tok) == "standard")
-            {    
+            {
                 flag_errors   = true;
                 flag_warnings = true;
                 flag_messages = true;
                 flag_link     = true;
-            }    
+            }
             else if ((tok) == "all")
-            {    
+            {
                 flag_errors   = true;
                 flag_warnings = true;
                 flag_messages = true;
@@ -281,12 +281,12 @@ namespace K
                 flag_modem    = true;
                 flag_link     = true;
                 flag_cas      = true;
-            }    
-            else 
-            {    
+            }
+            else
+            {
                 K::Logger::Logg2(classe, s, FMT("WARNING: The following console message option is not valid and will be ignored: %s.") % (tok) );
                 continue;
-            }    
+            }
 
             strs.add(tok);
         }
@@ -335,9 +335,9 @@ namespace K
         bool flag_streams   = false;
 
         Strings::Merger strs;
-        
-        for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++) 
-        {    
+
+        for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++)
+        {
             std::string tok = Strings::trim(*i);
 
             /**/ if ((tok) == "errors")     flag_errors    = true;
@@ -354,14 +354,14 @@ namespace K
             else if ((tok) == "locks")      flag_locks     = true;
             else if ((tok) == "streams")    flag_streams   = true;
             else if ((tok) == "standard")
-            {    
+            {
                 flag_errors   = true;
                 flag_warnings = true;
                 flag_messages = true;
                 flag_link     = true;
-            }    
+            }
             else if ((tok) == "debugging")
-            {    
+            {
                 flag_errors    = true;
                 flag_warnings  = true;
                 flag_messages  = true;
@@ -372,9 +372,9 @@ namespace K
                 flag_link      = true;
                 flag_cas       = true;
                 flag_functions = true;
-            }    
+            }
             else if ((tok) == "all")
-            {    
+            {
                 flag_errors    = true;
                 flag_warnings  = true;
                 flag_messages  = true;
index 5de3fc52d29f887f08e6525202f50b3d8129b011..5166643f708dfb34aaf2f4c55abce8c7168882d2 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -60,8 +60,8 @@ BranchToObjectMapType Opt::_fxs_branch_map;
 /* not beautiful, should think of something! */
 #define FUNCTION_VALUE(x) reinterpret_cast< Config::FunctionValue Options::* >( x )
 
-void Opt::initialize(void) 
-{ 
+void Opt::initialize(void)
+{
     Globals::options.add(Config::Option("debug",    &Options::_debug,    false));
     Globals::options.add(Config::Option("dialplan", &Options::_dialplan, "XML"));
     Globals::options.add(Config::Option("context",  &Options::_context,  "default"));
@@ -97,33 +97,33 @@ void Opt::initialize(void)
 
     Globals::options.add(Config::Option("flash-to-digits", &Options::_flash, "*1"));
 
-    Globals::options.add(Config::Option("delay-ringback-co",  &Options::_ringback_co_delay,  1500u, 0u, 999000u)); 
+    Globals::options.add(Config::Option("delay-ringback-co",  &Options::_ringback_co_delay,  1500u, 0u, 999000u));
     Globals::options.add(Config::Option("delay-ringback-pbx", &Options::_ringback_pbx_delay, 2500u, 0u, 999000u));
-    
-    Globals::options.add(Config::Option("disconnect-delay", &Options::_disconnect_delay, 0u, 0u, 100000u)); 
+
+    Globals::options.add(Config::Option("disconnect-delay", &Options::_disconnect_delay, 0u, 0u, 100000u));
 
     Globals::options.add(Config::Option("input-volume",  &Options::_input_volume, 0, -10, 10));
     Globals::options.add(Config::Option("output-volume", &Options::_output_volume, 0, -10, 10));
 
-    Globals::options.add(Config::Option("fxs-co-dialtone", 
+    Globals::options.add(Config::Option("fxs-co-dialtone",
         FUNCTION_VALUE(&Options::_fxs_co_dialtone), ""));
 
-    Globals::options.add(Config::Option("log-to-disk",   
+    Globals::options.add(Config::Option("log-to-disk",
         FUNCTION_VALUE(&Options::_log_disk_option),    "standard", false));
 
     Globals::options.add(Config::Option("callgroup", &Options::_callgroup,   "0"));
 
     Globals::options.add(Config::Option("pickupgroup", &Options::_pickupgroup, "0"));
-    
+
     Globals::options.add(Config::Option("log-to-console",
         FUNCTION_VALUE(&Options::_log_console_option), "standard", false));
 
     Globals::options.add(Config::Option("trace",
         FUNCTION_VALUE(&Options::_log_trace_option), "", false));
 
-    Globals::options.add(Config::Option("record-prefix", 
+    Globals::options.add(Config::Option("record-prefix",
         FUNCTION_VALUE(&Options::_record_prefix), "/var/spool/freeswitch/monitor/"));
-    
+
     Globals::options.add(Config::Option("fxs-global-orig", &Options::_fxs_global_orig_base,  "0"));
 
     Globals::options.add(Config::Option("language", &Options::_global_language, ""));
@@ -152,7 +152,7 @@ void Opt::initialize(void)
          (unsigned int)KHOMP_READ_PACKET_SIZE, (unsigned int)KHOMP_MIN_READ_PACKET_SIZE, (unsigned int)KHOMP_MAX_READ_PACKET_SIZE, 8u));
 
     Globals::options.add(Config::Option("user-transfer-digits", &Options::_user_xfer_digits, ""));
-    
+
     /* aliases */
     Globals::options.synonym("context-gsm", "context-gsm-call");
     Globals::options.synonym("context-gsm-alt", "context-gsm-call-alt");
@@ -173,7 +173,7 @@ void Opt::obtain(void)
     try
     {
         /* everything should start clean! */
-        cleanConfiguration();        
+        cleanConfiguration();
 
         /* reset loaded options */
         Globals::options.reset(&Opt::_options);
@@ -190,10 +190,10 @@ void Opt::obtain(void)
             DBG(FUNC,FMT("%s") % (*i).c_str());
         }
     }
-    catch (std::runtime_error & e) 
-    {    
+    catch (std::runtime_error & e)
+    {
         LOG(ERROR, FMT("unable to obtain general options: %s: procedure aborted!") % e.what());
-    }    
+    }
 }
 
 void Opt::commit(void)
@@ -204,28 +204,28 @@ void Opt::commit(void)
     OrigToDestMapType::const_iterator endOfHotlines = _fxs_hotline.end();
 
     for (OrigToDestMapType::const_iterator i = _fxs_hotline.begin(); i != endOfHotlines; i++)
-    {  
+    {
         BranchToObjectMapType::const_iterator j = _fxs_branch_map.find(i->first);
 
         if (j == _fxs_branch_map.end())
-        {   
+        {
             LOG(ERROR, FMT("unable to find branch '%s': hotline '%s' to '%s' is invalid!")
                 % i->first % i->first % i->second);
-        } 
-    }   
+        }
+    }
 
     /* Check FXS options correcteness */
     BranchToOptMapType::const_iterator endOfOptions = _branch_options.end();
-        
+
     for (BranchToOptMapType::const_iterator i = _branch_options.begin(); i != endOfOptions; i++)
-    {   
-        BranchToObjectMapType::const_iterator j = _fxs_branch_map.find(i->first);        
+    {
+        BranchToObjectMapType::const_iterator j = _fxs_branch_map.find(i->first);
         if (j == _fxs_branch_map.end())
-        {   
+        {
             LOG(ERROR, FMT("unable to find branch '%s' for options '%s'")
                 % i->first % i->second);
-        } 
-    }   
+        }
+    }
 }
 
 void Opt::loadConfiguration(const char *file_name, const char **section, bool show_errors)
@@ -244,7 +244,7 @@ void Opt::loadConfiguration(const char *file_name, const char **section, bool sh
 
     /* Load all the global settings pertinent to all boards */
     settings = processSimpleXML(cfg,"settings");
-    
+
     /* Process channel settings */
     processSimpleXML(settings,"channels");
 
@@ -262,7 +262,7 @@ void Opt::loadConfiguration(const char *file_name, const char **section, bool sh
 
     /* Process fxs options settings */
     processFXSOptions(settings);
-    
+
     switch_xml_free(xml);
 }
 
@@ -307,24 +307,24 @@ void Options::RecordPrefixOption::operator()(const Config::StringType & str)
     if (mkdir(str.c_str(), 493 /* 0755 */) < 0 && errno != EEXIST)
         throw Config::Failure("the default recording directory could not be created.");
 
-    _value = str; 
+    _value = str;
 }
 
-void Options::CentralOfficeDialtone::operator()(const Config::StringType & str) 
+void Options::CentralOfficeDialtone::operator()(const Config::StringType & str)
 {
     Strings::vector_type tokens;
     Strings::tokenize(str, tokens, ",");
 
-    for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++) 
+    for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++)
         _value.push_back(*i);
 }
 
-void Options::LogDiskOption::operator()(const Config::StringType & str) 
+void Options::LogDiskOption::operator()(const Config::StringType & str)
 {
     K::Logger::processLogDisk(NULL, str, false, true);
 }
 
-void Options::LogConsoleOption::operator()(const Config::StringType & str) 
+void Options::LogConsoleOption::operator()(const Config::StringType & str)
 {
     K::Logger::processLogConsole(NULL, str, false, true);
 }
@@ -408,7 +408,7 @@ switch_xml_t Opt::processSimpleXML(switch_xml_t &xml, const std::string& child_n
             }
             catch (Config::Failure e)
             {
-                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")  
+                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")
                     % e.what()
                     % var
                     % val);
@@ -442,7 +442,7 @@ void Opt::processGroupXML(switch_xml_t &xml)
             }
             catch (Config::Failure e)
             {
-                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")  
+                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")
                     % e.what()
                     % var
                     % val);
@@ -485,30 +485,30 @@ void Opt::processCadenceXML(switch_xml_t &xml)
                     cadence.ring_s     = Strings::toulong(Strings::trim(values[1]));
 
                     if (values.size() == 4)
-                    {   
+                    {
                         cadence.ring_ext   = Strings::toulong(Strings::trim(values[2]));
                         cadence.ring_ext_s = Strings::toulong(Strings::trim(values[3]));
-                    }   
+                    }
 
                     _cadences.erase(var); /* erases previous (possibly predefined) cadence */
                     _cadences.insert(CadencesPairType(var, cadence));
-                } 
+                }
             }
             catch (Config::Failure e)
             {
-                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")  
+                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")
                     % e.what()
                     % var
                     % val);
 
-            }                  
+            }
             catch (Strings::invalid_value e)
-            {   
-               LOG(ERROR,FMT("file '%s': number expected at cadence '%s', got '%s'.") 
+            {
+               LOG(ERROR,FMT("file '%s': number expected at cadence '%s', got '%s'.")
                     % "khomp.conf.xml"
                     % var
                     % e.value().c_str());
-            }   
+            }
         }
     }
 }
@@ -571,7 +571,7 @@ void Opt::processFXSBranchesXML(switch_xml_t &xml)
 
                     if (!found)
                     {
-                        LOG(WARNING, FMT("file 'khomp.conf.xml': board with serial number '%u' not found!") 
+                        LOG(WARNING, FMT("file 'khomp.conf.xml': board with serial number '%u' not found!")
                         % serial_number);
 
                         break;
@@ -580,7 +580,7 @@ void Opt::processFXSBranchesXML(switch_xml_t &xml)
             }
             catch (Config::Failure e)
             {
-                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")  
+                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")
                     % e.what()
                     % var
                     % val);
@@ -623,16 +623,16 @@ void Opt::processFXSHotlines(switch_xml_t &xml)
             }
             catch (Config::Failure e)
             {
-                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")  
+                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")
                     % e.what()
                     % var
-                    % val);        
+                    % val);
             }
             catch (Strings::invalid_value e)
             {
-                LOG(WARNING, FMT("file '%s': number expected, got '%s'!") 
+                LOG(WARNING, FMT("file '%s': number expected, got '%s'!")
                     % "khomp.conf.xml" % e.value().c_str());
-            }  
+            }
         }
     }
 }
@@ -658,16 +658,16 @@ void Opt::processFXSOptions(switch_xml_t &xml)
                 Strings::tokenize(var, branches, " ,");
 
                 if (branches.size() < 1)
-                {   
+                {
                     //TODO: Get linenumber
-                    LOG(WARNING, FMT("file '%s': no branches specified in line %d!") 
+                    LOG(WARNING, FMT("file '%s': no branches specified in line %d!")
                     % "khomp.conf.xml" % 0);
-                }           
+                }
                 else
-                {   
+                {
                     for (Strings::vector_type::iterator iter = branches.begin();
                             iter != branches.end(); iter++)
-                    {                   
+                    {
                         std::string tmp_branch = Strings::trim(*iter);
 
                         unsigned long branch_number = Strings::toulong(tmp_branch);
@@ -679,14 +679,14 @@ void Opt::processFXSOptions(switch_xml_t &xml)
             }
             catch (Config::Failure e)
             {
-                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")  
+                LOG(ERROR,FMT("config processing error: %s. [%s=%s]")
                     % e.what()
                     % var
-                    % val);      
+                    % val);
             }
             catch (Strings::invalid_value e)
             {
-                LOG(WARNING, FMT("file '%s': number expected, got '%s'!") 
+                LOG(WARNING, FMT("file '%s': number expected, got '%s'!")
                     % "khomp.conf.xml" % e.value().c_str());
             }
         }
index 907708a70455d397f007655f43c5a64b093ccd0d..38b0cfb6d92f76789aa2b7aee9f931038742dcef 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -505,61 +505,61 @@ struct funProcessSMSChannelString
 
     funProcessSMSChannelString(int *cause)
     : _cause(cause), _all_fail(true), _pvt(NULL)
-    {};  
+    {};
 
     bool operator()(unsigned int dev, unsigned int obj, SpecFlagsType & flags)
-    {    
+    {
         Board::KhompPvt *pvt = Board::findFree(dev, obj);
 
         if (pvt)
         {
-            // found something? check if its GSM 
+            // found something? check if its GSM
             if (pvt->application(SMS_CHECK, NULL, NULL))
-            {    
-                // used for cause definition 
+            {
+                // used for cause definition
                 if (_all_fail)
                     _all_fail = (pvt ? !pvt->isOK() : true);
 
                 if (flags & SPF_CYCLIC)
-                {    
+                {
                     Board::queueAddChannel(_channels, dev, obj);
                     return true;
-                }    
-                else 
-                {    
-                    _pvt = pvt; 
+                }
+                else
+                {
+                    _pvt = pvt;
                     return false;
-                }    
-            }    
-            else 
-            {    
-                // not gsm, return ASAP and stop search 
+                }
+            }
+            else
+            {
+                // not gsm, return ASAP and stop search
                 LOG(ERROR, PVT_FMT(pvt->target(), "channel is NOT a GSM channel! unable to send message!"));
                 return false;
             }
         }
 
-        // keep searching 
+        // keep searching
         return true;
     }
 
     Board::KhompPvt * pvt(SpecFlagsType & flags)
-    {    
+    {
         if ((flags & SPF_CYCLIC) && !_pvt)
-        {    
-            // we have no pvt 'till now, lets find a suitable one.. 
+        {
+            // we have no pvt 'till now, lets find a suitable one..
             _pvt = Board::queueFindFree(_channels);
         }
 
         if (!_pvt && _cause && !(*_cause))
-        {    
+        {
             if (_all_fail)
-            {    
-                // all channels are in fail 
+            {
+                // all channels are in fail
                 *_cause = SWITCH_CAUSE_NETWORK_OUT_OF_ORDER;
-            }    
-            else 
-            {    
+            }
+            else
+            {
                 // otherwise, congestion..
                 *_cause = SWITCH_CAUSE_SWITCH_CONGESTION;
             }
@@ -652,10 +652,10 @@ bool processSMSChannelString(std::string & str, Board::KhompPvt *& pvt, int *cau
     funProcessSMSChannelString proc(cause);
 
     SpecFlagsType flags = SPF_FIRST;
-    SpecFunType   fun(proc, false); 
+    SpecFunType   fun(proc, false);
 
-    switch (processSpecAtoms(str, flags, fun)) 
-    {    
+    switch (processSpecAtoms(str, flags, fun))
+    {
         case SPR_FAIL:
             DBG(FUNC, FMT("SPR_FAIL: %p") % cause);
             if (cause)
@@ -666,7 +666,7 @@ bool processSMSChannelString(std::string & str, Board::KhompPvt *& pvt, int *cau
         case SPR_CONTINUE:
             pvt = proc.pvt(flags);
             DBG(FUNC, FMT("pvt = %p") % pvt);
-                       
+
             if (cause && !(*cause))
             {
                        if (!pvt)
@@ -676,7 +676,7 @@ bool processSMSChannelString(std::string & str, Board::KhompPvt *& pvt, int *cau
             }
 
             return true;
-    }    
+    }
 
     return true;
 }
@@ -712,7 +712,7 @@ Board::KhompPvt * processDialString (const char *dial_charv, int *cause)
 
        unsigned int opt_size = (pvt->hasNumberDial() ? 3 : 2);
        unsigned int opt_arg  = opt_size - 1;
-    
+
        if (dial_args.size() == opt_size)
        {
         Strings::vector_type options_args;
@@ -783,7 +783,7 @@ Board::KhompPvt * processSMSString (const char *sms_charv, int *cause)
     std::string           sms_string(sms_charv);
     Strings::vector_type  sms_args;
 
-    Strings::tokenize(sms_string, sms_args, "/|,", 3); // '/' is a backward compatibility feature! 
+    Strings::tokenize(sms_string, sms_args, "/|,", 3); // '/' is a backward compatibility feature!
 
     DBG(FUNC, FMT("processing SMS string [%d] : '%s'") % sms_args.size() % sms_string);
 
@@ -834,7 +834,7 @@ Board::KhompPvt * processSMSString (const char *sms_charv, int *cause)
         conf = true;
     }
 
-    // get options/values 
+    // get options/values
     pvt->send_sms.sms_dest = dest;
     pvt->send_sms.sms_conf = conf;
     pvt->send_sms.sms_body = sms_args[2];
@@ -870,10 +870,10 @@ void processGroupString()
         switch (processSpecAtoms(tokens[0], flags, fun))
         {
             case SPR_CONTINUE:
-                // remove context from spec 
+                // remove context from spec
                 opts = tokens[0];
 
-                // log this! 
+                // log this!
                 DBG(CONF, FMT("group '%s' is now '%s', with context '%s'...")
                         % name % tokens[0] % tokens[1]);
                 break;
@@ -881,10 +881,10 @@ void processGroupString()
             default:
                 LOG(WARNING, FMT("skipping group '%s', bad configuration!\n") % name.c_str());
 
-                // "zero" group 
+                // "zero" group
                 opts.clear();
 
-                // log this! 
+                // log this!
                 DBG(CONF, FMT("group '%s' have misconfigured options, ignoring...") % name);
                 break;
         }
index 256ee54e3e67e4d2a10017dd80b89e55a5116cf2..8f7b33f43e6bafe6a60d2687a732103870a2592a 100644 (file)
@@ -3,10 +3,10 @@
     KHOMP generic endpoint/channel library.
     Copyright (C) 2007-2010 Khomp Ind. & Com.
 
-  The contents of this file are subject to the Mozilla Public License 
-  Version 1.1 (the "License"); you may not use this file except in compliance 
-  with the License. You may obtain a copy of the License at 
-  http://www.mozilla.org/MPL/ 
+  The contents of this file are subject to the Mozilla Public License
+  Version 1.1 (the "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+  http://www.mozilla.org/MPL/
 
   Software distributed under the License is distributed on an "AS IS" basis,
   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   case the provisions of "LGPL License" are applicable instead of those above.
 
   If you wish to allow use of your version of this file only under the terms of
-  the LGPL License and not to allow others to use your version of this file 
-  under the MPL, indicate your decision by deleting the provisions above and 
-  replace them with the notice and other provisions required by the LGPL 
-  License. If you do not delete the provisions above, a recipient may use your 
+  the LGPL License and not to allow others to use your version of this file
+  under the MPL, indicate your decision by deleting the provisions above and
+  replace them with the notice and other provisions required by the LGPL
+  License. If you do not delete the provisions above, a recipient may use your
   version of this file under either the MPL or the LGPL License.
 
   The LGPL header follows below:
@@ -36,7 +36,7 @@
     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, 
+    along with this library; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 *******************************************************************************/
@@ -112,7 +112,7 @@ void Kflags::init()
     _flags[SMS_DOING_UPLOAD]._value = false;
 
     /*
-    NOW LOADING ... 
+    NOW LOADING ...
 
     _flags[BRIDGED]._name = "BRIDGED";
     _flags[BRIDGED]._value = false;
@@ -144,10 +144,10 @@ bool ChanCommandHandler::write(const CommandRequest & cmd)
 
 void ChanCommandHandler::unreference()
 {
-    
+
     if (!_fifo)
         return;
-    
+
     if(_fifo->_thread)
     {
         _fifo->_thread->join();
@@ -200,10 +200,10 @@ bool ChanEventHandler::write(const EventRequest & evt)
 
 void ChanEventHandler::unreference()
 {
-    
+
     if (!_fifo)
         return;
-    
+
     if(_fifo->_thread)
     {
         _fifo->_thread->join();
@@ -218,7 +218,7 @@ void ChanEventHandler::unreference()
 const char * answerInfoToString(int answer_info)
 {
     switch (answer_info)
-    {    
+    {
         case Board::KhompPvt::CI_MESSAGE_BOX:
             return "MessageBox";
         case Board::KhompPvt::CI_HUMAN_ANSWER:
@@ -231,12 +231,12 @@ const char * answerInfoToString(int answer_info)
             return "Unknown";
         case Board::KhompPvt::CI_FAX:
             return "Fax";
-    }    
+    }
 
     return NULL;
 }
 /******************************* Match functions ******************************/
-bool MatchExtension::canMatch(std::string & context, std::string & exten, 
+bool MatchExtension::canMatch(std::string & context, std::string & exten,
                               std::string & caller_id, bool match_more)
 {
     if(!match_more)
@@ -249,7 +249,7 @@ bool MatchExtension::canMatch(std::string & context, std::string & exten,
         char key_digit  = '#';
         size_t finished = exten.find_last_of(key_digit);
         char last_char  = exten.at(exten.size() - 1);
-    
+
         if(finished != std::string::npos && last_char == key_digit)
         {
             if(exten.size() <= 1)
@@ -263,7 +263,7 @@ bool MatchExtension::canMatch(std::string & context, std::string & exten,
             return false;
         }
     }
-    
+
     return true;
 
 /*
@@ -281,7 +281,7 @@ bool MatchExtension::canMatch(std::string & context, std::string & exten,
             DBG(FUNC,"extension cannot match, returning");
 
             if(xml)
-                switch_xml_free(xml); 
+                switch_xml_free(xml);
 
             return false;
         }
@@ -294,24 +294,24 @@ bool MatchExtension::canMatch(std::string & context, std::string & exten,
             {
                 std::string expression;
 
-                if (switch_xml_child(xcond, "condition")) 
-                { 
+                if (switch_xml_child(xcond, "condition"))
+                {
                     LOG(ERROR,"Nested conditions are not allowed");
-                }  
+                }
 
                 switch_xml_t xexpression = switch_xml_child(xcond, "expression");
 
-                if ((xexpression = switch_xml_child(xcond, "expression"))) 
+                if ((xexpression = switch_xml_child(xcond, "expression")))
                 {
                     expression = switch_str_nil(xexpression->txt);
                 }
-                else 
+                else
                 {
                     expression =  switch_xml_attr_soft(xcond, "expression");
-                }  
+                }
 
                 if(expression.empty() || expression == "^(.*)$")
-                {                    
+                {
                     //We're not gonna take it
                     //No, we ain't gonna take it
                     // We're not gonna take it anymore
@@ -319,7 +319,7 @@ bool MatchExtension::canMatch(std::string & context, std::string & exten,
                     continue;
                 }
 
-                int pm = -1; 
+                int pm = -1;
                 switch_status_t is_match = SWITCH_STATUS_FALSE;
                 is_match =  switch_regex_match_partial(exten.c_str(),expression.c_str(),&pm);
 
@@ -343,7 +343,7 @@ bool MatchExtension::canMatch(std::string & context, std::string & exten,
                 {
                     // not match
                 }
-            }            
+            }
 
             xexten = xexten->next;
         }
@@ -354,7 +354,7 @@ bool MatchExtension::canMatch(std::string & context, std::string & exten,
     }
 
     if(xml)
-        switch_xml_free(xml); 
+        switch_xml_free(xml);
 
     return false;
 */
@@ -362,9 +362,9 @@ bool MatchExtension::canMatch(std::string & context, std::string & exten,
 
 
 MatchExtension::MatchType MatchExtension::matchExtension(
-                                        std::string & context, 
+                                        std::string & context,
                                         std::string & exten,
-                                        std::string & callerid, 
+                                        std::string & callerid,
                                         bool match_only)
 {
     if(!canMatch(context,exten,callerid))
@@ -447,7 +447,7 @@ MatchExtension::MatchType MatchExtension::findExtension(
             }
         }
     }
-            
+
     ref_context.clear();
     ref_extension.clear();
 
@@ -489,7 +489,7 @@ bool Kommuter::initialize(K3L_EVENT *e)
 {
     /* get total of kommuter devices */
     _kommuter_count = e->AddInfo;
-   
+
     if(Opt::_options._kommuter_activation() == "manual")
     {
         if (_kommuter_count > 0)
@@ -500,15 +500,15 @@ bool Kommuter::initialize(K3L_EVENT *e)
         return true;
     }
 
-    if (_kommuter_count > 0) 
-    {    
+    if (_kommuter_count > 0)
+    {
         bool start_timer = false;
         int timeout = Opt::_options._kommuter_timeout();
 
         std::string param = STG(FMT("timeout=%d") % timeout);
 
         for (int kommuter = 0; kommuter < _kommuter_count; kommuter++)
-        {   
+        {
             try
             {
                 Globals::k3lapi.command(-1, kommuter, CM_START_WATCHDOG, param.c_str());
@@ -535,15 +535,15 @@ bool Kommuter::initialize(K3L_EVENT *e)
         }
 
         if(timeout == 0)
-        {    
+        {
             DBG(FUNC, D("kommuter watchdog timer not created because timeout is 0."));
             return true;
-        }    
+        }
 
         if (start_timer)
-        {    
+        {
             if (!Globals::global_timer)
-            {    
+            {
                 LOG(ERROR, D("error creating the timer for kommuter."));
             }
             else
@@ -559,7 +559,7 @@ bool Kommuter::initialize(K3L_EVENT *e)
     {
         DBG(FUNC, D("no kommuter devices were found on system."));
     }
+
     return true;
 }
 
@@ -627,7 +627,7 @@ ESL::~ESL()
 
     //Remove one from vector
     //_events->pop_back();
-    
+
     if(_events->size() == 0)
     {
         delete _events;
@@ -663,7 +663,7 @@ bool ESL::registerEvents()
 bool ESL::unregisterEvents()
 {
     DBG(FUNC, "Unregister ESLs");
-    
+
     if(!_events)
         return true;
 
index 6ce7ac72165e3a1501748a0756883ef4c4d01bdc..e22ec9cc847ee37ff2141c6a851b88675b84527d 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Emmanuel Schmidbauer <e.schmidbauer@gmail.com>
  *
@@ -144,7 +144,7 @@ static switch_status_t tech_init(loopback_private_t *tech_pvt, switch_core_sessi
                        uint32_t bit, channels;
                        iananame = switch_parse_codec_buf(dup, &interval, &rate, &bit, &channels, &codec_modname, NULL);
                }
-               
+
        }
 
        if (switch_core_codec_ready(&tech_pvt->read_codec)) {
@@ -220,8 +220,8 @@ static switch_status_t tech_init(loopback_private_t *tech_pvt, switch_core_sessi
        return status;
 }
 
-/* 
-   State methods they get called when the state changes to the specific state 
+/*
+   State methods they get called when the state changes to the specific state
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
 */
@@ -298,7 +298,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
 
                if ((vars = (switch_event_t *) switch_channel_get_private(channel, "__loopback_vars__"))) {
                        switch_event_header_t *h;
-               
+
                        switch_channel_set_private(channel, "__loopback_vars__", NULL);
 
                        for (h = vars->headers; h; h = h->next) {
@@ -316,14 +316,14 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
                        if ((argc = switch_split(dup, ',', argv))) {
                                int i;
                                for (i = 0; i < argc; i++) {
-                                       
+
                                        if (!zstr(argv[i])) {
                                                const char *val = switch_channel_get_variable(channel, argv[i]);
 
                                                if(!zstr(val)) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Transfer variable [%s]=[%s] %s -> %s\n",
                                                                                          argv[i], val, switch_channel_get_name(channel), switch_channel_get_name(tech_pvt->other_channel));
-                                                                                         
+
                                                        switch_channel_set_variable(tech_pvt->other_channel, argv[i], val);
                                                }
                                        }
@@ -344,7 +344,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        goto end;
                }
-       } else { 
+       } else {
                switch_mutex_lock(tech_pvt->mutex);
                if ((tech_pvt->other_session = switch_core_session_locate(tech_pvt->other_uuid))) {
                        tech_pvt->other_tech_pvt = switch_core_session_get_private(tech_pvt->other_session);
@@ -394,12 +394,12 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
        do_reset(tech_pvt);
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel));
-       
+
        if (switch_test_flag(tech_pvt, TFLAG_RUNNING_APP)) {
                switch_clear_flag(tech_pvt, TFLAG_RUNNING_APP);
        }
 
-       if (switch_test_flag(tech_pvt, TFLAG_APP) && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && 
+       if (switch_test_flag(tech_pvt, TFLAG_APP) && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND) &&
                (app = switch_channel_get_variable(channel, "loopback_app"))) {
                switch_caller_extension_t *extension = NULL;
 
@@ -512,7 +512,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
                switch_channel_set_private(channel, "__loopback_vars__", NULL);
                switch_event_destroy(&vars);
        }
-       
+
        if (tech_pvt) {
                switch_core_timer_destroy(&tech_pvt->timer);
 
@@ -718,11 +718,11 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
                if (tech_pvt->write_frame) {
                        switch_frame_free(&tech_pvt->write_frame);
                }
-               
+
                tech_pvt->write_frame = (switch_frame_t *) pop;
 
         switch_clear_flag(tech_pvt->write_frame, SFF_RAW_RTP);
-               tech_pvt->write_frame->timestamp = 0;                    
+               tech_pvt->write_frame->timestamp = 0;
 
                tech_pvt->write_frame->codec = &tech_pvt->read_codec;
                *frame = tech_pvt->write_frame;
@@ -760,9 +760,9 @@ static void switch_channel_wait_for_state_or_greater(switch_channel_t *channel,
 {
 
        switch_assert(channel);
-       
+
        for (;;) {
-               if ((switch_channel_get_state(channel) < CS_HANGUP && 
+               if ((switch_channel_get_state(channel) < CS_HANGUP &&
                         switch_channel_get_state(channel) == switch_channel_get_running_state(channel) && switch_channel_get_running_state(channel) >= want_state) ||
                        (other_channel && switch_channel_down_nosig(other_channel)) || switch_channel_down(channel)) {
                        break;
@@ -828,7 +828,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
        tech_pvt = switch_core_session_get_private(session);
        switch_assert(tech_pvt != NULL);
 
-       if (switch_test_flag(frame, SFF_CNG) || 
+       if (switch_test_flag(frame, SFF_CNG) ||
                (switch_test_flag(tech_pvt, TFLAG_BOWOUT) && switch_test_flag(tech_pvt, TFLAG_BOWOUT_USED))) {
                switch_core_timer_sync(&tech_pvt->timer);
                switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer);
@@ -863,7 +863,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
                        find_non_loopback_bridge(tech_pvt->other_session, &br_b, &b_uuid);
                        switch_mutex_lock(tech_pvt->mutex);
 
-                       
+
                        if (br_a) {
                                ch_a = switch_core_session_get_channel(br_a);
                                switch_core_media_bug_transfer_recordings(session, br_a);
@@ -873,7 +873,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
                                ch_b = switch_core_session_get_channel(br_b);
                                switch_core_media_bug_transfer_recordings(tech_pvt->other_session, br_b);
                        }
-                       
+
                        if (ch_a && ch_b && switch_channel_test_flag(ch_a, CF_BRIDGED) && switch_channel_test_flag(ch_b, CF_BRIDGED)) {
 
                                switch_set_flag_locked(tech_pvt, TFLAG_BOWOUT);
@@ -888,7 +888,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
                                if (a_uuid && b_uuid) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                          "%s detected bridge on both ends, attempting direct connection.\n", switch_channel_get_name(channel));
-                                       
+
                                        /* channel_masquerade eat your heart out....... */
                                        switch_ivr_uuid_bridge(a_uuid, b_uuid);
                                        good_to_go = 1;
@@ -898,7 +898,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
 
                        if (br_a) switch_core_session_rwunlock(br_a);
                        if (br_b) switch_core_session_rwunlock(br_b);
-                       
+
                        if (good_to_go) {
                                return SWITCH_STATUS_SUCCESS;
                        }
@@ -908,7 +908,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
 
        if (switch_test_flag(tech_pvt, TFLAG_LINKED) && tech_pvt->other_tech_pvt) {
                switch_frame_t *clone;
-               
+
                if (frame->codec->implementation != tech_pvt->write_codec.implementation) {
                        /* change codecs to match */
                        tech_init(tech_pvt, session, frame->codec);
@@ -919,8 +919,8 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
                if (switch_frame_dup(frame, &clone) != SWITCH_STATUS_SUCCESS) {
                        abort();
                }
-               
-               if ((status = switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone)) != SWITCH_STATUS_SUCCESS) { 
+
+               if ((status = switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone)) != SWITCH_STATUS_SUCCESS) {
                        clear_queue(tech_pvt->other_tech_pvt);
                        status = switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone);
                }
@@ -945,7 +945,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
        loopback_private_t *tech_pvt;
        int done = 1, pass = 0;
        switch_core_session_t *other_session;
-       
+
        channel = switch_core_session_get_channel(session);
        switch_assert(channel != NULL);
 
@@ -1010,7 +1010,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
                                if (!zstr(msg->string_array_arg[0])) {
                                        switch_channel_set_profile_var(tech_pvt->other_channel, "caller_id_name", msg->string_array_arg[0]);
                                }
-                               
+
                                if (!zstr(msg->string_array_arg[1])) {
                                        switch_channel_set_profile_var(tech_pvt->other_channel, "caller_id_number", msg->string_array_arg[1]);
                                }
@@ -1018,12 +1018,12 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
                                if (!zstr(msg->string_array_arg[0])) {
                                        switch_channel_set_profile_var(tech_pvt->other_channel, "callee_id_name", msg->string_array_arg[0]);
                                }
-                               
+
                                if (!zstr(msg->string_array_arg[1])) {
                                        switch_channel_set_profile_var(tech_pvt->other_channel, "callee_id_number", msg->string_array_arg[1]);
                                }
                        }
-                       
+
                        pass = 1;
                }
                break;
@@ -1034,10 +1034,10 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
                        if (!zstr(msg->string_arg) && switch_core_session_get_partner(tech_pvt->other_session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                char *ext = switch_core_session_strdup(other_session, msg->string_arg);
                                char *context = NULL, *dp = NULL;
-                               
+
                                if ((context = strchr(ext, ' '))) {
                                        *context++ = '\0';
-                                       
+
                                        if ((dp = strchr(context, ' '))) {
                                                *dp++ = '\0';
                                        }
@@ -1053,15 +1053,15 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
 
        if (!done && tech_pvt->other_session && (pass || switch_test_flag(tech_pvt, TFLAG_RUNNING_APP))) {
                switch_status_t r = SWITCH_STATUS_FALSE;
-               
+
                if (switch_core_session_get_partner(tech_pvt->other_session, &other_session) == SWITCH_STATUS_SUCCESS) {
                        r = switch_core_session_receive_message(other_session, msg);
                        switch_core_session_rwunlock(other_session);
                }
-               
+
                return r;
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1087,7 +1087,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                switch_event_t *clone = NULL;
 
                switch_core_session_add_stream(*new_session, NULL);
-               
+
                if ((tech_pvt = (loopback_private_t *) switch_core_session_alloc(*new_session, sizeof(loopback_private_t))) != 0) {
                        channel = switch_core_session_get_channel(*new_session);
                        switch_snprintf(name, sizeof(name), "loopback/%s-a", outbound_profile->destination_number);
@@ -1125,7 +1125,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                                if (clone) {
                                        switch_event_add_header_string(clone, SWITCH_STACK_BOTTOM, "loopback_app", app);
                                }
-                               
+
                                if (arg) {
                                        switch_channel_set_variable(channel, "loopback_app_arg", arg);
                                        if (clone) {
@@ -1216,7 +1216,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load)
                return SWITCH_STATUS_TERM;
        }
 
-       
+
        memset(&globals, 0, sizeof(globals));
 
        /* connect my internal structure to the blank pointer passed to me */
@@ -1236,7 +1236,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_loopback_shutdown)
 {
 
        switch_event_free_subclass("loopback::bowout");
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index a715571c6ff2bec8233fb73add3b85cc1633dd23..b11725a2dc4d3d4536e7889e3e1a0bef6f2e7b5e 100644 (file)
@@ -1,7 +1,7 @@
 <configuration name="portaudio.conf" description="Soundcard Endpoint">
   <settings>
-    <!-- indev, outdev, ringdev: 
-        partial case sensitive string match on something in the name 
+    <!-- indev, outdev, ringdev:
+        partial case sensitive string match on something in the name
         or the device number prefixed with # eg "#1" (or blank for default) -->
 
     <!-- device to use for input -->
@@ -36,7 +36,7 @@
     <!-- <param name="unload-on-device-fail" value="true"/> -->
   </settings>
 
-  <!-- 
+  <!--
        mod_portaudio "streams"
 
        The portaudio streams were introduced to support multiple devices and multiple channels in mod_portaudio.
@@ -44,8 +44,8 @@
        want to use them at the same time, you can do it configuring streams and endpoints here.
 
        A "stream" is just a logical container for some settings required by portaudio in order to stream audio and
-       define a friendly name for that configuration. Streams in itself do not do anything else than contain configs. 
-       Once you have your streams defined you can proceed to define "endpoints". Go to the "<endpoints>" section 
+       define a friendly name for that configuration. Streams in itself do not do anything else than contain configs.
+       Once you have your streams defined you can proceed to define "endpoints". Go to the "<endpoints>" section
        for more information on endpoints.
 
        You can use the command "pa shstreams" (portaudio shared streams) to show the configured streams.
 
        <!-- This sample "usb1" configuration was tested with a USB Griffin iMic device -->
        <stream name="usb1">
-               <!-- 
-                       Which device to use for input in this stream 
-                       The value for this parameter must be either in the form '#devno', 
+               <!--
+                       Which device to use for input in this stream
+                       The value for this parameter must be either in the form '#devno',
                        for example '#2' for device number 2, or 'device-name', like 'iMic USB audio system'
                        The output of command "pa devlist" will show you device names and numbers as enumerated
                        by portaudio.
                -->
                <param name="indev" value="#2" />
 
-               <!-- 
+               <!--
                        Same as the indev but for output. In this case the device is capable of input and output
                        Some devices are capable of input only or output only (see the default example)
                -->
                <!-- The sample rate to use for this stream -->
                <param name="sample-rate" value="48000" />
 
-               <!-- 
+               <!--
                        Size of the packets in milliseconds. The smaller the number the less latency you'll have
-                       The minimum value is 10ms 
+                       The minimum value is 10ms
                -->
                <param name="codec-ms" value="10" />
 
-               <!-- 
+               <!--
                        How many channels to open for this stream.
                        If you're device is stereo, you can choose 2 here. However, bear in mind that then
                        your left and right channels will be separated and when creating endpoints you will have
        </stream>
   </streams>
 
-  <!-- 
+  <!--
        mod_portaudio "endpoints"
 
        Endpoints is a way to define the input and output that a given portaudio channel will use.
   -->
   <endpoints>
 
-       <!-- 
-               An endpoint is a handle name to refer to a configuration that determines where to read media from 
-               and write media to. The endpoint can use any input/output stream combination for that purpose as 
+       <!--
+               An endpoint is a handle name to refer to a configuration that determines where to read media from
+               and write media to. The endpoint can use any input/output stream combination for that purpose as
                long as the streams match the sampling rate and codec-ms (see <streams> XML tag).
                You can also omit the instream or the outstream parameter (but obviously not both).
        -->
 
-       <!-- 
+       <!--
                Configuration for a "default" bidirectional endpoint that uses the default stream defined previously in
                the <streams> section.
         -->
        <endpoint name="default">
-               <!-- 
+               <!--
                        The instream, outstream is the name of the stream and channel to use. The stream
-                       name is the same you configured in the <streams> section. This parameters follow 
+                       name is the same you configured in the <streams> section. This parameters follow
                        the syntax <stream-name>:<channel index>. You can omit either the outstream
-                       or the instream, but not both! The channel index is zero-based and must be consistent 
+                       or the instream, but not both! The channel index is zero-based and must be consistent
                        with the number of channels available for that stream (as configured in the <stream> section).
                        You cannot use index 1 if you chose channels=1 in the stream configuration.
                -->
                <param name="outstream" value="default:0" />
        </endpoint>
 
-       <!-- 
+       <!--
                This endpoint uses the USB stream defined previously in the <streams> section and
-               is 'send-only' or 'output-only' and uses the channel index 0 (left channel in a stereo device) 
+               is 'send-only' or 'output-only' and uses the channel index 0 (left channel in a stereo device)
        -->
        <endpoint name="usb1out-left">
                <param name="outstream" value="usb1:0" />
        </endpoint>
 
-       <!-- 
+       <!--
                This endpoint uses the USB stream defined previously in the <streams> section and
-               is 'send-only' or 'output-only' and uses the channel index 1 (right channel in a stereo device) 
+               is 'send-only' or 'output-only' and uses the channel index 1 (right channel in a stereo device)
        -->
        <endpoint name="usb1out-right">
                <param name="outstream" value="usb1:1" />
        </endpoint>
 
-       <!-- 
+       <!--
                This endpoint uses the USB stream defined previously in the <streams> section and
-               is 'receive-only' or 'input-only' and uses the channel index 0 (left channel in a stereo device) 
+               is 'receive-only' or 'input-only' and uses the channel index 0 (left channel in a stereo device)
        -->
        <endpoint name="usb1in-left">
                <param name="instream" value="usb1:0" />
        </endpoint>
 
-       <!-- 
+       <!--
                This endpoint uses the USB stream defined previously in the <streams> section and
-               is 'receive-only' or 'input-only' and uses the channel index 1 (right channel in a stereo device) 
+               is 'receive-only' or 'input-only' and uses the channel index 1 (right channel in a stereo device)
        -->
        <endpoint name="usb1in-right">
                <param name="instream" value="usb1:1" />
        </endpoint>
 
-       <!-- 
+       <!--
                This endpoint uses the USB stream defined previously in the <streams> section and
-               is 'bidirectional' or 'send-receive' and uses the channel index 0 (left channel in a stereo device) 
+               is 'bidirectional' or 'send-receive' and uses the channel index 0 (left channel in a stereo device)
        -->
        <endpoint name="usb1-left">
                <param name="instream" value="usb1:0" />
                <param name="outstream" value="usb1:0" />
        </endpoint>
 
-       <!-- 
+       <!--
                This endpoint uses the USB stream defined previously in the <streams> section and
-               is 'bidirectional' or 'send-receive' and uses the channel index 1 (right channel in a stereo device) 
+               is 'bidirectional' or 'send-receive' and uses the channel index 1 (right channel in a stereo device)
        -->
        <endpoint name="usb1-right">
                <param name="instream" value="usb1:1" />
index 2dc40464201b488304680d7a67a3ec8e90ba1b25..44675c3c8b305e0e6a2ce49b39909a7dc3044e53 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Moises Silva <moises.silva@gmail.com> (Multiple endpoints work sponsored by Comrex Corporation)
  * Raymond Chandler <intralanman@freeswitch.org>
@@ -275,8 +275,8 @@ static int get_dev_by_name(char *name, int in);
 static int get_dev_by_number(char *numstr, int in);
 SWITCH_STANDARD_API(pa_cmd);
 
-/* 
-   State methods they get called when the state changes to the specific state 
+/*
+   State methods they get called when the state changes to the specific state
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
 */
@@ -316,7 +316,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
                }
 
                if (!tech_pvt->audio_endpoint &&
-                   switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && 
+                   switch_test_flag(tech_pvt, TFLAG_OUTBOUND) &&
                    !switch_test_flag(tech_pvt, TFLAG_AUTO_ANSWER)) {
 
                        add_pvt(tech_pvt, PA_SLAVE);
@@ -363,7 +363,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
                        switch_channel_mark_ring_ready(channel);
                }
 
-               while (switch_channel_get_state(channel) == CS_ROUTING && 
+               while (switch_channel_get_state(channel) == CS_ROUTING &&
                       !switch_channel_test_flag(channel, CF_ANSWERED) &&
                       !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
                        switch_size_t olen = globals.readfile_timer.samples;
@@ -396,8 +396,8 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
                                        switch_core_file_seek(&fh, &pos, 0, SEEK_SET);
                                }
 
-                               if (globals.ring_stream && (! switch_test_flag(globals.call_list, TFLAG_MASTER) || 
-                                                       ( !globals.no_ring_during_call && globals.main_stream != globals.ring_stream)) ) { //if there is a ring stream and not an active call or if there is an active call and we are allowed to ring during it AND the ring stream is not the main stream                                             
+                               if (globals.ring_stream && (! switch_test_flag(globals.call_list, TFLAG_MASTER) ||
+                                                       ( !globals.no_ring_during_call && globals.main_stream != globals.ring_stream)) ) { //if there is a ring stream and not an active call or if there is an active call and we are allowed to ring during it AND the ring stream is not the main stream
                                                WriteAudioStream(globals.ring_stream->stream, abuf, (long) olen, 0, &globals.ring_stream->write_timer);
                                }
                        } else {
@@ -438,7 +438,7 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)
 static audio_stream_t* find_audio_stream(int indev, int outdev, int already_locked)
 {
        audio_stream_t *cur_stream;
-       
+
        if (! globals.stream_list) {
                return NULL;
        }
@@ -494,7 +494,7 @@ static switch_status_t validate_main_audio_stream()
        }
 
        globals.main_stream = get_audio_stream(globals.indev, globals.outdev);
-       
+
        if (globals.main_stream) {
                return SWITCH_STATUS_SUCCESS;
        }
@@ -537,7 +537,7 @@ static switch_status_t destroy_actual_stream(audio_stream_t *stream)
 
        CloseAudioStream(stream->stream);
        stream->stream = NULL;
-       
+
        if (stream->write_timer.timer_interface) {
                switch_core_timer_destroy(&stream->write_timer);
        }
@@ -548,12 +548,12 @@ static switch_status_t destroy_actual_stream(audio_stream_t *stream)
 static switch_status_t destroy_audio_stream(int indev, int outdev)
 {
        audio_stream_t *stream;
-       
+
        switch_mutex_lock(globals.streams_lock);
        stream = find_audio_stream(indev, outdev,1);
        if (stream == NULL) {
                switch_mutex_unlock(globals.streams_lock);
-               return SWITCH_STATUS_FALSE;             
+               return SWITCH_STATUS_FALSE;
        }
 
        remove_stream(stream, 1);
@@ -700,7 +700,7 @@ static void remove_pvt(private_t *tech_pvt)
 
        switch_mutex_lock(globals.pvt_lock);
        for (tp = globals.call_list; tp; tp = tp->next) {
-               
+
                if (tp == tech_pvt) {
                        if (switch_test_flag(tp, TFLAG_MASTER)) {
                                switch_clear_flag_locked(tp, TFLAG_MASTER);
@@ -839,8 +839,8 @@ static switch_status_t channel_endpoint_read(audio_endpoint_t *endpoint, switch_
        endpoint->read_frame.data = endpoint->read_buf;
        endpoint->read_frame.buflen = sizeof(endpoint->read_buf);
        endpoint->read_frame.source = __FILE__;
-       samples = ReadAudioStream(endpoint->in_stream->stream, 
-                       endpoint->read_frame.data, STREAM_SAMPLES_PER_PACKET(endpoint->in_stream), 
+       samples = ReadAudioStream(endpoint->in_stream->stream,
+                       endpoint->read_frame.data, STREAM_SAMPLES_PER_PACKET(endpoint->in_stream),
                        endpoint->inchan, &endpoint->read_timer);
 
        if (!samples) {
@@ -866,7 +866,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
        if (tech_pvt->audio_endpoint) {
                return channel_endpoint_read(tech_pvt->audio_endpoint, frame);
        }
-       
+
        if (!globals.main_stream) {
                goto normal_return;
        }
@@ -975,8 +975,8 @@ static switch_status_t channel_endpoint_write(audio_endpoint_t *endpoint, switch
        if (!switch_test_flag(endpoint->master, TFLAG_IO)) {
                return SWITCH_STATUS_SUCCESS;
        }
-       WriteAudioStream(endpoint->out_stream->stream, (short *)frame->data, 
-                       (int)(frame->datalen / sizeof(SAMPLE)), 
+       WriteAudioStream(endpoint->out_stream->stream, (short *)frame->data,
+                       (int)(frame->datalen / sizeof(SAMPLE)),
                        endpoint->outchan, &(endpoint->write_timer));
        return SWITCH_STATUS_SUCCESS;
 }
@@ -1106,7 +1106,7 @@ static int release_stream_channel(shared_audio_stream_t *stream, int index, int
        if (!stream) {
                return rc;
        }
-       
+
        switch_mutex_lock(stream->mutex);
 
        if (input) {
@@ -1187,7 +1187,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "Invalid portaudio endpoint %s\n", endpoint_name);
                        goto error;
                }
-               
+
                switch_mutex_lock(endpoint->mutex);
 
                if (endpoint->master) {
@@ -1197,12 +1197,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                }
 
                codec_ms = endpoint->in_stream ? endpoint->in_stream->codec_ms : endpoint->out_stream->codec_ms;
-               samples_per_packet = endpoint->in_stream ? 
+               samples_per_packet = endpoint->in_stream ?
                        STREAM_SAMPLES_PER_PACKET(endpoint->in_stream) : STREAM_SAMPLES_PER_PACKET(endpoint->out_stream);
                sample_rate = endpoint->in_stream ? endpoint->in_stream->sample_rate : endpoint->out_stream->sample_rate;
 
                if (switch_core_timer_init(&endpoint->read_timer,
-                                  globals.timer_name, codec_ms, 
+                                  globals.timer_name, codec_ms,
                                   samples_per_packet, module_pool) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to setup read timer for endpoint '%s'!\n", endpoint->name);
                        goto error;
@@ -1210,21 +1210,21 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
 
                /* The write timer must be setup regardless */
                if (switch_core_timer_init(&endpoint->write_timer,
-                                  globals.timer_name, codec_ms, 
+                                  globals.timer_name, codec_ms,
                                   samples_per_packet, module_pool) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to setup read timer for endpoint '%s'!\n", endpoint->name);
                        goto error;
                }
 
                if (switch_core_codec_init(&endpoint->read_codec,
-                                                                  "L16", NULL, NULL, sample_rate, codec_ms, 1, 
+                                                                  "L16", NULL, NULL, sample_rate, codec_ms, 1,
                                                                   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                        goto error;
                }
 
                if (switch_core_codec_init(&endpoint->write_codec,
-                                                                  "L16", NULL, NULL, sample_rate, codec_ms, 1, 
+                                                                  "L16", NULL, NULL, sample_rate, codec_ms, 1,
                                                                   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                        goto error;
@@ -1232,7 +1232,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                switch_core_session_set_read_codec(tech_pvt->session, &endpoint->read_codec);
                switch_core_session_set_write_codec(tech_pvt->session, &endpoint->write_codec);
 
-               /* try to acquire the stream */ 
+               /* try to acquire the stream */
                if (take_stream_channel(endpoint->in_stream, endpoint->inchan, 1)) {
                        retcause = SWITCH_CAUSE_USER_BUSY;
                        goto error;
@@ -1452,7 +1452,7 @@ static switch_status_t load_streams(switch_xml_t streams)
                        if (!strcmp(var, "indev")) {
                                devval = check_device(val, 1);
                                if (devval < 0) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                        "Invalid indev specified for stream '%s'\n", stream_name);
                                        stream->indev = -1;
                                        continue;
@@ -1461,7 +1461,7 @@ static switch_status_t load_streams(switch_xml_t streams)
                        } else if (!strcmp(var, "outdev")) {
                                devval = check_device(val, 0);
                                if (devval < 0) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                        "Invalid outdev specified for stream '%s'\n", stream_name);
                                        stream->outdev = -1;
                                        continue;
@@ -1470,7 +1470,7 @@ static switch_status_t load_streams(switch_xml_t streams)
                        } else if (!strcmp(var, "sample-rate")) {
                                stream->sample_rate = atoi(val);
                                if (stream->sample_rate < MIN_STREAM_SAMPLE_RATE) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                        "Invalid sample rate specified for stream '%s', forcing to 8000\n", stream_name);
                                        stream->sample_rate = MIN_STREAM_SAMPLE_RATE;
                                }
@@ -1485,18 +1485,18 @@ static switch_status_t load_streams(switch_xml_t streams)
                        } else if (!strcmp(var, "channels")) {
                                stream->channels = atoi(val);
                                if (stream->channels < 1 || stream->channels > MAX_IO_CHANNELS) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                        "Invalid number of channels specified for stream '%s', forcing to 1\n", stream_name);
                                        stream->channels = 1;
                                }
                        }
                }
                if (stream->indev < 0 && stream->outdev < 0) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                        "You need at least one device for stream '%s'\n", stream_name);
                        continue;
                }
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
                                "Created stream '%s', sample-rate = %d, codec-ms = %d\n", stream->name, stream->sample_rate, stream->codec_ms);
                switch_core_hash_insert(globals.sh_streams, stream->name, stream);
        }
@@ -1553,7 +1553,7 @@ static shared_audio_stream_t *check_stream(char *streamstr, int check_input, int
        if (!check_input && stream->outdev < 0) {
                return NULL;
        }
-       
+
        *chanindex = cnum;
 
        return stream;
@@ -1597,7 +1597,7 @@ static switch_status_t load_endpoints(switch_xml_t endpoints)
                                stream = check_stream(val, 1, &endpoint->inchan) ;
                                if (!stream) {
                                        endpoint->in_stream = NULL;
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                        "Invalid instream specified for endpoint '%s'\n", endpoint_name);
                                        continue;
                                }
@@ -1605,7 +1605,7 @@ static switch_status_t load_endpoints(switch_xml_t endpoints)
                        } else if (!strcmp(var, "outstream")) {
                                stream = check_stream(val, 0, &endpoint->outchan);
                                if (!stream) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                        "Invalid outstream specified for endpoint '%s'\n", endpoint_name);
                                        endpoint->out_stream = NULL;
                                        continue;
@@ -1614,18 +1614,18 @@ static switch_status_t load_endpoints(switch_xml_t endpoints)
                        }
                }
                if (!endpoint->in_stream && !endpoint->out_stream) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                        "You need at least one stream for endpoint '%s'\n", endpoint_name);
                        continue;
                }
                if (check_stream_compat(endpoint->in_stream, endpoint->out_stream)) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                        "Incompatible input and output streams for endpoint '%s'\n", endpoint_name);
                        continue;
                }
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, 
-                               "Created endpoint '%s', instream = %s, outstream = %s\n", endpoint->name, 
-                               endpoint->in_stream ? endpoint->in_stream->name : "(none)", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
+                               "Created endpoint '%s', instream = %s, outstream = %s\n", endpoint->name,
+                               endpoint->in_stream ? endpoint->in_stream->name : "(none)",
                                endpoint->out_stream ? endpoint->out_stream->name : "(none)");
                switch_core_hash_insert(globals.endpoints, endpoint->name, endpoint);
        }
@@ -1823,7 +1823,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown)
        switch_event_free_subclass(MY_EVENT_ERROR_AUDIO_DEV);
        switch_event_free_subclass(MY_EVENT_CALL_HELD);
        switch_event_free_subclass(MY_EVENT_CALL_RESUMED);
-       
+
 
        switch_safe_free(globals.dialplan);
        switch_safe_free(globals.context);
@@ -1992,7 +1992,7 @@ static switch_status_t play_dev(switch_stream_handle_t *stream, int outdev, char
                if (globals.destroying_streams ||  ! audio_stream->stream) {
                        break;
                }
-               
+
                WriteAudioStream(audio_stream->stream, abuf, (long) olen, 0, &(audio_stream->write_timer));
                wrote += (int) olen;
                if (samples) {
@@ -2275,7 +2275,7 @@ static switch_status_t create_codecs(int restart)
                        switch_core_codec_destroy(&globals.write_codec);
                        switch_core_timer_destroy(&globals.read_timer);
                        switch_core_timer_destroy(&globals.readfile_timer);
-                       
+
                        return SWITCH_STATUS_FALSE;
                }
        }
@@ -2315,11 +2315,11 @@ PaError open_shared_audio_stream(shared_audio_stream_t *shstream, const PaStream
 {
        PaError err;
        if (inputParameters->device != -1) {
-               err = OpenAudioStream(&shstream->stream, inputParameters->device != -1 ? inputParameters : NULL, 
-                                                       outputParameters->device != -1 ? outputParameters : NULL, shstream->sample_rate, 
+               err = OpenAudioStream(&shstream->stream, inputParameters->device != -1 ? inputParameters : NULL,
+                                                       outputParameters->device != -1 ? outputParameters : NULL, shstream->sample_rate,
                                paClipOff, STREAM_SAMPLES_PER_PACKET(shstream), globals.dual_streams);
        } else {
-               err = OpenAudioStream(&shstream->stream, NULL, outputParameters, shstream->sample_rate, 
+               err = OpenAudioStream(&shstream->stream, NULL, outputParameters, shstream->sample_rate,
                                paClipOff, STREAM_SAMPLES_PER_PACKET(shstream), 0);
        }
        if (err != paNoError) {
@@ -2348,11 +2348,11 @@ static int create_shared_audio_stream(shared_audio_stream_t *shstream)
                outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
                outputParameters.hostApiSpecificStreamInfo = NULL;
        }
-       
+
        err = open_shared_audio_stream(shstream, &inputParameters, &outputParameters);
        if (err != paNoError) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-                                               "Error opening audio device retrying (indev = %d, outdev = %d, error = %s)\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+                                               "Error opening audio device retrying (indev = %d, outdev = %d, error = %s)\n",
                                                inputParameters.device, outputParameters.device, Pa_GetErrorText(err));
                switch_yield(1000000);
                err = open_shared_audio_stream(shstream, &inputParameters, &outputParameters);
@@ -2367,7 +2367,7 @@ static int create_shared_audio_stream(shared_audio_stream_t *shstream)
                }
                return -1;
        }
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created shared audio stream %s: %d channels %d\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created shared audio stream %s: %d channels %d\n",
                        shstream->name, shstream->sample_rate, shstream->channels);
        return 0;
 }
@@ -2422,7 +2422,7 @@ static audio_stream_t *create_audio_stream(int indev, int outdev)
                outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
                outputParameters.hostApiSpecificStreamInfo = NULL;
        }
-       
+
        err = open_audio_stream(&(stream->stream), &inputParameters, &outputParameters);
        if (err != paNoError) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening audio device retrying\n");
@@ -2518,7 +2518,7 @@ static switch_status_t list_endpoints(char **argv, int argc, switch_stream_handl
                switch_core_hash_this(hi, &var, NULL, &val);
                e = val;
                stream->write_function(stream, "%s> instream: %s, outstream: %s\n",
-                               e->name, e->in_stream ? e->in_stream->name : "(none)", 
+                               e->name, e->in_stream ? e->in_stream->name : "(none)",
                                e->out_stream ? e->out_stream->name : "(none)");
                cnt++;
        }
@@ -3200,9 +3200,9 @@ SWITCH_STANDARD_API(pa_cmd)
        } else if (argv[1] && !strcmp(argv[0], "outdev")) {
                func = set_outdev;
        } else if (argv[1] && argv[2] && !strcmp(argv[0], "preparestream")) {
-               func = prepare_stream;  
+               func = prepare_stream;
        } else if (argv[1] && argv[2] && !strcmp(argv[0], "switchstream")) {
-               func = switch_stream;   
+               func = switch_stream;
        } else if (argv[1] && !strcmp(argv[0], "ringdev")) {
                func = set_ringdev;
        } else if ((argv[1] && !strcmp(argv[0], "play"))) {
index f48a7e06c99c5d382d78639af8d413f02e8ca6d2..00e5f3a982e9efc461c173537f6957fac7aba012 100644 (file)
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
index ae026c02dd6b8c5871d8ab0b65e444e36e61792b..05e0602529777d5a345e5b8e267ac669c8153fe6 100644 (file)
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
index cb7ae53ab364ea6cb88cec6c284524b96cb614f8..fc4a2b9b40222ddd4e210b6ff13d1f3209a71844 100644 (file)
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -72,7 +72,7 @@ static PaError PABLIO_TermFIFO(PaUtilRingBuffer * rbuf);
 /************************************************************************/
 
 /* Called from PortAudio.
- * Read and write data 
+ * Read and write data
  */
 static int iblockingIOCallback(const void *inputBuffer, void *outputBuffer,
                                                           unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
index 2202d849ec55dea775b423ce85de18ca7026380d..c40aac7a1698eb669c9d8af8da98c54a52cc4055 100644 (file)
@@ -38,13 +38,13 @@ extern "C" {
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
index 7d1bb028e493c6d117f99675b8b0350a077a3ca7..e9e5b19bc424ab8e862903b8a3a7e41972f695b2 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -124,8 +124,8 @@ static void tech_init(private_t *tech_pvt, switch_core_session_t *session)
        tech_pvt->session = session;
 }
 
-/* 
-   State methods they get called when the state changes to the specific state 
+/*
+   State methods they get called when the state changes to the specific state
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
 */
index 2ef2bac87f8041717d412206b77c61dc09d79bba..bda5f33f3e4bb53bdabcf5235051d683c04b7fea 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -61,7 +61,7 @@ typedef struct {
        switch_core_session_t *session;
        switch_caller_profile_t *caller_profile;
        switch_media_handle_t *media_handle;
-       switch_core_media_params_t mparams; 
+       switch_core_media_params_t mparams;
 } private_object_t;
 
 static struct {
@@ -74,8 +74,8 @@ static struct {
 /* BODY OF THE MODULE */
 /*************************************************************************************************************************************************************/
 
-/* 
-   State methods they get called when the state changes to the specific state 
+/*
+   State methods they get called when the state changes to the specific state
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
 */
@@ -131,7 +131,7 @@ switch_status_t rtc_on_destroy(switch_core_session_t *session)
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RTC DESTROY\n", switch_channel_get_name(channel));
        switch_media_handle_destroy(session);
-       
+
        return SWITCH_STATUS_SUCCESS;
 
 }
@@ -247,7 +247,7 @@ static switch_status_t rtc_receive_message(switch_core_session_t *session, switc
        case SWITCH_MESSAGE_INDICATE_ANSWER:
        case SWITCH_MESSAGE_INDICATE_PROGRESS:
                {
-                       
+
                        if (((var = switch_channel_get_variable(channel, "rtp_secure_media"))) &&
                                (switch_true(var) || switch_core_media_crypto_str2type(var) != CRYPTO_INVALID)) {
                                switch_channel_set_flag(tech_pvt->channel, CF_SECURE);
@@ -324,7 +324,7 @@ void rtc_attach_private(switch_core_session_t *session, private_object_t *tech_p
 
        switch_assert(session != NULL);
        switch_assert(tech_pvt != NULL);
-       
+
        switch_core_session_add_stream(session, NULL);
 
        tech_pvt->session = session;
@@ -362,7 +362,7 @@ static switch_call_cause_t rtc_outgoing_channel(switch_core_session_t *session,
        *new_session = NULL;
 
 
-       if (!(nsession = switch_core_session_request_uuid(rtc_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, 
+       if (!(nsession = switch_core_session_request_uuid(rtc_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND,
                                                                                                          flags, pool, switch_event_get_header(var_event, "origination_uuid")))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
                goto error;
@@ -384,7 +384,7 @@ static switch_call_cause_t rtc_outgoing_channel(switch_core_session_t *session,
        if ((hval = switch_event_get_header(var_event, "rtc_secure_media"))) {
                switch_channel_set_variable(nchannel, "rtc_secure_media", hval);
        }
-       
+
        rtc_attach_private(nsession, tech_pvt, NULL);
 
 
@@ -418,11 +418,11 @@ static switch_call_cause_t rtc_outgoing_channel(switch_core_session_t *session,
        return cause;
 }
 
-static int rtc_recover_callback(switch_core_session_t *session) 
+static int rtc_recover_callback(switch_core_session_t *session)
 {
        private_object_t *tech_pvt = rtc_new_pvt(session);
        rtc_attach_private(session, tech_pvt, NULL);
-       
+
        return 1;
 }
 
index 887cfec26ce63dd47981edc3c4369a3f2fca347d..7e86847cb0f72ef82a78a17ae3522b7f5fb095ca 100644 (file)
@@ -41,7 +41,7 @@ static amf0_data * amf0_list_insert_before(amf0_list * list, amf0_node * node, a
         if (new_node != NULL) {
             new_node->next = node;
             new_node->prev = node->prev;
-           
+
             if (node->prev != NULL) {
                 node->prev->next = new_node;
             }
@@ -317,7 +317,7 @@ static amf0_data * amf0_array_read(read_proc_t read_proc, void * user_data) {
         uint32_t array_size;
         if (read_proc(&array_size, sizeof(uint32_t), user_data) == sizeof(uint32_t)) {
             array_size = swap_uint32(array_size);
-            
+
             for (i = 0; i < array_size; ++i) {
                 element = amf0_data_read(read_proc, user_data);
 
@@ -651,7 +651,7 @@ void amf0_data_free(amf0_data * data) {
                 if (data->u.string_data.mbstr) {
                     free(data->u.string_data.mbstr);
                    data->u.string_data.mbstr = NULL;
-                } 
+                }
                break;
             case AMF0_TYPE_NULL: break;
             case AMF0_TYPE_UNDEFINED: break;
index eaea511b143d795aebec40b654a996d3c84c53e5..bedaee635fef0abbb8b90b67f32723811eb733f8 100644 (file)
@@ -144,7 +144,7 @@ static void insertElement(
 static void rehash(Hash *pH, int new_size){
   struct _ht *new_ht;          /* The new hash table */
   HashElem *elem, *next_elem;  /* For looping over existing elements */
-  
+
   assert( (new_size & (new_size-1))==0 );
   new_ht = (struct _ht *)pH->xMalloc( new_size*sizeof(struct _ht) );
   if( new_ht==0 ) return;
@@ -170,7 +170,7 @@ static HashElem *findElementGivenHash(
 ){
   HashElem *elem;            /* Used to loop thru the element list */
   int count;                     /* Number of elements left to test */
-  
+
   if( pH->ht ){
     struct _ht *pEntry = &pH->ht[h];
     elem = pEntry->chain;
@@ -262,7 +262,7 @@ void * HashInsert(
   int h;                    /* the hash of the key modulo hash table size */
   HashElem *elem;       /* Used to loop thru the element list */
   HashElem *new_elem;   /* New element added to the pH */
-  
+
   assert( pH!=0 );
   hraw = binHash(pKey, nKey);
   assert( (pH->htsize & (pH->htsize-1))==0 );
index 715e13dc9588049e02fce3af9f3d0d6f55be12aa..76d4ea563d74c0c997c7160f6b90c2af4f7e0fea 100644 (file)
@@ -2017,7 +2017,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rtmp_load)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_ATTACH);
                return SWITCH_STATUS_TERM;
        }
-       
+
        memset(&rtmp_globals, 0, sizeof(rtmp_globals));
 
        switch_mutex_init(&rtmp_globals.mutex, SWITCH_MUTEX_NESTED, pool);
@@ -2118,7 +2118,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rtmp_shutdown)
        switch_event_free_subclass(RTMP_EVENT_LOGOUT);
        switch_event_free_subclass(RTMP_EVENT_DETACH);
        switch_event_free_subclass(RTMP_EVENT_ATTACH);
-       
+
        switch_mutex_lock(rtmp_globals.mutex);
        while ((hi = switch_core_hash_first_iter(rtmp_globals.profile_hash, hi))) {
                void *val;
index c319fc7881f1017bcea1c3ef481e1cf60435d5bb..42b29fe4c172f243400514d527ad195ea2afb61e 100644 (file)
@@ -279,7 +279,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_publish)
        amf0_object_add(object, "description", amf0_str("description"));
        amf0_object_add(object, "details", amf0_str("details"));
        amf0_object_add(object, "clientid", amf0_number_new(217834719));
-       
+
        rtmp_send_invoke_free(rsession, RTMP_DEFAULT_STREAM_NOTIFY, 0, state->stream_id,
                amf0_str("onStatus"),
                amf0_number_new(0),
index abc81a43cb7a04bdbe3dbdef5462e48ece0e5b93..c119b7cc3321b025f30995cd472040a94f2e87a8 100644 (file)
@@ -25,6 +25,6 @@
        You can place files in the skinny-patterns directory to get included.
     -->
     <X-PRE-PROCESS cmd="include" data="skinny-patterns/*.xml"/>
-    
+
   </context>
 </include>
index 9239f9ea190f4ad7c55a64521fe256cf657e8ce7..7d7e6a4b2ff2951954df0da91b069a5a79e8577a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
@@ -112,7 +112,7 @@ char *skinny_format_message(const char *str)
 
        /* Look for \200, if found, next character indicates string id */
        char match = (char) 128;
-       
+
        tmp = switch_mprintf("");
 
        if (zstr(str)) {
@@ -343,7 +343,7 @@ switch_core_session_t * skinny_profile_find_session(skinny_profile_t *profile, l
                result = switch_core_session_locate(uuid);
 #endif
                if(!result) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
                                        "Unable to find session %s on %s:%d, line %d\n",
                                        uuid, listener->device_name, listener->device_instance, *line_instance_p);
                }
@@ -359,7 +359,7 @@ switch_cache_db_handle_t *skinny_get_db_handle(skinny_profile_t *profile)
 {
        switch_cache_db_handle_t *dbh = NULL;
        char *dsn;
-       
+
        if (!zstr(profile->odbc_dsn)) {
                dsn = profile->odbc_dsn;
        } else {
@@ -369,7 +369,7 @@ switch_cache_db_handle_t *skinny_get_db_handle(skinny_profile_t *profile)
        if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) {
                dbh = NULL;
        }
-       
+
        return dbh;
 
 }
@@ -454,7 +454,7 @@ void skinny_line_perform_set_state(const char *file, const char *func, int line,
        skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
                        "Line %d, Call %d Change State to %s (%d)\n",
                        line_instance, call_id,
-                       skinny_call_state2str(call_state), call_state); 
+                       skinny_call_state2str(call_state), call_state);
 }
 
 
@@ -534,7 +534,7 @@ uint32_t skinny_line_count_active(listener_t *listener)
                        "SELECT call_state FROM skinny_active_lines "
                        "WHERE device_name='%q' AND device_instance=%d "
                        "AND call_state not in (%d,%d,%d)",
-                       listener->device_name, listener->device_instance, 
+                       listener->device_name, listener->device_instance,
                        SKINNY_ON_HOOK, SKINNY_IN_USE_REMOTELY, SKINNY_HOLD
                        ))) {
 
@@ -564,7 +564,7 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
                                tech_pvt->codec_ms != (uint32_t)tech_pvt->read_impl.microseconds_per_packet / 1000) {
 
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Changing Codec from %s@%dms to %s@%dms\n",
-                                       tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000, 
+                                       tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000,
                                        tech_pvt->rm_encoding, tech_pvt->codec_ms);
 
                        switch_core_session_lock_codec_write(tech_pvt->session);
@@ -616,14 +616,14 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
        if (switch_rtp_ready(tech_pvt->rtp_session)) {
                switch_assert(tech_pvt->read_codec.implementation);
 
-               if (switch_rtp_change_interval(tech_pvt->rtp_session, 
+               if (switch_rtp_change_interval(tech_pvt->rtp_session,
                                        tech_pvt->read_impl.microseconds_per_packet,
                                        tech_pvt->read_impl.samples_per_packet
                                        ) != SWITCH_STATUS_SUCCESS) {
                        switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
 
                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-                       switch_goto_status(SWITCH_STATUS_FALSE, end);                           
+                       switch_goto_status(SWITCH_STATUS_FALSE, end);
                }
        }
 
@@ -683,8 +683,8 @@ void tech_init(private_t *tech_pvt, skinny_profile_t *profile, switch_core_sessi
        tech_pvt->session = session;
 }
 
-/* 
-   State methods they get called when the state changes to the specific state 
+/*
+   State methods they get called when the state changes to the specific state
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
  */
@@ -730,7 +730,7 @@ int channel_on_routing_callback(void *pArg, int argc, char **argv, char **column
 
        skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener);
        if(listener) {
-               if(!strcmp(device_name, helper->listener->device_name) 
+               if(!strcmp(device_name, helper->listener->device_name)
                                && (device_instance == helper->listener->device_instance)
                                && (line_instance == helper->line_instance)) {/* the calling line */
                        helper->tech_pvt->caller_profile->dialplan = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->dialplan);
@@ -859,7 +859,7 @@ int channel_on_execute_callback(void *pArg, int argc, char **argv, char **column
 
        skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener);
        if(listener) {
-               if(!strcmp(device_name, helper->listener->device_name) 
+               if(!strcmp(device_name, helper->listener->device_name)
                                && (device_instance == helper->listener->device_instance)
                                && (line_instance == helper->line_instance)) {/* the calling line */
                        helper->tech_pvt->caller_profile->dialplan = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->dialplan);
@@ -1030,8 +1030,8 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
        if(listener) {
                if((call_state == SKINNY_PROCEED) || (call_state == SKINNY_CONNECTED)) { /* calling parties */
                        send_stop_tone(listener, line_instance, call_id);
-                       send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF); 
-                       send_clear_prompt_status(listener, line_instance, call_id); 
+                       send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF);
+                       send_clear_prompt_status(listener, line_instance, call_id);
                }
                send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF);
 
@@ -1065,8 +1065,8 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
                send_define_current_time_date(listener);
                listener->digit_timeout_time = 0;
 
-               skinny_log_ls(listener, helper->tech_pvt->session, SWITCH_LOG_DEBUG, 
-                       "channel_on_hangup_callback - cause=%s [%d], call_state = %s [%d]\n", 
+               skinny_log_ls(listener, helper->tech_pvt->session, SWITCH_LOG_DEBUG,
+                       "channel_on_hangup_callback - cause=%s [%d], call_state = %s [%d]\n",
                        switch_channel_cause2str(helper->cause), helper->cause,
                        skinny_call_state2str(call_state), call_state);
 
@@ -1099,7 +1099,7 @@ switch_status_t channel_on_hangup(switch_core_session_t *session)
 
        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
 
-       skinny_log_s(session, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP [%s]\n", 
+       skinny_log_s(session, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP [%s]\n",
                switch_channel_get_name(channel), switch_channel_cause2str(cause));
 
        helper.tech_pvt= tech_pvt;
@@ -1631,7 +1631,7 @@ void skinny_clean_device_from_db(listener_t *listener, char *device_name)
                skinny_profile_t *profile = listener->profile;
                char *sql;
 
-               skinny_log_l(listener, SWITCH_LOG_DEBUG, 
+               skinny_log_l(listener, SWITCH_LOG_DEBUG,
                        "Clean device from DB with name '%s'\n",
                        device_name);
 
@@ -1668,7 +1668,7 @@ void skinny_clean_device_from_db(listener_t *listener, char *device_name)
                }
 
        } else {
-               skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, 
+               skinny_log_l_msg(listener, SWITCH_LOG_DEBUG,
                        "Clean device from DB, missing device name.\n");
        }
 }
@@ -1679,7 +1679,7 @@ void skinny_clean_listener_from_db(listener_t *listener)
                skinny_profile_t *profile = listener->profile;
                char *sql;
 
-               skinny_log_l(listener, SWITCH_LOG_DEBUG, 
+               skinny_log_l(listener, SWITCH_LOG_DEBUG,
                        "Clean listener from DB with name '%s' and instance '%d'\n",
                        listener->device_name, listener->device_instance);
 
@@ -1716,7 +1716,7 @@ void skinny_clean_listener_from_db(listener_t *listener)
                }
 
        } else {
-               skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, 
+               skinny_log_l_msg(listener, SWITCH_LOG_DEBUG,
                        "Clean listener from DB, missing device name.\n");
        }
 }
@@ -1930,7 +1930,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
                                                switch_event_fire(&event);
                                        }
                                        break;
-                               default: 
+                               default:
                                        skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Communication Error\n");
                        }
                        switch_safe_free(request);
@@ -2436,9 +2436,9 @@ static switch_status_t load_skinny_config(void)
                                switch_snprintf(dbname, sizeof(dbname), "skinny_%s", profile->name);
                                profile->dbname = switch_core_strdup(profile->pool, dbname);
 
-                               
-                               
-                               
+
+
+
                                if ((dbh = skinny_get_db_handle(profile))) {
                                        switch_cache_db_test_reactive(dbh, "select count(*) from skinny_devices", NULL, devices_sql);
                                        switch_cache_db_test_reactive(dbh, "select count(*) from skinny_lines", NULL, lines_sql);
@@ -2446,7 +2446,7 @@ static switch_status_t load_skinny_config(void)
                                        switch_cache_db_test_reactive(dbh, "select count(*) from skinny_active_lines", NULL, active_lines_sql);
                                        switch_cache_db_release_db_handle(&dbh);
                                }
-                                       
+
                                skinny_profile_respawn(profile, 0);
 
                                /* Register profile */
index b5aed9e42c1513b14f2d963fd00e2c380921e68a..69096ab64ef857d33226257dfef4bcdffb9a581a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
@@ -140,15 +140,15 @@ struct skinny_profile {
        char *dbname;
        char *odbc_dsn;
        switch_odbc_handle_t *master_odbc;
-       switch_mutex_t *sql_mutex;      
+       switch_mutex_t *sql_mutex;
        /* stats */
        uint32_t ib_calls;
        uint32_t ob_calls;
        uint32_t ib_failed_calls;
-       uint32_t ob_failed_calls;       
+       uint32_t ob_failed_calls;
        /* listener */
        int listener_threads;
-       switch_mutex_t *listener_mutex; 
+       switch_mutex_t *listener_mutex;
        switch_socket_t *sock;
        switch_mutex_t *sock_mutex;
        struct listener *listeners;
@@ -266,7 +266,7 @@ struct private_object {
        uint32_t transfer_from_call_id;
 
        /* codec */
-       char *iananame; 
+       char *iananame;
        switch_codec_t read_codec;
        switch_codec_t write_codec;
        switch_codec_implementation_t read_impl;
index 98ee68c8e9f8baf4b66256805e38dd4f7dea0f7f..f79f36c0149eeaaae1249f8eeb6cf9c34e144d57 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
@@ -397,7 +397,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_forward_stat_message(c
                skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
                if(listener) {
 
-                       send_forward_stat(listener, number); 
+                       send_forward_stat(listener, number);
 
                        stream->write_function(stream, "+OK\n");
                } else {
@@ -419,7 +419,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_display_prompt_status_
                skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
                if(listener) {
 
-                       send_display_prompt_status(listener, 0, display, 0, 0); 
+                       send_display_prompt_status(listener, 0, display, 0, 0);
 
                        stream->write_function(stream, "+OK\n");
                } else {
index a2381d8d0ced766ad663c806d0b1a4c0e11f3dac..e246957f0d97cf51a2f0c1f116537ff8eeed897a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
index c73c9069ee6ad95009a6425159e83607589959c8..e345f0093019ce3ae3323d303f075f0cd2c50347 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
@@ -556,7 +556,7 @@ switch_status_t perform_send_start_tone(listener_t *listener,
        message->data.start_tone.call_id = call_id;
 
        skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
-               "Sending Start Tone with Tone (%s), Line Instance (%d), Call ID (%d)\n", 
+               "Sending Start Tone with Tone (%s), Line Instance (%d), Call ID (%d)\n",
                skinny_tone2str(tone), line_instance, call_id);
 
        return skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
@@ -610,7 +610,7 @@ switch_status_t perform_send_forward_stat(listener_t *listener,
        skinny_message_t *message;
 
        skinny_create_message(message, FORWARD_STAT_MESSAGE, forward_stat);
-       
+
        if ( number && number[0] )
        {
                message->data.forward_stat.active_forward = 1;
@@ -672,7 +672,7 @@ switch_status_t perform_send_set_speaker_mode(listener_t *listener,
        return skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
 }
 
-switch_status_t perform_send_srvreq_response(listener_t *listener, 
+switch_status_t perform_send_srvreq_response(listener_t *listener,
                const char *file, const char *func, int line,
                char *ip, uint32_t port)
 {
@@ -720,7 +720,7 @@ switch_status_t perform_send_start_media_transmission(listener_t *listener,
        /* ... */
 
        skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
-               "Send Start Media Transmission with Conf ID(%d), Passthrough Party ID (%d), ...\n", 
+               "Send Start Media Transmission with Conf ID(%d), Passthrough Party ID (%d), ...\n",
                conference_id, pass_thru_party_id);
 
        return skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
@@ -742,7 +742,7 @@ switch_status_t perform_send_stop_media_transmission(listener_t *listener,
        /* ... */
 
        skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
-               "Send Stop Media Transmission with Conf ID (%d), Passthrough Party ID (%d), Conf ID2 (%d)\n", 
+               "Send Stop Media Transmission with Conf ID (%d), Passthrough Party ID (%d), Conf ID2 (%d)\n",
                conference_id, pass_thru_party_id, conference_id2);
 
        return skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
@@ -832,7 +832,7 @@ switch_status_t perform_send_define_time_date(listener_t *listener,
 
        if ( listener->profile->debug >= 9 ) {
                skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
-                       "Send Define Time Date with %.4d-%.2d-%.2d %.2d:%.2d:%.2d.%d, Timestamp (%d), DOW (%d)\n", 
+                       "Send Define Time Date with %.4d-%.2d-%.2d %.2d:%.2d:%.2d.%d, Timestamp (%d), DOW (%d)\n",
                        year, month, day, hour, minute, seconds, milliseconds, timestamp, day_of_week);
        }
 
@@ -1036,7 +1036,7 @@ switch_status_t perform_send_display_prompt_status(listener_t *listener,
        tmp = skinny_format_message(display);
 
        skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
-               "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n", 
+               "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n",
                timeout, tmp, line_instance, call_id);
 
        switch_safe_free(tmp);
@@ -1066,7 +1066,7 @@ switch_status_t perform_send_display_prompt_status_textid(listener_t *listener,
        message->data.display_prompt_status.call_id = call_id;
 
        skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
-               "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n", 
+               "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n",
                timeout, skinny_textid2str(display_textid), line_instance, call_id);
 
        return skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
@@ -1166,7 +1166,7 @@ switch_status_t perform_send_display_pri_notify(listener_t *listener,
        tmp = skinny_format_message(notify);
 
        skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
-               "Send Display Pri Notify with Timeout (%d), Priority (%d), Message (%s)\n", 
+               "Send Display Pri Notify with Timeout (%d), Priority (%d), Message (%s)\n",
                message_timeout, priority, tmp);
 
        switch_safe_free(tmp);
@@ -1175,7 +1175,7 @@ switch_status_t perform_send_display_pri_notify(listener_t *listener,
 }
 
 
-switch_status_t perform_send_reset(listener_t *listener, 
+switch_status_t perform_send_reset(listener_t *listener,
                const char *file, const char *func, int line,
                uint32_t reset_type)
 {
@@ -1227,7 +1227,7 @@ switch_status_t perform_send_data(listener_t *listener,
        return skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
 }
 
-switch_status_t perform_send_extended_data(listener_t *listener, 
+switch_status_t perform_send_extended_data(listener_t *listener,
                const char *file, const char *func, int line,
                uint32_t message_type,
                uint32_t application_id,
@@ -1268,7 +1268,7 @@ switch_status_t perform_send_extended_data(listener_t *listener,
        switch_copy_string(message->data.extended_data.data, data, data_length);
 
        skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
-               "Send Extended Data with Application ID (%d), Line Instance (%d), Call ID (%d), ...\n", 
+               "Send Extended Data with Application ID (%d), Line Instance (%d), Call ID (%d), ...\n",
                application_id, line_instance, call_id );
 
        return skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
@@ -1314,7 +1314,7 @@ switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file
        ptr = (char *) reply;
 
        if (listener_is_ready(listener)) {
-               if (listener->profile->debug >= 10 || 
+               if (listener->profile->debug >= 10 ||
                        (listener->profile->debug >= 9 && reply->type != KEEP_ALIVE_ACK_MESSAGE)) {
                        skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
                                        "Sending %s (type=%x,length=%d).\n",
index a0c5ad62609fee8a7301a8e1f9189b8db529fb72..0ae1772521a6051fb86179978b16d78b866cdf5a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
@@ -314,7 +314,7 @@ typedef struct {
        uint32_t serviceNumber;                                                 /*!< Service Number */
 } levelPreference_t;                                                            /*!< Level Preference Structure */
 
-/*! 
+/*!
  * \brief Layout Config Structure (Update Capabilities Message Struct)
  * \since 20080111
  */
@@ -344,7 +344,7 @@ typedef struct {
        skinny_codecs payload_capability;                                   /*!< PayLoad Capability */
        uint32_t maxFramesPerPacket;                                        /*!< Maximum Number of Frames per IP Packet */
        uint32_t unknown[2];                                                /*!< this are related to G.723 */
-} audioCap_t;  
+} audioCap_t;
 
 /*!
  * \brief Video Capabilities Structure
@@ -418,7 +418,7 @@ struct PACKED update_capabilities_message {
        dataCap_t dataCaps[SKINNY_MAX_DATA_CAPABILITIES];               /*!< Data Capabilities */
 
        uint32_t unknown;                                               /*!< Unknown */
-}; 
+};
 
 
 /* ServiceUrlStatReqMessage */
index e0ec67e1801b79bbd96b253d30f39f6b5be2b872..86b4730786c783c840d4e234ba58b993ff4b3b45 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
@@ -136,7 +136,7 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l
 
        channel = switch_core_session_get_channel(nsession);
 
-       snprintf(name, sizeof(name), "SKINNY/%s/%s:%d/%d", listener->profile->name, 
+       snprintf(name, sizeof(name), "SKINNY/%s/%s:%d/%d", listener->profile->name,
                        listener->device_name, listener->device_instance, *line_instance_p);
        switch_channel_set_name(channel, name);
 
@@ -187,7 +187,7 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l
        if (switch_channel_get_state(channel) == CS_NEW) {
                switch_channel_set_state(channel, CS_HIBERNATE);
        } else {
-               skinny_log_ls_msg(listener, nsession, SWITCH_LOG_CRIT, 
+               skinny_log_ls_msg(listener, nsession, SWITCH_LOG_CRIT,
                        "Wow! this channel should be in CS_NEW state, but it is not!\n");
        }
 
@@ -269,7 +269,7 @@ found:
                                action = SKINNY_ACTION_WAIT;
                                *data = switch_core_session_strdup(session, current_application->application_data);
                        } else {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                                                "Unknown skinny dialplan application %s\n", current_application->application_name);
                        }
                }
@@ -293,7 +293,7 @@ switch_status_t skinny_session_process_dest(switch_core_session_t *session, list
        // get listener profile setting for ringdown/autodial
        // if initial offhook - and we have a ringdown/autodial configured, just dial it in one shot
        if (!dest && append_dest == '\0' && listener->ext_autodial ) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                        "triggering auto dial to (%s)\n", listener->ext_autodial);
 
                tech_pvt->caller_profile->destination_number = switch_core_strdup(tech_pvt->caller_profile->pool, listener->ext_autodial);
@@ -430,7 +430,7 @@ int skinny_session_send_call_info_all_callback(void *pArg, int argc, char **argv
        struct skinny_session_send_call_info_all_helper *helper = pArg;
        listener_t *listener = NULL;
 
-       skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, 
+       skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile,
                        device_name, device_instance, &listener);
        if(listener) {
                skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance);
@@ -502,38 +502,38 @@ int skinny_session_set_variables_callback(void *pArg, int argc, char **argv, cha
        listener = helper->listener;
 
        if ( ! listener ) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG,
                        "no defined listener on channel var setup, will not attempt to set variables\n");
                return(0);
        }
 
        /* Process through and extract any variables from the user and set in the channel */
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, 
-                       "searching for user (id=%s) in profile %s in channel var setup\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG,
+                       "searching for user (id=%s) in profile %s in channel var setup\n",
                        listener->device_name, listener->profile->domain);
 
-       if (switch_xml_locate_user("id", listener->device_name, listener->profile->domain, "", 
+       if (switch_xml_locate_user("id", listener->device_name, listener->profile->domain, "",
                &xroot, &xdomain, &xuser, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_WARNING, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_WARNING,
                                "unable to find user (id=%s) in channel var setup\n", listener->device_name);
        }
 
        if ( xuser ) {
                char *uid = (char *) switch_xml_attr_soft(xuser, "id");
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG,
                                "found user (id=%s) in channel var setup\n", uid);
 
                if ((xvariables = switch_xml_child(xuser, "variables"))) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG,
                                "found variables section in user xml");
-                       
+
                        for (xvariable = switch_xml_child(xvariables, "variable"); xvariable; xvariable = xvariable->next) {
                                char *name = (char *) switch_xml_attr_soft(xvariable, "name");
                                char *value = (char *) switch_xml_attr_soft(xvariable, "value");
 
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG,
                                        "found variable (%s=%s) for user (%s) in channel var setup\n", name, value, listener->device_name);
 
                                switch_channel_set_variable_name_printf(helper->channel, value, "%s", name);
@@ -604,7 +604,7 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN
        listener_t *listener = NULL;
        uint32_t active_calls = 0;
 
-       skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, 
+       skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile,
                        device_name, device_instance, &listener);
        if(listener && helper->tech_pvt->session && helper->remote_session) {
                switch_channel_t *channel = switch_core_session_get_channel(helper->tech_pvt->session);
@@ -612,10 +612,10 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN
                helper->lines_count++;
                switch_channel_set_variable(channel, "effective_callee_id_number", value);
                switch_channel_set_variable(channel, "effective_callee_id_name", caller_name);
-       
+
                active_calls = skinny_line_count_active(listener);
 
-               skinny_log_l(listener, SWITCH_LOG_DEBUG, 
+               skinny_log_l(listener, SWITCH_LOG_DEBUG,
                        "Ring Lines Callback with Callee Number (%s), Caller Name (%s), Dest Number (%s), Active Calls (%d)\n",
                        value, caller_name, helper->tech_pvt->caller_profile->destination_number, active_calls);
 
@@ -627,7 +627,7 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN
                        msg.from = __FILE__;
 
                        if (switch_core_session_receive_message(helper->remote_session, &msg) != SWITCH_STATUS_SUCCESS) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_WARNING, 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_WARNING,
                                                "Unable to send SWITCH_MESSAGE_INDICATE_DISPLAY message to channel %s\n",
                                                switch_core_session_get_uuid(helper->remote_session));
                        }
@@ -742,7 +742,7 @@ int skinny_session_answer_callback(void *pArg, int argc, char **argv, char **col
 
        skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener);
        if(listener) {
-               if(!strcmp(device_name, helper->listener->device_name) 
+               if(!strcmp(device_name, helper->listener->device_name)
                                && (device_instance == helper->listener->device_instance)
                                && (line_instance == helper->line_instance)) {/* the answering line */
                        /* nothing */
@@ -941,7 +941,7 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener
                        channel2 = switch_core_session_get_channel(session2);
                        local_uuid2 = switch_channel_get_uuid(channel2);
                        remote_uuid2 = switch_channel_get_partner_uuid(channel2);
-                       skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: tx from session - local_uuid=%s remote_uuid=%s local_uuid2=%s remote_uuid2=%s\n", 
+                       skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: tx from session - local_uuid=%s remote_uuid=%s local_uuid2=%s remote_uuid2=%s\n",
                                local_uuid, remote_uuid, local_uuid2, remote_uuid2);
 
                        skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: attempting ivr bridge from (%s) to (%s)\n", remote_uuid, remote_uuid2);
@@ -1186,7 +1186,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
        }
 
        /* we clean up device above, so this below block will never trigger. I don't
-               know the full details of why there would be multiple listeners with 
+               know the full details of why there would be multiple listeners with
                the same device - maybe a VGC or similar? Not really high priority for
                support at the moment, but may need to revisit this later */
 
@@ -1511,7 +1511,7 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
                                skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle last number redial stimulus message, couldn't create incoming session.\n");
                                return SWITCH_STATUS_FALSE;
                        }
-                       skinny_session_process_dest(session, listener, line_instance, 
+                       skinny_session_process_dest(session, listener, line_instance,
                                empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0);
                        break;
                case SKINNY_BUTTON_SPEED_DIAL:
@@ -1543,7 +1543,7 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
 
                        if(session) {
                                status = skinny_session_transfer(session, listener, line_instance);
-                       }                       
+                       }
                        break;
                case SKINNY_BUTTON_VOICEMAIL:
                        skinny_create_incoming_session(listener, &line_instance, &session);
@@ -1551,7 +1551,7 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
                                skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle stimulus message, couldn't create incoming session.\n");
                                return SWITCH_STATUS_FALSE;
                        }
-                       skinny_session_process_dest(session, listener, line_instance, 
+                       skinny_session_process_dest(session, listener, line_instance,
                                empty_null2(listener->ext_voicemail, listener->profile->ext_voicemail), '\0', 0);
                        break;
 
@@ -1574,7 +1574,7 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
                                        }
 
                                        switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-                               } 
+                               }
                                else {
                                        status = skinny_session_answer(session, listener, line_instance);
                                }
@@ -1674,7 +1674,7 @@ switch_status_t skinny_handle_on_hook_message(listener_t *listener, skinny_messa
                "AND skinny_active_lines.device_instance = skinny_lines.device_instance "
                "AND skinny_active_lines.line_instance = skinny_lines.line_instance "
                "WHERE skinny_lines.device_name='%q' AND skinny_lines.device_instance=%d",
-               listener->device_name, listener->device_instance))) 
+               listener->device_name, listener->device_instance)))
        {
                skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_hangup_active_calls_callback, &helper);
                switch_safe_free(sql);
@@ -1694,7 +1694,7 @@ switch_status_t skinny_handle_forward_stat_req_message(listener_t *listener, ski
        message->data.forward_stat.line_instance = request->data.forward_stat_req.line_instance;
 
        if ( listener->profile->debug >= 9 ) {
-               skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Forward Stat Req Message with Line Instance (%d)\n", 
+               skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Forward Stat Req Message with Line Instance (%d)\n",
                        request->data.forward_stat_req.line_instance);
        }
        skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
@@ -2102,7 +2102,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
                        send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
                }
        } else {
-               skinny_log_l(listener, SWITCH_LOG_WARNING, "Unable to find session for call id=%d.\n", 
+               skinny_log_l(listener, SWITCH_LOG_WARNING, "Unable to find session for call id=%d.\n",
                                request->data.open_receive_channel_ack.pass_thru_party_id);
        }
 end:
@@ -2131,7 +2131,7 @@ switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_
        if (message) {
                skinny_send_reply_quiet(listener, message, SWITCH_FALSE);
        } else {
-               skinny_log_l(listener, SWITCH_LOG_ERROR, "Profile %s doesn't have a default <soft-key-set-set>.\n", 
+               skinny_log_l(listener, SWITCH_LOG_ERROR, "Profile %s doesn't have a default <soft-key-set-set>.\n",
                        listener->profile->name);
        }
 
@@ -2166,7 +2166,7 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
                                skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
                                return SWITCH_STATUS_FALSE;
                        }
-                       skinny_session_process_dest(session, listener, line_instance, 
+                       skinny_session_process_dest(session, listener, line_instance,
                                empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0);
                        break;
                case SOFTKEY_NEWCALL:
@@ -2235,7 +2235,7 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
                                skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
                                return SWITCH_STATUS_FALSE;
                        }
-                       skinny_session_process_dest(session, listener, line_instance, 
+                       skinny_session_process_dest(session, listener, line_instance,
                                empty_null2(listener->ext_meetme, listener->profile->ext_meetme), '\0', 0);
                        break;
                case SOFTKEY_CALLPICKUP:
@@ -2245,7 +2245,7 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
                                skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
                                return SWITCH_STATUS_FALSE;
                        }
-                       skinny_session_process_dest(session, listener, line_instance, 
+                       skinny_session_process_dest(session, listener, line_instance,
                                empty_null2(listener->ext_pickup, listener->profile->ext_pickup), '\0', 0);
                        break;
                case SOFTKEY_CFWDALL:
@@ -2254,7 +2254,7 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
                                skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
                                return SWITCH_STATUS_FALSE;
                        }
-                       skinny_session_process_dest(session, listener, line_instance, 
+                       skinny_session_process_dest(session, listener, line_instance,
                                empty_null2(listener->ext_cfwdall, listener->profile->ext_cfwdall), '\0', 0);
                        break;
                default:
@@ -2283,7 +2283,7 @@ switch_status_t skinny_handle_unregister(listener_t *listener, skinny_message_t
        message->data.unregister_ack.unregister_status = 0; /* OK */
 
        skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Unregister with Status (%d)\n", message->data.unregister_ack.unregister_status);
-       
+
        skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
 
        /* Close socket */
@@ -2316,7 +2316,7 @@ switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, sk
 
                message->data.soft_key_template.soft_key[i].soft_key_event = soft_key_template_default_events[i];
        }
-               
+
        if ( listener->profile->debug >= 9 ) {
                skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Template Request with Default Template\n");
        }
@@ -2343,7 +2343,7 @@ switch_status_t skinny_headset_status_message(listener_t *listener, skinny_messa
        }
 
        if ( listener->profile->debug >= 9 ) {
-               skinny_log_l(listener, SWITCH_LOG_DEBUG, "Update headset accessory status (%s)\n", 
+               skinny_log_l(listener, SWITCH_LOG_DEBUG, "Update headset accessory status (%s)\n",
                        skinny_accessory_state2str(request->data.headset_status.mode));
        }
 
@@ -2388,7 +2388,7 @@ switch_status_t skinny_handle_data_message(listener_t *listener, skinny_message_
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Call-Id", "%d", request->data.data.call_id);
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Transaction-Id", "%d", request->data.data.transaction_id);
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Data-Length", "%d", request->data.data.data_length);
-       
+
        tmp = malloc(request->data.data.data_length + 1);
        memcpy(tmp, request->data.data.data, request->data.data.data_length);
 
@@ -2644,7 +2644,7 @@ switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t *
 
 switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *request)
 {
-       if (listener->profile->debug >= 10 || 
+       if (listener->profile->debug >= 10 ||
                (listener->profile->debug >= 9 && request->type != KEEP_ALIVE_MESSAGE)) {
                skinny_log_l(listener, SWITCH_LOG_DEBUG, "Received %s (type=%x,length=%d).\n",
                        skinny_message_type2str(request->type), request->type, request->length);
@@ -2726,7 +2726,7 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
                case UPDATE_CAPABILITIES_MESSAGE:
                        return skinny_handle_updatecapabilities(listener, request);
                case SERVER_REQ_MESSAGE:
-                       return skinny_handle_server_req_message(listener, request);         
+                       return skinny_handle_server_req_message(listener, request);
                default:
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
                                        "Unhandled %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length);
index d39a796b12db031639066c8ada646793b0c1727f..da29b4577ec6f72fdcddb70d2883893766869e29 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
index 87d0412dfe62603e24d8083da2c9c419faf032c7..e5a1eb02a8c8bf51771d94118df2dbb59b93ea6c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
index 40abce5c711366e8f733657117cae801cf258fc3..b16f6aca73062511c0d853ad96e3f9c9c12783f9 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2010, Mathieu Parent <math.parent@gmail.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Parent <math.parent@gmail.com>
  *
  *
index 062281d6416bcf03652e0c7452a99f8d0fe979ea..f437ccce860bf60a6d3239103b4c173e74f4a47e 100644 (file)
@@ -1,11 +1,11 @@
 //gcc -Wall -ggdb client.c -o client -lX11 -lpthread
 /*
-   
-   Interactive client for the Skype API 
+
+   Interactive client for the Skype API
 
 USAGE: client [Xserver instance]
 
-# ./client :103 
+# ./client :103
 
 */
 
index bb5343aa2827c2b3c36af3853b156a3536c06a2d..ccfcc0d5676c471798d8c263f23a75cffa8a7392 100644 (file)
@@ -435,8 +435,8 @@ static switch_status_t interface_exists(char *the_interface)
 }
 
 
-/* 
-   State methods they get called when the state changes to the specific state 
+/*
+   State methods they get called when the state changes to the specific state
    returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
 */
@@ -2486,7 +2486,7 @@ private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling)
        switch_mutex_lock(globals.mutex);
 
        /* Fact is the real interface start from 1 */
-       //XXX no, is just a convention, but you can have it start from 0. I do not, for aestetic reasons :-)  
+       //XXX no, is just a convention, but you can have it start from 0. I do not, for aestetic reasons :-)
 
        for (i = 0; i < SKYPOPEN_MAX_INTERFACES; i++) {
                int interface_id;
@@ -3384,7 +3384,7 @@ struct SkypopenHandles *skypopen_list_find(struct SkypopenList *list, struct Sky
 }
 #endif
 
-// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? 
+// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
 int skypopen_list_size(struct SkypopenList *list)
 {
        return list->entries;
index af30080ce2d41170ca00ab2e1e785f82b48fb9f9..52101f171bed9d5f8cdbd25b271dcc370fe14f0a 100644 (file)
@@ -1,4 +1,4 @@
-//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90 
+//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
 #include "skypiax.h"
 
 /* LOCKS */
@@ -95,13 +95,13 @@ const struct ast_channel_tech skypiax_tech = {
 #endif /* ASTERISK_VERSION_1_4 */
 };
 
-/*! \brief fake skypiax_pvt structure values, 
+/*! \brief fake skypiax_pvt structure values,
  * just for logging purposes */
 struct skypiax_pvt skypiax_log_struct = {
        .name = "none",
 };
 
-/*! \brief Default skypiax_pvt structure values, 
+/*! \brief Default skypiax_pvt structure values,
  * used by skypiax_mkif to initialize the interfaces */
 struct skypiax_pvt skypiax_default = {
        .interface_state = SKYPIAX_STATE_DOWN,
@@ -121,14 +121,14 @@ struct skypiax_pvt skypiax_default = {
        .skypiax_dir_entry_extension_prefix = 6,
 };
 
-/*! 
+/*!
  * \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif
  */
 struct skypiax_pvt *skypiax_iflist = NULL;
 
 #ifdef ASTERISK_VERSION_1_6
 struct ast_cli_entry myclis[] = {
-/* 
+/*
  * CLI do not works since some time on 1.6, they changed the CLI mechanism
  */
 #if 0
@@ -286,7 +286,7 @@ int skypiax_indicate(struct ast_channel *c, int cond, const void *data, size_t d
        return res;
 }
 
-/*! \brief PBX interface function -build skypiax pvt structure 
+/*! \brief PBX interface function -build skypiax pvt structure
  *         skypiax calls initiated by the PBX arrive here */
 struct ast_channel *skypiax_request(const char *type, int format, void *data, int *cause)
 {
@@ -584,7 +584,7 @@ struct ast_frame *skypiax_read(struct ast_channel *c)
        return &f;
 }
 
-/*! \brief Initiate skypiax call from PBX 
+/*! \brief Initiate skypiax call from PBX
  * used from the dial() application
  */
 int skypiax_originate_call(struct ast_channel *c, char *idest, int timeout)
@@ -788,7 +788,7 @@ struct ast_channel *skypiax_new(struct skypiax_pvt *p, int state, char *context)
  * \brief Load the module into Asterisk and start its threads
  *
  * This function register the module into Asterisk,
- * create the interfaces for the channels, 
+ * create the interfaces for the channels,
  * start the auxiliary threads for the interfaces,
  * then start a monitor thread. The monitor thread
  * will signal Asterisk when an interface receive a call.
@@ -901,7 +901,7 @@ int load_module(void)
  * \brief Unload the module from Asterisk and shutdown its threads
  *
  * This function unregister the module from Asterisk,
- * destroy the interfaces for the channels, 
+ * destroy the interfaces for the channels,
  * shutdown the auxiliary threads for the interfaces,
  * then shutdown its monitor thread.
  *
@@ -1363,9 +1363,9 @@ int skypiax_restart_monitor(void)
        return 0;
 }
 
-/*! \brief The skypiax monitoring thread 
+/*! \brief The skypiax monitoring thread
  * \note   This thread monitors all the skypiax interfaces that are not in a call
- *         (and thus do not have a separate thread) indefinitely 
+ *         (and thus do not have a separate thread) indefinitely
  *         */
 void *skypiax_do_monitor(void *data)
 {
@@ -1439,7 +1439,7 @@ void *skypiax_do_monitor(void *data)
 
                /* If there are errors...  */
                if (res < 0) {
-                       if (errno == EINTR)     /* EINTR is just the select 
+                       if (errno == EINTR)     /* EINTR is just the select
                                                                   being interrupted by a SIGURG, or so */
                                continue;
                        else {
@@ -1483,10 +1483,10 @@ void *skypiax_do_monitor(void *data)
 }
 
 /*!
- * \brief Initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces) 
+ * \brief Initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces)
  * \param p the skypiax_pvt of the interface
  *
- * This function initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces). It simply pass its parameters to the right function for the sound system for which has been compiled, eg. alsa_init for ALSA, oss_init for OSS, winmm_init for Windows Multimedia, etc and return the result 
+ * This function initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces). It simply pass its parameters to the right function for the sound system for which has been compiled, eg. alsa_init for ALSA, oss_init for OSS, winmm_init for Windows Multimedia, etc and return the result
  *
  * \return zero on success, -1 on error.
  */
@@ -1497,7 +1497,7 @@ int skypiax_sound_init(struct skypiax_pvt *p)
 }
 
 /*!
- * \brief Shutdown the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces) 
+ * \brief Shutdown the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces)
  * \param p the skypiax_pvt of the interface
  *
  * This function shutdown the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces). It simply pass its parameters to the right function for the sound system for which has been compiled, eg. alsa_shutdown for ALSA, oss_shutdown for OSS, winmm_shutdown for Windows Multimedia, etc and return the result
@@ -2035,7 +2035,7 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[])
 
                                int friends_count = 0;
                                while (p->skype_friends[0] == '\0') {
-                                       /* FIXME needs a timeout, can't wait forever! 
+                                       /* FIXME needs a timeout, can't wait forever!
                                         * eg. when skype is running but not connected! */
                                        usleep(100);
                                        friends_count++;
@@ -2063,9 +2063,9 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[])
                                                         * So, we have the Skype username (the HANDLE, I think is called).
                                                         * But we want to call the names we see in the Skype contact list
                                                         * So, let's check the DISPLAYNAME (the end user modified contact name)
-                                                        * Then, we check the FULLNAME (that appears as it was the DISPLAYNAME 
+                                                        * Then, we check the FULLNAME (that appears as it was the DISPLAYNAME
                                                         * if the end user has not modify it)
-                                                        * If we still have neither DISPLAYNAME nor FULLNAME, we'll use the 
+                                                        * If we still have neither DISPLAYNAME nor FULLNAME, we'll use the
                                                         * Skipe username (the HANDLE)
                                                         */
 
@@ -2074,7 +2074,7 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[])
                                                        skypiax_signaling_write(p, msg_to_skype);
                                                        int displayname_count = 0;
                                                        while (p->skype_displayname[0] == '\0') {
-                                                               /* FIXME needs a timeout, can't wait forever! 
+                                                               /* FIXME needs a timeout, can't wait forever!
                                                                 * eg. when skype is running but not connected! */
                                                                usleep(100);
                                                                displayname_count++;
@@ -2090,9 +2090,9 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[])
                                                                where2 = strstr(p->skype_displayname, "DISPLAYNAME ");
                                                                if (where2) {
 
-                                                                       /* there can be some *smart* that makes a displayname 
+                                                                       /* there can be some *smart* that makes a displayname
                                                                         * that is different than first<space>last, */
-                                                                       /* maybe initials, simbols, slashes, 
+                                                                       /* maybe initials, simbols, slashes,
                                                                         * something smartish... let's check */
 
                                                                        if (where2[12] != '\0') {
@@ -2153,7 +2153,7 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[])
                                                        skypiax_signaling_write(p, msg_to_skype);
                                                        int fullname_count = 0;
                                                        while (p->skype_fullname[0] == '\0') {
-                                                               /* FIXME needs a timeout, can't wait forever! 
+                                                               /* FIXME needs a timeout, can't wait forever!
                                                                 * eg. when skype is running but not connected! */
                                                                usleep(100);
                                                                fullname_count++;
@@ -2167,7 +2167,7 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[])
                                                                where2 = strstr(p->skype_fullname, "FULLNAME ");
                                                                if (where2) {
 
-                                                                       /* there can be some *smart* that makes a fullname 
+                                                                       /* there can be some *smart* that makes a fullname
                                                                         * that is different than first<space>last, */
                                                                        /* maybe initials, simbols, slashes,
                                                                         *  something smartish... let's check */
index e16edc9f11854436d71b4d9cf741a2dc66b8fbd3..d960f80a0728929de86e4a9f3e15b7060ea9d4e5 100644 (file)
@@ -1,4 +1,4 @@
-//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90 
+//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
 #ifndef _SKYPIAX_H_
 #define _SKYPIAX_H_
 
@@ -194,7 +194,7 @@ void ast_unregister_atexit(void (*func) (void));    /* in asterisk.h, but some aste
 #define        SKYPIAX_FRAME_SIZE   160
 
 /* SKYPIAX INTERNAL STRUCTS */
-/*! 
+/*!
  * \brief structure for exchanging messages with the skype client
  */
 #ifdef WANT_SKYPE_X11
@@ -235,7 +235,7 @@ struct SkypiaxHandles {
 
 #endif //WIN32
 
-/*! 
+/*!
  * \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif
  */
 struct skypiax_pvt {
index 6fb88079d5065535ab7f839090b14493fa4cf6a7..3155bf05e97c6255cafe71b678719db9dba43065 100644 (file)
@@ -469,7 +469,7 @@ void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, struct snd_pcm_ops *ops
 {
        struct snd_pcm_str *stream = &pcm->streams[direction];
        struct snd_pcm_substream *substream;
-       
+
        for (substream = stream->substream; substream != NULL; substream = substream->next)
                substream->ops = ops;
 }
@@ -485,7 +485,7 @@ EXPORT_SYMBOL(snd_pcm_set_ops);
 void snd_pcm_set_sync(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
-       
+
        runtime->sync.id32[0] = substream->pcm->card->number;
        runtime->sync.id32[1] = -1;
        runtime->sync.id32[2] = -1;
@@ -498,7 +498,7 @@ EXPORT_SYMBOL(snd_pcm_set_sync);
  *  Standard ioctl routine
  */
 
-static inline unsigned int div32(unsigned int a, unsigned int b, 
+static inline unsigned int div32(unsigned int a, unsigned int b,
                                 unsigned int *r)
 {
        if (b == 0) {
@@ -757,7 +757,7 @@ void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
 /**
  * snd_interval_ratnum - refine the interval value
  * @i: interval to refine
- * @rats_count: number of ratnum_t 
+ * @rats_count: number of ratnum_t
  * @rats: ratnum_t array
  * @nump: pointer to store the resultant numerator
  * @denp: pointer to store the resultant denominator
@@ -811,7 +811,7 @@ int snd_interval_ratnum(struct snd_interval *i,
        }
        t.min = div_down(best_num, best_den);
        t.openmin = !!(best_num % best_den);
-       
+
        result_num = best_num;
        result_diff = best_diff;
        result_den = best_den;
@@ -922,7 +922,7 @@ static int snd_interval_ratden(struct snd_interval *i,
        }
        t.min = div_down(best_num, best_den);
        t.openmin = !!(best_num % best_den);
-       
+
        best_num = best_den = best_diff = 0;
        for (k = 0; k < rats_count; ++k) {
                unsigned int num;
@@ -1081,7 +1081,7 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond,
        constrs->rules_num++;
        va_end(args);
        return 0;
-}                                  
+}
 
 EXPORT_SYMBOL(snd_pcm_hw_rule_add);
 
@@ -1147,7 +1147,7 @@ EXPORT_SYMBOL(snd_pcm_hw_constraint_integer);
  * @var: hw_params variable to apply the range
  * @min: the minimal value
  * @max: the maximal value
- * 
+ *
  * Apply the min/max range constraint to an interval parameter.
  */
 int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
@@ -1169,7 +1169,7 @@ static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params,
 {
        struct snd_pcm_hw_constraint_list *list = rule->private;
        return snd_interval_list(hw_param_interval(params, rule->var), list->count, list->list, list->mask);
-}              
+}
 
 
 /**
@@ -1178,7 +1178,7 @@ static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params,
  * @cond: condition bits
  * @var: hw_params variable to apply the list constraint
  * @l: list
- * 
+ *
  * Apply the list of constraints to an interval parameter.
  */
 int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
@@ -1215,7 +1215,7 @@ static int snd_pcm_hw_rule_ratnums(struct snd_pcm_hw_params *params,
  * @var: hw_params variable to apply the ratnums constraint
  * @r: struct snd_ratnums constriants
  */
-int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, 
+int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,
                                  unsigned int cond,
                                  snd_pcm_hw_param_t var,
                                  struct snd_pcm_hw_constraint_ratnums *r)
@@ -1248,7 +1248,7 @@ static int snd_pcm_hw_rule_ratdens(struct snd_pcm_hw_params *params,
  * @var: hw_params variable to apply the ratdens constraint
  * @r: struct snd_ratdens constriants
  */
-int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, 
+int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,
                                  unsigned int cond,
                                  snd_pcm_hw_param_t var,
                                  struct snd_pcm_hw_constraint_ratdens *r)
@@ -1279,7 +1279,7 @@ static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params,
  * @width: sample bits width
  * @msbits: msbits width
  */
-int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, 
+int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,
                                 unsigned int cond,
                                 unsigned int width,
                                 unsigned int msbits)
@@ -1312,7 +1312,7 @@ int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime,
                               snd_pcm_hw_param_t var,
                               unsigned long step)
 {
-       return snd_pcm_hw_rule_add(runtime, cond, var, 
+       return snd_pcm_hw_rule_add(runtime, cond, var,
                                   snd_pcm_hw_rule_step, (void *) step,
                                   var, -1);
 }
@@ -1329,7 +1329,7 @@ static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm
        };
        return snd_interval_list(hw_param_interval(params, rule->var),
                                 ARRAY_SIZE(pow2_sizes), pow2_sizes, 0);
-}              
+}
 
 /**
  * snd_pcm_hw_constraint_pow2 - add a hw constraint power-of-2 rule
@@ -1341,7 +1341,7 @@ int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,
                               unsigned int cond,
                               snd_pcm_hw_param_t var)
 {
-       return snd_pcm_hw_rule_add(runtime, cond, var, 
+       return snd_pcm_hw_rule_add(runtime, cond, var,
                                   snd_pcm_hw_rule_pow2, NULL,
                                   var, -1);
 }
@@ -1459,8 +1459,8 @@ static int _snd_pcm_hw_param_first(struct snd_pcm_hw_params *params,
  * values > minimum. Reduce configuration space accordingly.
  * Return the minimum.
  */
-int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm, 
-                          struct snd_pcm_hw_params *params, 
+int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm,
+                          struct snd_pcm_hw_params *params,
                           snd_pcm_hw_param_t var, int *dir)
 {
        int changed = _snd_pcm_hw_param_first(params, var);
@@ -1505,7 +1505,7 @@ static int _snd_pcm_hw_param_last(struct snd_pcm_hw_params *params,
  * values < maximum. Reduce configuration space accordingly.
  * Return the maximum.
  */
-int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm, 
+int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm,
                          struct snd_pcm_hw_params *params,
                          snd_pcm_hw_param_t var, int *dir)
 {
@@ -1731,7 +1731,7 @@ static int wait_for_avail_min(struct snd_pcm_substream *substream,
                case SNDRV_PCM_STATE_DRAINING:
                        if (is_playback)
                                err = -EPIPE;
-                       else 
+                       else
                                avail = 0; /* indicate draining */
                        goto _endloop;
                case SNDRV_PCM_STATE_OPEN:
@@ -1758,7 +1758,7 @@ static int wait_for_avail_min(struct snd_pcm_substream *substream,
        *availp = avail;
        return err;
 }
-       
+
 static int snd_pcm_lib_write_transfer(struct snd_pcm_substream *substream,
                                      unsigned int hwoff,
                                      unsigned long data, unsigned int off,
@@ -1777,12 +1777,12 @@ static int snd_pcm_lib_write_transfer(struct snd_pcm_substream *substream,
        }
        return 0;
 }
+
 typedef int (*transfer_f)(struct snd_pcm_substream *substream, unsigned int hwoff,
                          unsigned long data, unsigned int off,
                          snd_pcm_uframes_t size);
 
-static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, 
+static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream,
                                            unsigned long data,
                                            snd_pcm_uframes_t size,
                                            int nonblock,
@@ -1955,7 +1955,7 @@ static int snd_pcm_lib_writev_transfer(struct snd_pcm_substream *substream,
        }
        return 0;
 }
+
 snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,
                                     void __user **bufs,
                                     snd_pcm_uframes_t frames)
@@ -1978,7 +1978,7 @@ snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,
 
 EXPORT_SYMBOL(snd_pcm_lib_writev);
 
-static int snd_pcm_lib_read_transfer(struct snd_pcm_substream *substream, 
+static int snd_pcm_lib_read_transfer(struct snd_pcm_substream *substream,
                                     unsigned int hwoff,
                                     unsigned long data, unsigned int off,
                                     snd_pcm_uframes_t frames)
@@ -2109,7 +2109,7 @@ snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream, void __u
        struct snd_pcm_runtime *runtime;
        int nonblock;
        int err;
-       
+
        err = pcm_sanity_check(substream);
        if (err < 0)
                return err;
@@ -2157,7 +2157,7 @@ static int snd_pcm_lib_readv_transfer(struct snd_pcm_substream *substream,
        }
        return 0;
 }
+
 snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream,
                                    void __user **bufs,
                                    snd_pcm_uframes_t frames)
index 0b6a7fd20a16315bbc7037af59b19e29f3a207db..36ee1efba4e01dee62bcfa953fe70d67229cfdcd 100644 (file)
@@ -159,7 +159,7 @@ char *snd_pcm_hw_param_names[] = {
 };
 #endif
 
-int snd_pcm_hw_refine(struct snd_pcm_substream *substream, 
+int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
                      struct snd_pcm_hw_params *params)
 {
        unsigned int k;
@@ -212,7 +212,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
                if (i->empty)
                        printk("empty");
                else
-                       printk("%c%u %u%c", 
+                       printk("%c%u %u%c",
                               i->openmin ? '(' : '[', i->min,
                               i->max, i->openmax ? ')' : ']');
                printk(" -> ");
@@ -221,8 +221,8 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
 #ifdef RULES_DEBUG
                if (i->empty)
                        printk("empty\n");
-               else 
-                       printk("%c%u %u%c\n", 
+               else
+                       printk("%c%u %u%c\n",
                               i->openmin ? '(' : '[', i->min,
                               i->max, i->openmax ? ')' : ']');
 #endif
@@ -234,7 +234,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
 
        for (k = 0; k < constrs->rules_num; k++)
                rstamps[k] = 0;
-       for (k = 0; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) 
+       for (k = 0; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++)
                vstamps[k] = (params->rmask & (1 << k)) ? 1 : 0;
        do {
                again = 0;
@@ -264,7 +264,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
                                        if (i->empty)
                                                printk("empty");
                                        else
-                                               printk("%c%u %u%c", 
+                                               printk("%c%u %u%c",
                                                       i->openmin ? '(' : '[', i->min,
                                                       i->max, i->openmax ? ')' : ']');
                                }
@@ -280,7 +280,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
                                        if (i->empty)
                                                printk("empty");
                                        else
-                                               printk("%c%u %u%c", 
+                                               printk("%c%u %u%c",
                                                       i->openmin ? '(' : '[', i->min,
                                                       i->max, i->openmax ? ')' : ']');
                                }
@@ -658,7 +658,7 @@ static int snd_pcm_status_user(struct snd_pcm_substream *substream,
 {
        struct snd_pcm_status status;
        int res;
-       
+
        memset(&status, 0, sizeof(status));
        res = snd_pcm_status(substream, &status);
        if (res < 0)
@@ -673,7 +673,7 @@ static int snd_pcm_channel_info(struct snd_pcm_substream *substream,
 {
        struct snd_pcm_runtime *runtime;
        unsigned int channel;
-       
+
        channel = info->channel;
        runtime = substream->runtime;
        //giovanni snd_pcm_stream_lock_irq(substream);
@@ -694,7 +694,7 @@ static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream,
 {
        struct snd_pcm_channel_info info;
        int res;
-       
+
        if (copy_from_user(&info, _info, sizeof(info)))
                return -EFAULT;
        res = snd_pcm_channel_info(substream, &info);
@@ -785,7 +785,7 @@ static int snd_pcm_action_single(struct action_ops *ops,
                                 int state)
 {
        int res;
-       
+
        res = ops->pre_action(substream, state);
        if (res < 0)
                return res;
@@ -1543,7 +1543,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
        struct snd_pcm_runtime *runtime;
        struct snd_card *card;
        int result = 0;
-       
+
        if (PCM_RUNTIME_CHECK(substream))
                return -ENXIO;
        runtime = substream->runtime;
@@ -1779,7 +1779,7 @@ static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params,
        return snd_interval_list(hw_param_interval(params, rule->var),
                                 snd_pcm_known_rates.count,
                                 snd_pcm_known_rates.list, hw->rates);
-}              
+}
 
 static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params,
                                            struct snd_pcm_hw_rule *rule)
@@ -1792,7 +1792,7 @@ static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params,
        t.openmax = 0;
        t.integer = 1;
        return snd_interval_refine(hw_param_interval(params, rule->var), &t);
-}              
+}
 
 int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream)
 {
@@ -1819,98 +1819,98 @@ int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream)
                                   SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
                                  snd_pcm_hw_rule_sample_bits, NULL,
-                                 SNDRV_PCM_HW_PARAM_FORMAT, 
+                                 SNDRV_PCM_HW_PARAM_FORMAT,
                                  SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
                                  snd_pcm_hw_rule_div, NULL,
                                  SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS,
                                  snd_pcm_hw_rule_mul, NULL,
                                  SNDRV_PCM_HW_PARAM_SAMPLE_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS,
                                  snd_pcm_hw_rule_mulkdiv, (void*) 8,
                                  SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS,
                                  snd_pcm_hw_rule_mulkdiv, (void*) 8,
                                  SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
                                  snd_pcm_hw_rule_div, NULL,
                                  SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                  snd_pcm_hw_rule_mulkdiv, (void*) 1000000,
                                  SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_TIME, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                  snd_pcm_hw_rule_mulkdiv, (void*) 1000000,
                                  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_BUFFER_TIME, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS,
                                  snd_pcm_hw_rule_div, NULL,
                                  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
                                  snd_pcm_hw_rule_div, NULL,
                                  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
                                  snd_pcm_hw_rule_mulkdiv, (void*) 8,
                                  SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
                                  snd_pcm_hw_rule_muldivk, (void*) 1000000,
                                  SNDRV_PCM_HW_PARAM_PERIOD_TIME, SNDRV_PCM_HW_PARAM_RATE, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
                                  snd_pcm_hw_rule_mul, NULL,
                                  SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
                                  snd_pcm_hw_rule_mulkdiv, (void*) 8,
                                  SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
                                  snd_pcm_hw_rule_muldivk, (void*) 1000000,
                                  SNDRV_PCM_HW_PARAM_BUFFER_TIME, SNDRV_PCM_HW_PARAM_RATE, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
                                  snd_pcm_hw_rule_muldivk, (void*) 8,
                                  SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
                                  snd_pcm_hw_rule_muldivk, (void*) 8,
                                  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME,
                                  snd_pcm_hw_rule_mulkdiv, (void*) 1000000,
                                  SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1);
        if (err < 0)
                return err;
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME,
                                  snd_pcm_hw_rule_mulkdiv, (void*) 1000000,
                                  SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1);
        if (err < 0)
@@ -1974,7 +1974,7 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
        if (err < 0)
                return err;
 
-       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 
+       err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
                                  snd_pcm_hw_rule_buffer_bytes_max, substream,
                                  SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1);
        if (err < 0)
@@ -1988,7 +1988,7 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
        }
 
        if (!(hw->rates & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))) {
-               err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 
+               err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                          snd_pcm_hw_rule_rate, hw,
                                          SNDRV_PCM_HW_PARAM_RATE, -1);
                if (err < 0)
@@ -2424,7 +2424,7 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream)
        snd_pcm_stream_unlock_irq(substream);
        return err;
 }
-               
+
 static int snd_pcm_delay(struct snd_pcm_substream *substream,
                         snd_pcm_sframes_t __user *res)
 {
@@ -2464,7 +2464,7 @@ static int snd_pcm_delay(struct snd_pcm_substream *substream,
                        err = -EFAULT;
        return err;
 }
-               
+
 static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream,
                            struct snd_pcm_sync_ptr __user *_sync_ptr)
 {
@@ -2478,7 +2478,7 @@ static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream,
        if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags)))
                return -EFAULT;
        if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct snd_pcm_mmap_control)))
-               return -EFAULT; 
+               return -EFAULT;
        status = runtime->status;
        control = runtime->control;
        if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) {
@@ -2509,7 +2509,7 @@ static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        int arg;
-       
+
        if (get_user(arg, _arg))
                return -EFAULT;
        if (arg < 0 || arg > SNDRV_PCM_TSTAMP_TYPE_LAST)
@@ -2519,7 +2519,7 @@ static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg)
                runtime->tstamp_type = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC;
        return 0;
 }
-               
+
 static int snd_pcm_common_ioctl1(struct file *file,
                                 struct snd_pcm_substream *substream,
                                 unsigned int cmd, void __user *arg)
@@ -2781,7 +2781,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
 {
        mm_segment_t fs;
        int result;
-       
+
        fs = snd_enter_user();
        switch (substream->stream) {
        case SNDRV_PCM_STREAM_PLAYBACK:
@@ -3019,7 +3019,7 @@ static int snd_pcm_mmap_status_fault(struct vm_area_struct *area,
 {
        struct snd_pcm_substream *substream = area->vm_private_data;
        struct snd_pcm_runtime *runtime;
-       
+
        if (substream == NULL)
                return VM_FAULT_SIGBUS;
        runtime = substream->runtime;
@@ -3058,7 +3058,7 @@ static int snd_pcm_mmap_control_fault(struct vm_area_struct *area,
 {
        struct snd_pcm_substream *substream = area->vm_private_data;
        struct snd_pcm_runtime *runtime;
-       
+
        if (substream == NULL)
                return VM_FAULT_SIGBUS;
        runtime = substream->runtime;
@@ -3136,7 +3136,7 @@ static int snd_pcm_mmap_data_fault(struct vm_area_struct *area,
        unsigned long offset;
        struct page * page;
        size_t dma_bytes;
-       
+
        if (substream == NULL)
                return VM_FAULT_SIGBUS;
        runtime = substream->runtime;
@@ -3278,9 +3278,9 @@ EXPORT_SYMBOL(snd_pcm_mmap_data);
 static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
 {
        struct snd_pcm_file * pcm_file;
-       struct snd_pcm_substream *substream;    
+       struct snd_pcm_substream *substream;
        unsigned long offset;
-       
+
        pcm_file = file->private_data;
        substream = pcm_file->substream;
        if (PCM_RUNTIME_CHECK(substream))
index bfa228d9b7294d77a7b403d0a72ab391e66cd51f..32acb46790503372fee393f910ee42f167f7b11c 100644 (file)
@@ -473,7 +473,7 @@ int skypopen_init_module(void)
                return result;
        }
 
-       /* 
+       /*
         * allocate the devices -- we can't have them static, as the number
         * can be specified at load time
         */
index 2b0527eeb9b416692f6c5389e764325b70fcb6aa..3486bccdd1bb58422a36cdb686de656bb0e07d94 100644 (file)
 
 
 #if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18)
-#define CENTOS_5 
+#define CENTOS_5
 #define WANT_HRTIMER /* undef this only if you don't want to use High Resolution Timers (why?) */
 #endif /* CentOS 5.x */
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
-#define WANT_HRTIMER 
+#define WANT_HRTIMER
 #endif /* HRTIMER */
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
-#define WANT_DEFINE_SPINLOCK 
+#define WANT_DEFINE_SPINLOCK
 #endif /* DEFINE_SPINLOCK */
 
 #define SKYPOPEN_BLK 1920
@@ -57,13 +57,13 @@ struct skypopen_dev {
        struct cdev cdev;         /* Char device structure              */
        wait_queue_head_t inq; /* read and write queues */
        wait_queue_head_t outq; /* read and write queues */
-#ifndef WANT_HRTIMER 
+#ifndef WANT_HRTIMER
        struct timer_list timer_inq;
        struct timer_list timer_outq;
-#else// WANT_HRTIMER 
+#else// WANT_HRTIMER
        struct hrtimer timer_inq;
        struct hrtimer timer_outq;
-#endif// WANT_HRTIMER 
+#endif// WANT_HRTIMER
        int timer_inq_started;
        int timer_outq_started;
        int opened;
index a64cbd074db079f21638ff1fa7fbbd1e480e32a6..d001af16abb3f1786ce33343a4cd7de6f213f6a3 100644 (file)
@@ -1391,13 +1391,13 @@ int skypopen_audio_init(private_t *tech_pvt)
 #ifdef WIN32
 
 enum {
-       SKYPECONTROLAPI_ATTACH_SUCCESS = 0,     /*  Client is successfully 
+       SKYPECONTROLAPI_ATTACH_SUCCESS = 0,     /*  Client is successfully
                                                                                   attached and API window handle can be found
                                                                                   in wParam parameter */
        SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION = 1,       /*  Skype has acknowledged
                                                                                                                   connection request and is waiting
                                                                                                                   for confirmation from the user. */
-       /*  The client is not yet attached 
+       /*  The client is not yet attached
         * and should wait for SKYPECONTROLAPI_ATTACH_SUCCESS message */
        SKYPECONTROLAPI_ATTACH_REFUSED = 2,     /*  User has explicitly
                                                                                   denied access to client */
@@ -1405,8 +1405,8 @@ enum {
                                                                                                   at the moment.
                                                                                                   For example, this happens when no user
                                                                                                   is currently logged in. */
-       /*  Client should wait for 
-        * SKYPECONTROLAPI_ATTACH_API_AVAILABLE 
+       /*  Client should wait for
+        * SKYPECONTROLAPI_ATTACH_API_AVAILABLE
         * broadcast before making any further */
        /*  connection attempts. */
        SKYPECONTROLAPI_ATTACH_API_AVAILABLE = 0x8001
@@ -2080,7 +2080,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
                                                        }
                                                        if (continue_is_broken) {
                                                                XFlush(disp);
-                                                               skypopen_sleep(20000);  //20 msec 
+                                                               skypopen_sleep(20000);  //20 msec
                                                                WARNINGA("continue_is_broken\n", SKYPOPEN_P_LOG);
                                                                continue;
                                                        }
index 36502849d4bd0c54ad8397747756f1ea3b6c0a92..7c802aa43b550d4d105fd18f60a118557cb3ab94 100644 (file)
              really need to change this.
         -->
         <!-- <param name="renegotiate-codec-on-hold" value="true"/> -->
-        <!-- Turn on proxy hold when proxy media and proxy mode are disabled 
+        <!-- Turn on proxy hold when proxy media and proxy mode are disabled
              By default it is not set
-        --> 
+        -->
         <!-- <param name="proxy-hold" value="true"/> -->
         <!-- Choose the proxy notify events. Default is not set
 
index a8299fe16d7c96ce0ce74ee48db14a2cc6ee6628..1c5d0e48a11153bcda311469e78c8df8bf8efd35 100644 (file)
@@ -674,17 +674,17 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                        switch_core_media_proxy_remote_addr(tech_pvt->session, NULL);
                }
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                  "3PCC-PROXY nomedia - sending ack, SDP:\n%s\n", tech_pvt->mparams.local_sdp_str);
 
-               
+
                if (sofia_use_soa(tech_pvt)) {
                        nua_ack(tech_pvt->nh,
                                        TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                        SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
                                        SOATAG_REUSE_REJECTED(1),
-                                       SOATAG_RTP_SELECT(1), 
+                                       SOATAG_RTP_SELECT(1),
                                        SOATAG_AUDIO_AUX("cn telephone-event"),
                                        TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
                                        TAG_END());
@@ -696,7 +696,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                                        TAG_IF(tech_pvt->mparams.local_sdp_str, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
                                        TAG_IF(tech_pvt->mparams.local_sdp_str, SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str)),
                                        SOATAG_AUDIO_AUX("cn telephone-event"),
-                                       TAG_END());                     
+                                       TAG_END());
                }
 
 
@@ -768,7 +768,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                                                                SIPTAG_CONTACT_STR(tech_pvt->profile->url),
                                                                SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
                                                                TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
-                                                               SOATAG_REUSE_REJECTED(1), 
+                                                               SOATAG_REUSE_REJECTED(1),
                                                                SOATAG_RTP_SELECT(1),
                                                                SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
                                                                TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
@@ -897,7 +897,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                        }
                }
 
-               if ((tech_pvt->mparams.last_sdp_str && strstr(tech_pvt->mparams.last_sdp_str, "a=setup")) || 
+               if ((tech_pvt->mparams.last_sdp_str && strstr(tech_pvt->mparams.last_sdp_str, "a=setup")) ||
                        (tech_pvt->mparams.local_sdp_str && strstr(tech_pvt->mparams.local_sdp_str, "a=setup"))) {
                        session_timeout = 0;
                }
@@ -1457,7 +1457,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
        switch (msg->message_id) {
 
        case SWITCH_MESSAGE_INDICATE_DEFLECT: {
-               
+
                char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_HEADER_PREFIX);
                char ref_to[1024] = "";
                const char *var;
@@ -1498,18 +1498,18 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                if (!switch_channel_test_flag(channel, CF_AVPF) && switch_true(switch_core_get_variable("sofia_send_info_vid_refresh"))) {
                        const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control><vc_primitive><to_encoder><picture_fast_update /></to_encoder></vc_primitive></media_control>\n";
                        switch_time_t now = switch_micro_time_now();
-                       
+
                        if (!tech_pvt->last_vid_info || (now - tech_pvt->last_vid_info) > 500000) {
-                               
+
                                tech_pvt->last_vid_info = now;
-                               
+
                                if (!zstr(msg->string_arg)) {
                                        pl = msg->string_arg;
                                }
-                               
+
                                nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
                        }
-                       
+
                }
                break;
        case SWITCH_MESSAGE_INDICATE_BROADCAST:
@@ -1648,10 +1648,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
                        nua_invite(tech_pvt->nh,
                                           NUTAG_MEDIA_ENABLE(0),
-                                          TAG_IF(msg->string_arg, SIPTAG_CONTENT_TYPE_STR("application/sdp")), 
+                                          TAG_IF(msg->string_arg, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
                                           SIPTAG_PAYLOAD_STR(msg->string_arg),
                                           TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
-                       
+
                        switch_safe_free(extra_headers);
                }
                break;
@@ -1667,7 +1667,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
                        sofia_glue_clear_soa(session, SWITCH_TRUE);
 
-                       nua_invite(tech_pvt->nh, NUTAG_MEDIA_ENABLE(0), SIPTAG_PAYLOAD_STR(""), 
+                       nua_invite(tech_pvt->nh, NUTAG_MEDIA_ENABLE(0), SIPTAG_PAYLOAD_STR(""),
                                           TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
 
                        switch_safe_free(extra_headers);
@@ -1699,12 +1699,12 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        switch_core_media_set_sdp_codec_string(tech_pvt->session, r_sdp, SDP_TYPE_RESPONSE);
                        switch_channel_set_variable(tech_pvt->channel, "absolute_codec_string", switch_channel_get_variable(tech_pvt->channel, "ep_codec_string"));
                        switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
-                       
+
                        if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                goto end_lock;
                        }
-                       
+
                        switch_core_media_gen_local_sdp(session, SDP_TYPE_REQUEST, NULL, 0, NULL, 1);
 
                        if (!msg->numeric_arg) {
@@ -1737,7 +1737,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
                                                                  "Operation not permitted on an inbound non-answered call leg!\n");
                        } else {
-                               full_to = switch_str_nil(switch_channel_get_variable(channel, "sip_full_to"));                          
+                               full_to = switch_str_nil(switch_channel_get_variable(channel, "sip_full_to"));
                                nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), NUTAG_SUBSTATE(nua_substate_active),
                                                   TAG_IF((full_to), SIPTAG_TO_STR(full_to)),SIPTAG_SUBSCRIPTION_STATE_STR("active"),
                                                   SIPTAG_EVENT_STR(event), TAG_END());
@@ -2185,7 +2185,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                        }
                                        goto end_lock;
                                }
-                               
+
                                if (code == 302 && !zstr(msg->string_arg)) {
                                        char *p;
 
@@ -3038,7 +3038,7 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre
        stream->write_function(stream, "    <ping>%d</ping>\n", gp->ping);
        stream->write_function(stream, "    <pingfreq>%d</pingfreq>\n", gp->ping_freq);
        stream->write_function(stream, "    <pingmin>%d</pingmin>\n", gp->ping_min);
-       stream->write_function(stream, "    <pingcount>%d</pingcount>\n", gp->ping_count);      
+       stream->write_function(stream, "    <pingcount>%d</pingcount>\n", gp->ping_count);
        stream->write_function(stream, "    <pingmax>%d</pingmax>\n", gp->ping_max);
        stream->write_function(stream, "    <pingtime>%0.2f</pingtime>\n", gp->ping_time);
        stream->write_function(stream, "    <pinging>%d</pinging>\n", gp->pinging);
@@ -3856,7 +3856,7 @@ static void select_from_profile(sofia_profile_t *profile,
        if (exclude_contact) {
                sql = switch_mprintf("select contact, profile_name, '%q' "
                                                         "from sip_registrations where profile_name='%q' "
-                                                        "and upper(sip_user)=upper('%q') " 
+                                                        "and upper(sip_user)=upper('%q') "
                                                         "and (sip_host='%q' or presence_hosts like '%%%q%%') "
                                                         "and contact not like '%%%q%%'", (concat != NULL) ? concat : "", profile->name, user, domain, domain, exclude_contact);
        } else {
@@ -4511,14 +4511,14 @@ static int protect_dest_uri(switch_caller_profile_t *cp)
                                go = 1;
                        }
                }
-               
+
                if (!go) return 0;
-               
+
                *q++ = '\0';
        } else {
                return 0;
        }
-       
+
        if (!strncasecmp(q, "sips:", 5)) {
                q += 5;
        } else if (!strncasecmp(q, "sip:", 4)) {
@@ -4537,7 +4537,7 @@ static int protect_dest_uri(switch_caller_profile_t *cp)
                switch_url_encode(q, qenc, enclen);
                mod = 1;
        }
-       
+
        cp->destination_number = switch_core_sprintf(cp->pool, "%s/%s@%s", o, qenc ? qenc : q, e);
 
        return mod;
@@ -5727,7 +5727,7 @@ static void general_queue_event_handler(switch_event_t *event)
 void write_csta_xml_chunk(switch_event_t *event, switch_stream_handle_t stream, const char *csta_event, char *fwdtype)
 {
        const char *device = switch_event_get_header(event, "device");
-       
+
        switch_assert(csta_event);
 
        stream.write_function(&stream, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<%s xmlns=\"http://www.ecma-international.org/standards/ecma-323/csta/ed3\">\n", csta_event);
@@ -6263,7 +6263,7 @@ void mod_sofia_shutdown_cleanup() {
        switch_event_free_subclass(MY_EVENT_REGISTER);
        switch_event_free_subclass(MY_EVENT_GATEWAY_ADD);
        switch_event_free_subclass(MY_EVENT_BYE_RESPONSE);
-       
+
        switch_console_del_complete_func("::sofia::list_profiles");
        switch_console_set_complete("del sofia");
 
index eafde4671646673165b5b2cf38949148e6834dd8..7261b38f1abf2f373be27bdc8ee12fec4fafcd4f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Rene <mrene@avgs.ca>
  *
  * rtp.c -- RTP Controllable Channel Module
@@ -53,24 +53,24 @@ typedef struct {
     switch_channel_t *channel;
     switch_codec_t read_codec, write_codec;
     switch_frame_t read_frame;
-    
 
-    
+
+
     switch_rtp_bug_flag_t rtp_bugs;
     switch_rtp_t *rtp_session;
-    
+
     uint32_t timestamp_send;
-    
+
     const char *local_address;
     const char *remote_address;
     const char *codec;
     int ptime;
-    
+
     const switch_codec_implementation_t *negotiated_codecs[SWITCH_MAX_CODECS];
        int num_negotiated_codecs;
-    
+
     char *origin;
-    
+
     switch_port_t local_port;
     switch_port_t remote_port;
     switch_payload_t agreed_pt; /*XXX*/
@@ -86,7 +86,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session);
 static switch_status_t channel_on_destroy(switch_core_session_t *session);
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
                                                                                                        switch_caller_profile_t *outbound_profile,
-                                                                                                       switch_core_session_t **new_session, 
+                                                                                                       switch_core_session_t **new_session,
                                                                                                        switch_memory_pool_t **pool,
                                                                                                        switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -141,25 +141,25 @@ void crtp_init(switch_loadable_module_interface_t *module_interface)
     endpoint_interface->io_routines = &crtp_io_routines;
     endpoint_interface->state_handler = &crtp_state_handlers;
     crtp.endpoint_interface = endpoint_interface;
-    
+
     //SWITCH_ADD_API(api_interface, "rtp_test", "test", test_function, "");
 }
 
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
                                                                                                        switch_caller_profile_t *outbound_profile,
-                                                                                                       switch_core_session_t **new_session, 
+                                                                                                       switch_core_session_t **new_session,
                                                                                                        switch_memory_pool_t **pool,
                                                                                                        switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
 {
     switch_channel_t *channel;
     char name[128];
-    crtp_private_t *tech_pvt = NULL;    
+    crtp_private_t *tech_pvt = NULL;
     switch_caller_profile_t *caller_profile;
     switch_rtp_flag_t rtp_flags[SWITCH_RTP_FLAG_INVALID] = {0};
-    
+
     const char *err;
 
-    
+
     const char  *local_addr = switch_event_get_header_nil(var_event, kLOCALADDR),
                 *szlocal_port = switch_event_get_header_nil(var_event, kLOCALPORT),
                 *remote_addr = switch_event_get_header_nil(var_event, kREMOTEADDR),
@@ -170,33 +170,33 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                 //*szrfc2833_pt = switch_event_get_header_nil(var_event, kRFC2833PT),
                 *szrate = switch_event_get_header_nil(var_event, kRATE),
                 *szpt = switch_event_get_header_nil(var_event, kPT);
-    
-    
+
+
     switch_port_t local_port = !zstr(szlocal_port) ? (switch_port_t)atoi(szlocal_port) : 0,
                  remote_port = !zstr(szremote_port) ? (switch_port_t)atoi(szremote_port) : 0;
-    
+
     int ptime  = !zstr(szptime) ? atoi(szptime) : 0,
         //rfc2833_pt = !zstr(szrfc2833_pt) ? atoi(szrfc2833_pt) : 0,
         rate = !zstr(szrate) ? atoi(szrate) : 8000,
         pt = !zstr(szpt) ? atoi(szpt) : 0;
-    
+
         if (
             ((zstr(remote_addr) || remote_port == 0) && (zstr(local_addr) || local_port == 0)) ||
             zstr(codec) ||
             zstr(szpt)) {
-        
+
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required arguments\n");
         goto fail;
     }
-    
-    
+
+
     if (!(*new_session = switch_core_session_request(crtp.endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, 0, pool))) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't request session.\n");
         goto fail;
     }
-    
+
     channel = switch_core_session_get_channel(*new_session);
-    
+
     tech_pvt = switch_core_session_alloc(*new_session, sizeof *tech_pvt);
     tech_pvt->session = *new_session;
     tech_pvt->channel = channel;
@@ -207,7 +207,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
     tech_pvt->ptime = ptime;
     tech_pvt->agreed_pt = (switch_payload_t)pt;
     tech_pvt->dtmf_type = DTMF_2833; /* XXX */
-    
+
     if (zstr(local_addr) || local_port == 0) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "The local address and port must be set\n");
         goto fail;
@@ -216,16 +216,16 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
     } else {
         tech_pvt->mode = RTP_SENDRECV;
     }
-    
+
     switch_core_session_set_private(*new_session, tech_pvt);
-    
+
     caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
     switch_channel_set_caller_profile(channel, caller_profile);
-    
-    
+
+
     snprintf(name, sizeof(name), "rtp/%s", outbound_profile->destination_number);
        switch_channel_set_name(channel, name);
-    
+
     switch_channel_set_state(channel, CS_INIT);
 
        if (switch_core_codec_init(&tech_pvt->read_codec,
@@ -247,50 +247,50 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                                                                   rate,
                                                                   ptime,
                                                                   1,
-                                                                  SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/, 
+                                                                  SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/,
                                                                   NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
             goto fail;
                }
        }
-    
+
     if (switch_core_session_set_read_codec(*new_session, &tech_pvt->read_codec) != SWITCH_STATUS_SUCCESS) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set read codec?\n");
         goto fail;
     }
-    
+
     if (switch_core_session_set_write_codec(*new_session, &tech_pvt->write_codec) != SWITCH_STATUS_SUCCESS) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set write codec?\n");
         goto fail;
     }
-    
+
     if (!(tech_pvt->rtp_session = switch_rtp_new(local_addr, local_port, remote_addr, remote_port, tech_pvt->agreed_pt,
                                                                                                 tech_pvt->read_codec.implementation->samples_per_packet, ptime * 1000,
                                                                                                 rtp_flags, "soft", &err, switch_core_session_get_pool(*new_session)))) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't setup RTP session: [%s]\n", err);
         goto fail;
     }
-    
+
     if (switch_core_session_thread_launch(*new_session) != SWITCH_STATUS_SUCCESS) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't start session thread.\n"); 
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't start session thread.\n");
         goto fail;
     }
-    
+
     switch_channel_mark_answered(channel);
-    
+
     return SWITCH_CAUSE_SUCCESS;
-    
+
 fail:
      if (tech_pvt) {
         if (tech_pvt->read_codec.implementation) {
                        switch_core_codec_destroy(&tech_pvt->read_codec);
                }
-               
+
                if (tech_pvt->write_codec.implementation) {
                        switch_core_codec_destroy(&tech_pvt->write_codec);
                }
     }
-    
+
     if (*new_session) {
         switch_core_session_destroy(new_session);
     }
@@ -299,29 +299,29 @@ fail:
 
 static switch_status_t channel_on_init(switch_core_session_t *session)
 {
-    
+
     switch_channel_t *channel = switch_core_session_get_channel(session);
-    
+
     switch_channel_set_state(channel, CS_CONSUME_MEDIA);
-    
+
     return SWITCH_STATUS_FALSE;
 }
 
 static switch_status_t channel_on_destroy(switch_core_session_t *session)
 {
     crtp_private_t *tech_pvt = NULL;
-    
+
        if ((tech_pvt = switch_core_session_get_private(session))) {
-        
+
                if (tech_pvt->read_codec.implementation) {
                        switch_core_codec_destroy(&tech_pvt->read_codec);
                }
-               
+
                if (tech_pvt->write_codec.implementation) {
                        switch_core_codec_destroy(&tech_pvt->write_codec);
                }
        }
-    
+
     return SWITCH_STATUS_SUCCESS;
 }
 
@@ -331,24 +331,24 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
     crtp_private_t *tech_pvt;
     switch_channel_t *channel;
     switch_status_t status;
-    
+
     channel = switch_core_session_get_channel(session);
        assert(channel != NULL);
-       
+
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
-    
+
     if (!tech_pvt->rtp_session || tech_pvt->mode == RTP_SENDONLY) {
        switch_yield(20000); /* replace by local timer XXX */
         goto cng;
     }
-        
+
     if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
         switch_dtmf_t dtmf = { 0 };
         switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf);
         switch_channel_queue_dtmf(channel, &dtmf);
     }
-    
+
     tech_pvt->read_frame.flags = SFF_NONE;
     tech_pvt->read_frame.codec = &tech_pvt->read_codec;
     status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags);
@@ -356,16 +356,16 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
     if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
         goto cng;
     }
-    
+
     *frame = &tech_pvt->read_frame;
     return SWITCH_STATUS_SUCCESS;
-    
+
 cng:
     *frame = &tech_pvt->read_frame;
     tech_pvt->read_frame.codec = &tech_pvt->read_codec;
     tech_pvt->read_frame.flags |= SFF_CNG;
     tech_pvt->read_frame.datalen = 0;
-    
+
     return SWITCH_STATUS_SUCCESS;
 }
 
@@ -374,14 +374,14 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
     crtp_private_t *tech_pvt;
     switch_channel_t *channel;
     //int frames = 0, bytes = 0, samples = 0;
-    
+
     channel = switch_core_session_get_channel(session);
        assert(channel != NULL);
-       
+
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
-    
-    
+
+
 #if 0
     if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
                if (tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
@@ -389,10 +389,10 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
                        frames = ((int) frame->datalen / bytes);
                } else
                        frames = 1;
-        
+
                samples = frames * tech_pvt->read_codec.implementation->samples_per_packet;
        }
-    
+
     tech_pvt->timestamp_send += samples;
 #endif
     if (tech_pvt->mode == RTP_RECVONLY) {
@@ -407,10 +407,10 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
 static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
 {
        crtp_private_t *tech_pvt = NULL;
-    
+
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
-    
+
     switch(tech_pvt->dtmf_type) {
         case DTMF_2833:
         {
@@ -423,7 +423,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding DTMF %c of length %d, DTMF type is NONE\n", dtmf->digit, dtmf->duration);
                }
     }
-    
+
     return SWITCH_STATUS_SUCCESS;
 }
 
@@ -434,7 +434,7 @@ static switch_bool_t compare_var(switch_event_t *event, switch_channel_t *channe
 
     if (zstr(chan_val) || zstr(event_val)) {
        return 1;
-    }    
+    }
 
     return strcasecmp(chan_val, event_val);
 }
@@ -466,7 +466,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
 
             switch_channel_set_variable(channel, kREMOTEADDR, remote_addr);
             switch_channel_set_variable(channel, kREMOTEPORT, szremote_port);
-            
+
             if (switch_rtp_set_remote_address(tech_pvt->rtp_session, remote_addr, remote_port, 0, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
                 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error setting RTP remote address: %s\n", err);
             } else {
@@ -474,7 +474,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
                 tech_pvt->mode = RTP_SENDRECV;
             }
         }
-        
+
         if (compare_var(event, channel, kCODEC) ||
             compare_var(event, channel, kPTIME) ||
             compare_var(event, channel, kPT) ||
@@ -501,7 +501,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
                                                                           rate,
                                                                           ptime,
                                                                           1,
-                                                                          SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/, 
+                                                                          SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/,
                                                                           NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                                goto fail;
@@ -521,15 +521,15 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
                switch_rtp_set_default_payload(tech_pvt->rtp_session, (switch_payload_t)pt);
                //switch_rtp_set_recv_pt(tech_pvt->rtp_session, pt);
        }
-        
+
         if (compare_var(event, channel, kRFC2833PT)) {
             const char *szpt = switch_channel_get_variable(channel, kRFC2833PT);
             int pt = !zstr(szpt) ? atoi(szpt) : 0;
-            
+
             switch_channel_set_variable(channel, kRFC2833PT, szpt);
             switch_rtp_set_telephony_event(tech_pvt->rtp_session, (switch_payload_t)pt);
         }
-    
+
     } else {
         switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Received unknown command [%s] in event.\n", !command ? "null" : command);
     }
@@ -540,7 +540,7 @@ fail:
        if (tech_pvt->read_codec.implementation) {
                switch_core_codec_destroy(&tech_pvt->read_codec);
        }
-       
+
        if (tech_pvt->write_codec.implementation) {
                switch_core_codec_destroy(&tech_pvt->write_codec);
        }
@@ -553,17 +553,17 @@ fail:
 static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
     crtp_private_t *tech_pvt = NULL;
-    
+
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
-    
+
     switch (msg->message_id) {
         case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA:
         {
             if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) {
                                switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0};
                                int x = 0;
-                               
+
                 if (!strcasecmp(msg->string_array_arg[0], "read")) {
                     flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++;x++;
                 } else if (!strcasecmp(msg->string_array_arg[0], "write")) {
@@ -572,7 +572,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
                     flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++;x++;
                                        flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]++;
                 }
-                
+
                 if (x) {
                     if (switch_true(msg->string_array_arg[1])) {
                         switch_rtp_set_flags(tech_pvt->rtp_session, flags);
@@ -594,11 +594,11 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
                {
                        if (switch_rtp_ready(tech_pvt->rtp_session)) {
                                int len = 0, maxlen = 0, qlen = 0, maxqlen = 50;
-                
+
                                if (msg->string_arg) {
                                        char *p;
                                        const char *s;
-                    
+
                                        if (!strcasecmp(msg->string_arg, "pause")) {
                                                switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_TRUE);
                                                goto end;
@@ -613,47 +613,47 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
                         switch_rtp_debug_jitter_buffer(tech_pvt->rtp_session, s);
                                                goto end;
                                        }
-                    
-                                       
+
+
                                        if ((len = atoi(msg->string_arg))) {
                                                qlen = len / (tech_pvt->read_codec.implementation->microseconds_per_packet / 1000);
                                                if (qlen < 1) {
                                                        qlen = 3;
                                                }
                                        }
-                                       
+
                                        if (qlen) {
                                                if ((p = strchr(msg->string_arg, ':'))) {
                                                        p++;
                                                        maxlen = atol(p);
                                                }
                                        }
-                    
-                    
+
+
                                        if (maxlen) {
                                                maxqlen = maxlen / (tech_pvt->read_codec.implementation->microseconds_per_packet / 1000);
                                        }
                                }
-                
+
                                if (qlen) {
                                        if (maxqlen < qlen) {
                                                maxqlen = qlen * 5;
                                        }
                                        if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen,
-                                                                                                                 tech_pvt->read_codec.implementation->samples_per_packet, 
+                                                                                                                 tech_pvt->read_codec.implementation->samples_per_packet,
                                                                                                                  tech_pvt->read_codec.implementation->samples_per_second) == SWITCH_STATUS_SUCCESS) {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), 
-                                                                                 SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
+                                                                                 SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n",
                                                                                  len, qlen, maxqlen);
                                                switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER);
                                                if (!switch_false(switch_channel_get_variable(tech_pvt->channel, "rtp_jitter_buffer_plc"))) {
                                                        switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER_PLC);
                                                }
                                        } else {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
                                                                                  SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", len, qlen);
                                        }
-                                       
+
                                } else {
                                        switch_rtp_deactivate_jitter_buffer(tech_pvt->rtp_session);
                                }
index d367b8570bd91f65c97dbec3f6a7d0d874eeff20..29f8a9e704629f11f4862411879792a839600de4 100644 (file)
@@ -248,7 +248,7 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
        if (argc < 2 || argc == (DIG_MAX_ARGS + 1)) {
                usage(1);
        }
-       
+
        if (!strcasecmp(argv[i], "xml")) {
                switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "xml", "true");
                i++;
@@ -343,7 +343,7 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
        if (!dig->sres) {
                usage(1);
        }
-       
+
        for (; i <= argc && (string = argv[i]); i++) {
                if (multiple)
                        stream->write_function(stream, "%s", string);
@@ -440,12 +440,12 @@ int prepare_transport(struct dig *dig, char const *tport)
 
                if (!srv || srv[strlen(srv) - 1] != '.') {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: invalid transport specifier \"%s\"\n"
-                                               
+
                                                          "\tspecifier should have name/service/srv-id\n"
                                                          "\twhere name is protocol name (e.g, \"tls-udp\")\n"
                                                          "\t      service specifies service as per RFC 2915 (e.g., \"SIPS+D2U\")\n"
-                                                         "\t      srv-id is prefix for SRV lookup (e.g., \"_sips._udp.\")\n%s", 
-                                                         name, 
+                                                         "\t      srv-id is prefix for SRV lookup (e.g., \"_sips._udp.\")\n%s",
+                                                         name,
                                                          tport,
                                                          srv ? "\t      and it should end with a dot \".\"\n" : "");
 
@@ -881,7 +881,7 @@ void print_result(char const *addr,
                port = transport_is_secure(tport) ? "5061" : "5060";
 
        if (xml) {
-               stream->write_function(stream, 
+               stream->write_function(stream,
                                                           " <route>\n"
                                                           "  <preference>%u</preference>\n"
                                                           "  <weight>%.3f</weight>\n"
index 1ebde1573327a7649327c01689f7a4076490a5cf..27750e25ba8a7306ab093f392c6eb584f72d2223 100644 (file)
@@ -123,10 +123,10 @@ void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
 {
        private_object_t *tech_pvt = switch_core_session_get_private(session);
        switch_core_session_t *other_session;
-       
+
        if (tech_pvt->proxy_refer_uuid && (other_session = switch_core_session_locate(tech_pvt->proxy_refer_uuid))) {
                switch_core_session_message_t *msg;
-               
+
                msg = switch_core_session_alloc(other_session, sizeof(*msg));
                msg->message_id = SWITCH_MESSAGE_INDICATE_RESPOND;
                msg->from = __FILE__;
@@ -138,7 +138,7 @@ void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
                tech_pvt->proxy_refer_uuid = NULL;
        }
 
-       
+
        if (status == 481 && sip && !sip->sip_retry_after && sip->sip_call_id && (!sofia_private || !sofia_private->is_call)) {
                char *sql;
 
@@ -581,10 +581,10 @@ static void sofia_parse_all_invite_headers(sip_t const *sip, switch_core_session
 static switch_status_t sofia_pass_notify(switch_core_session_t *session, const char *uuid, const char *payload)
 {
        switch_core_session_t *other_session;
-               
+
        if ((other_session = switch_core_session_locate(uuid))) {
                switch_core_session_message_t *msg;
-                               
+
                msg = switch_core_session_alloc(other_session, sizeof(*msg));
                MESSAGE_STAMP_FFL(msg);
                msg->message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE;
@@ -766,7 +766,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
                }
                goto error;
        }
-       
+
 
        if (!(gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n");
@@ -1067,7 +1067,7 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
                if (nsession) {
                        const char *vval;
                        switch_channel_t *nchannel = switch_core_session_get_channel(nsession);
-                       
+
                        if (!(vval = switch_channel_get_variable(nchannel, "sip_copy_custom_headers")) || switch_true(vval)) {
                                switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_BYE_HEADER_PREFIX_T);
                        }
@@ -1436,7 +1436,7 @@ static void sofia_handle_sip_r_refer(nua_t *nua, sofia_profile_t *profile, nua_h
        if (status < 200) {
                return;
        }
-       
+
        if (tech_pvt->proxy_refer_uuid && (other_session = switch_core_session_locate(tech_pvt->proxy_refer_uuid))) {
                switch_core_session_message_t *msg;
 
@@ -1711,7 +1711,7 @@ static void our_sofia_event_callback(nua_event_t event,
                                if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) && r_sdp) {
                                        if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY)) {
                                                switch_channel_set_variable_partner(tech_pvt->channel, SWITCH_B_SDP_VARIABLE, r_sdp);
-                                               
+
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
                                                sofia_media_activate_rtp(tech_pvt);
                                                switch_core_media_proxy_remote_addr(tech_pvt->session, r_sdp);
@@ -1719,10 +1719,10 @@ static void our_sofia_event_callback(nua_event_t event,
                                                sofia_clear_flag(tech_pvt, TFLAG_PASS_ACK);
 
                                        }
-                                       
+
                                }
-                               
-                               
+
+
                                if (sofia_test_flag(tech_pvt, TFLAG_PASS_ACK)) {
                                        switch_core_session_t *other_session;
 
@@ -1878,7 +1878,7 @@ static void our_sofia_event_callback(nua_event_t event,
                                }
 
 
-                               if ((refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to))) {                                       
+                               if ((refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to))) {
                                        if ((iparams = strchr(refer_to, ';'))) {
                                                *iparams++ = '\0';
 
@@ -1991,7 +1991,7 @@ static void our_sofia_event_callback(nua_event_t event,
                                        to_user = "n/a";
                                        to_host = "n/a";
                                }
-                               
+
                                while (ap) {
                                        switch_snprintf(accept_header + strlen(accept_header), sizeof(accept_header) - strlen(accept_header),
                                                                        "%s%s ", ap->ac_type, ap->ac_next ? "," : "");
@@ -2064,7 +2064,7 @@ static void our_sofia_event_callback(nua_event_t event,
                                        switch_event_fire(&event);
                                }
 
-                               
+
                                if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "profile-name", profile->name);
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from-user", sofia_private->user);
@@ -2074,7 +2074,7 @@ static void our_sofia_event_callback(nua_event_t event,
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "reason", "socket-disconnection");
                                        switch_event_fire(&event);
                                }
-                               
+
 
                                sofia_reg_check_socket(profile, sofia_private->call_id, sofia_private->network_ip, sofia_private->network_port);
                                nua_handle_destroy(nh);
@@ -2433,7 +2433,7 @@ void sofia_event_callback(nua_event_t event,
        case nua_i_notify:
        case nua_i_info:
 
-               
+
                if (event == nua_i_invite) {
                        if (sip->sip_session_expires && profile->minimum_session_expires) {
                                if (sip->sip_session_expires->x_delta < profile->minimum_session_expires) {
@@ -2963,7 +2963,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
                                        sofia_reg_check_expire(profile, now, 0);
                                        ireg_loops = 0;
                                }
-       
+
                                if(++iping_loops >= (uint32_t)profile->iping_freq) {
                                        time_t now = switch_epoch_time_now(NULL);
                                        sofia_reg_check_ping_expire(profile, now, profile->iping_seconds);
@@ -2981,7 +2981,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
                }
 
                if (switch_queue_pop_timeout(mod_sofia_globals.general_event_queue, &pop, 100000) == SWITCH_STATUS_SUCCESS) {
-                       
+
                        do {
                                switch_event_t *event = (switch_event_t *) pop;
                                general_event_handler(event);
@@ -3865,7 +3865,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag,
                                        ping_min = atoi(val);
                                } else if (!strcmp(var, "ping-user-agent")) {
                                        options_user_agent = val;
-                               } else if (!strcmp(var, "ping-monitoring")) { // if true then every gw ping result will fire a gateway status event 
+                               } else if (!strcmp(var, "ping-monitoring")) { // if true then every gw ping result will fire a gateway status event
                                        ping_monitoring = switch_true(val);
                                } else if (!strcmp(var, "proxy")) {
                                        proxy = val;
@@ -4624,7 +4624,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                        int found = 1; // Used to break up long if/elseif chain (MSVC2015 fails (parser stack overflow) otherwise)
 
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s [%s]\n", var, val);
-                                       
+
                                        if (!strcasecmp(var, "debug") && val) {
                                                profile->debug = atoi(val);
                                        } else if (!strcasecmp(var, "parse-invite-tel-params")) {
@@ -5330,7 +5330,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                                found = 0;
                                        }
                                        if (found) continue;
-                                       
+
                                        if (!strcasecmp(var, "multiple-registrations")) {
                                                if (val && !strcasecmp(val, "call-id")) {
                                                        sofia_set_pflag(profile, PFLAG_MULTIREG);
@@ -5959,7 +5959,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting nonce TTL to 60 seconds\n");
                                        profile->nonce_ttl = 60;
                                }
-                               
+
                                if (!profile->max_auth_validity) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting MAX Auth Validity to 0 Attempts\n");
                                        profile->max_auth_validity = 0;
@@ -6251,14 +6251,14 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
                                        gateway->uptime = switch_time_now();
                                        do_fire_gateway_state_event = SWITCH_TRUE;
                                }
-                               
+
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                                                                  "Ping succeeded %s with code %d - count %d/%d/%d, state %s\n",
                                                                  gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max, sofia_gateway_status_name(gateway->status));
                        }
                        if (gateway->ping_sent) {
                                gateway->ping_time = (float)(switch_time_now() - gateway->ping_sent) / 1000;
-                               gateway->ping_sent = 0;                                 
+                               gateway->ping_sent = 0;
                        }
                } else {
                        if (gateway->state == REG_STATE_REGED) {
@@ -6800,7 +6800,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                                        }
 
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n%s\n", status, phrase, switch_str_nil(r_sdp));
-                                       
+
                                        if (switch_core_session_compare(session, other_session)) {
                                                private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
                                                sofia_set_flag(other_tech_pvt, TFLAG_PASS_ACK);
@@ -6815,7 +6815,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                                        } else if (status > 299) {
                                                switch_core_media_reset_t38(session);
                                                switch_core_media_reset_t38(other_session);
-                                       } else if (status == 200 && switch_channel_test_flag(channel, CF_T38_PASSTHRU) && 
+                                       } else if (status == 200 && switch_channel_test_flag(channel, CF_T38_PASSTHRU) &&
                                                           has_t38 && sip->sip_payload && sip->sip_payload->pl_data) {
                                                switch_t38_options_t *t38_options = switch_core_media_extract_t38_options(session, sip->sip_payload->pl_data);
 
@@ -7170,10 +7170,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 
                tech_pvt->mparams.last_sdp_str = NULL;
                tech_pvt->mparams.last_sdp_response = NULL;
-               
+
                if (r_sdp && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) {
                        const char *var;
-                       
+
                        if ((var = switch_channel_get_variable(channel, "bypass_media_sdp_filter"))) {
                                if ((patched_sdp = switch_core_media_process_sdp_filter(r_sdp, var, session))) {
                                        r_sdp = patched_sdp;
@@ -7183,7 +7183,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 
                if ((switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) ||
                        (sofia_test_flag(profile, TFLAG_INB_NOMEDIA) || sofia_test_flag(profile, TFLAG_PROXY_MEDIA))) {
-                       
+
                        /* This marr in our code brought to you by people who can't read........ */
                        if (profile->ndlb & SM_NDLB_ALLOW_BAD_IANANAME && r_sdp && (p = (char *) switch_stristr("g729a/8000", r_sdp))) {
                                p += 4;
@@ -7350,7 +7350,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                        if (switch_channel_test_flag(channel, CF_PROXY_MODE) && r_sdp) {
                                char ibuf[35] = "", pbuf[35] = "";
                                const char *ptr;
-                       
+
                                if ((ptr = switch_stristr("c=IN IP4", r_sdp))) {
                                        int i = 0;
 
@@ -7368,7 +7368,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 
                                if ((ptr = switch_stristr("m=audio", r_sdp))) {
                                        int i = 0;
-               
+
                                        ptr += 7;
 
                                        while(*ptr == ' ') {
@@ -7380,7 +7380,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 
                                        switch_channel_set_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, pbuf);
                                }
-                       
+
                                if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) &&  switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
                                        switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
                                }
@@ -7450,26 +7450,26 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                        }
 
                        if (switch_channel_test_flag(channel, CF_3P_NOMEDIA_REQUESTED)) {
-                               
+
                                if (switch_channel_test_flag(channel, CF_3P_NOMEDIA_REQUESTED_BLEG)) {
                                        switch_core_session_t *other_session;
-                                       
+
                                        switch_channel_clear_flag(channel, CF_3P_NOMEDIA_REQUESTED_BLEG);
-                                       
+
                                        if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                                if (switch_core_session_compare(session, other_session)) {
                                                        //switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
                                                        private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
 
                                                        sofia_glue_clear_soa(other_session, SWITCH_TRUE);
-                                                       
+
                                                        if (sofia_use_soa(other_tech_pvt)) {
                                                                nua_ack(other_tech_pvt->nh,
                                                                                TAG_IF(!zstr(other_tech_pvt->user_via), SIPTAG_VIA_STR(other_tech_pvt->user_via)),
                                                                                SIPTAG_CONTACT_STR(other_tech_pvt->reply_contact),
                                                                                SOATAG_USER_SDP_STR(r_sdp),
                                                                                SOATAG_REUSE_REJECTED(1),
-                                                                               SOATAG_RTP_SELECT(1), 
+                                                                               SOATAG_RTP_SELECT(1),
                                                                                SOATAG_AUDIO_AUX("cn telephone-event"),
                                                                                TAG_IF(sofia_test_pflag(other_tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
                                                                                TAG_END());
@@ -7488,22 +7488,22 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                        TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                                        TAG_END());
-                                                       
+
                                                }
                                                switch_core_session_rwunlock(other_session);
                                        }
                                } else {
                                        switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
                                }
-                               
+
                                switch_channel_clear_flag(channel, CF_3P_NOMEDIA_REQUESTED);
                                goto done;
 
                        } else if (switch_channel_test_flag(channel, CF_3P_MEDIA_REQUESTED)) {
                                uint8_t match = 0;
-                               
+
                                switch_channel_clear_flag(channel, CF_PROXY_MODE);
-                               
+
                                switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0);
                                switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_FALSE);
 
@@ -7519,7 +7519,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0);
                                        switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED");
                                        sofia_set_flag_locked(tech_pvt, TFLAG_READY);
-                                       
+
                                        sofia_set_flag(tech_pvt, TFLAG_SDP);
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RESTABLISH MEDIA SDP:\n%s\n", tech_pvt->mparams.local_sdp_str);
 
@@ -7536,7 +7536,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                                SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
                                                                SOATAG_REUSE_REJECTED(1),
-                                                               SOATAG_RTP_SELECT(1), 
+                                                               SOATAG_RTP_SELECT(1),
                                                                SOATAG_AUDIO_AUX("cn telephone-event"),
                                                                TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
                                                                TAG_END());
@@ -7550,7 +7550,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                SOATAG_AUDIO_AUX("cn telephone-event"),
                                                                TAG_END());
                                        }
-                                       
+
                                        switch_channel_clear_flag(channel, CF_3P_MEDIA_REQUESTED);
                                        goto done;
                                }
@@ -7610,7 +7610,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        goto done;
                                }
                        }
-                       
+
 
                        if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
                                if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
@@ -7814,7 +7814,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                        }
 
                        goto done;
-                       
+
                } else {
                        ss_state = nua_callstate_completed;
                        goto state_process;
@@ -7879,7 +7879,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 
                                                goto done;
                                        }
-                                       
+
                                        if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                                switch_core_session_message_t *msg;
                                                private_object_t *other_tech_pvt;
@@ -7887,8 +7887,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 
                                                switch_core_media_clear_rtp_flag(other_session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_RTP_FLAG_AUTOADJ);
 
-                                               
-                                               if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 && 
+
+                                               if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 &&
                                                        ((profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD) || media_on_hold)) {
                                                        if (switch_stristr("sendonly", r_sdp) || switch_stristr("0.0.0.0", r_sdp) || switch_stristr("inactive", r_sdp)) {
                                                                tech_pvt->mparams.hold_laps = 1;
@@ -7901,7 +7901,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                        //if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
                                                                                //const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 
-                                                                               
+
                                                                                switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
                                                                                if (sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
                                                                                        switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
@@ -8010,7 +8010,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                        }
                                        goto done;
-                               } else {                                        
+                               } else {
                                        int hold_related = 0;
 
                                        if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
@@ -8018,7 +8018,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        } else if (switch_stristr("sendonly", r_sdp) || switch_stristr("0.0.0.0", r_sdp) || switch_stristr("inactive", r_sdp)) {
                                                hold_related = 1;
                                        }
-                                       
+
                                        if (!is_t38 && hold_related && switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                                if (switch_core_session_compare(session, other_session)) {
                                                        switch_core_session_message_t *msg;
@@ -8038,9 +8038,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                        switch_core_session_rwunlock(other_session);
                                                                        goto done;
                                                                }
-                                                               
+
                                                                msg = switch_core_session_alloc(other_session, sizeof(*msg));
-                                                               
+
                                                                if (switch_stristr("inactive", r_sdp)) {
                                                                        sofia_set_flag_locked(other_tech_pvt, TFLAG_SIP_HOLD_INACTIVE);
                                                                        //switch_channel_set_variable(channel, "sofia_hold_inactive", "true");
@@ -8073,9 +8073,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Indicating %s to other leg.\n%s\n", hold_msg, r_sdp);
 
                                                                switch_core_session_queue_message(other_session, msg);
-                                                               
-                                                       
-                                                               
+
+
+
                                                                switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0);
                                                                if (sofia_use_soa(tech_pvt)){
                                                                        nua_respond(tech_pvt->nh, SIP_200_OK,
@@ -8092,7 +8092,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                }
                                                                switch_core_session_rwunlock(other_session);
                                                                goto done;
-                                                       }                                                       
+                                                       }
                                                }
 
                                                switch_core_session_rwunlock(other_session);
@@ -8145,7 +8145,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        }
                                }
 
-                               
+
                                if (is_ok) {
 
                                        if (switch_core_session_local_crypto_key(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
@@ -8165,7 +8165,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                        SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                                        SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str), TAG_END());
                                        }
-                                       
+
                                        if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REINVITE) == SWITCH_STATUS_SUCCESS) {
                                                switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session));
                                                switch_event_fire(&s_event);
@@ -8222,7 +8222,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                        other_channel = switch_core_session_get_channel(other_session);
                                        switch_channel_pass_sdp(channel, other_channel, r_sdp);
-                                       
+
                                        if (sofia_test_flag(tech_pvt, TFLAG_3PCC) && sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
                                                sofia_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
@@ -8324,7 +8324,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                                other_channel = switch_core_session_get_channel(other_session);
                                                switch_channel_pass_sdp(channel, other_channel, r_sdp);
-                                               
+
                                                //switch_channel_answer(other_channel);
                                                switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER);
 
@@ -8340,9 +8340,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                } else {
                                        uint8_t match = 0;
 
-                                       
+
                                        match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE);
-                                       
+
 
                                        sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
 
@@ -8371,7 +8371,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                        goto done;
                                                }
                                        }
-                                       
+
                                        switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "NO CODECS");
                                        switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
                                }
@@ -8584,10 +8584,10 @@ static switch_status_t sofia_process_proxy_refer(switch_core_session_t *session,
 {
        switch_core_session_t *other_session;
        private_object_t *tech_pvt = switch_core_session_get_private(session);
-       
+
        if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
                switch_core_session_message_t *msg;
-               
+
                tech_pvt->proxy_refer_uuid = switch_core_session_strdup(session, switch_core_session_get_uuid(other_session));
                msg = switch_core_session_alloc(other_session, sizeof(*msg));
                MESSAGE_STAMP_FFL(msg);
@@ -9293,7 +9293,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
                                                   SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"),
                                                   SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
                        }
-            
+
             if (refer_to->r_url->url_params) {
                 switch_channel_set_variable(b_channel, "sip_h_X-FS-Refer-Params", refer_to->r_url->url_params);
             }
@@ -9424,11 +9424,11 @@ switch_status_t sofia_proxy_sip_i_message(nua_t *nua, sofia_profile_t *profile,
                        }
 
                        other_tech_pvt = (private_object_t *) switch_core_session_get_private(other_session);
-                       
+
                        if (sip->sip_content_type->c_type && sip->sip_content_type->c_subtype) {
                                ct = sip->sip_content_type->c_type;
                        }
-                       
+
                        nua_message(other_tech_pvt->nh,
                                         TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(su_strdup(other_tech_pvt->nh->nh_home, ct))),
                                         TAG_IF(!zstr(other_tech_pvt->user_via), SIPTAG_VIA_STR(other_tech_pvt->user_via)),
@@ -9457,13 +9457,13 @@ switch_status_t sofia_proxy_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua
                        const char *ct = NULL;
                        char *pl = NULL;
                        switch_channel_t *channel = switch_core_session_get_channel(session);
-                       
+
                        if (sip && sip->sip_payload && sip->sip_payload->pl_data) {
                                pl = sip->sip_payload->pl_data;
                        }
 
                        other_tech_pvt = (private_object_t *) switch_core_session_get_private(other_session);
-                       
+
                        if (sip->sip_content_type->c_type && sip->sip_content_type->c_subtype) {
                                ct = sip->sip_content_type->c_type;
                        }
@@ -9963,7 +9963,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                uparams = NULL;
        }
 
-       
+
        if (uparams) {
                if (switch_stristr("transport=tcp", uparams)) {
                        is_tcp = 1;
@@ -10014,11 +10014,11 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
        }
 
 
-       if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) || 
-               (sofia_test_pflag(profile, PFLAG_TLS_ALWAYS_NAT) && (is_tcp || is_tls)) || 
-               (!is_tcp && !is_tls && (zstr(network_ip) || !switch_check_network_list_ip(network_ip, profile->local_network)) && 
-                profile->server_rport_level >= 2 && sip->sip_user_agent && 
-                sip->sip_user_agent->g_string && 
+       if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ||
+               (sofia_test_pflag(profile, PFLAG_TLS_ALWAYS_NAT) && (is_tcp || is_tls)) ||
+               (!is_tcp && !is_tls && (zstr(network_ip) || !switch_check_network_list_ip(network_ip, profile->local_network)) &&
+                profile->server_rport_level >= 2 && sip->sip_user_agent &&
+                sip->sip_user_agent->g_string &&
                 (!strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7) || !strncasecmp(sip->sip_user_agent->g_string, "KIRK Wireless Server", 20)))
                ) {
                if (sip && sip->sip_via) {
@@ -10467,7 +10467,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                                                                char *var_name = NULL;
                                                                var_name = switch_mprintf("sip_invite_%s", argv1[x1]);
                                                                switch_channel_set_variable(channel, var_name, "true");
-                                                               switch_safe_free( var_name );                                                                   
+                                                               switch_safe_free( var_name );
                                                        }
                                                }
                                        }
@@ -11044,7 +11044,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                                                if (bcp->originatee_caller_profile) {
                                                        switch_caller_profile_t *cp;
 
-                                                       cp = switch_caller_profile_dup(tech_pvt->caller_profile->pool, 
+                                                       cp = switch_caller_profile_dup(tech_pvt->caller_profile->pool,
                                                                                                                   bcp->originatee_caller_profile);
 
                                                        switch_channel_set_originatee_caller_profile(tech_pvt->channel, cp);
@@ -11099,7 +11099,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                                                                switch_channel_event_set_data(b_channel, event);
                                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_replaced_by", sip->sip_call_id->i_id);
                                                                switch_event_fire(&event);
-                                                       }                                                       
+                                                       }
                                                        switch_channel_hangup(b_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
                                                }
                                        }
index 93e45ed8db96f25fa406612ddf61c0e875967ee3..44e4ed3d0f775602fe87051521cea8c8e06ea002 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice <krice@freeswitch.org>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -44,8 +44,8 @@ int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip)
 {
        switch_assert(network_ip);
 
-       return (profile->extsipip && 
-                       !switch_check_network_list_ip(network_ip, "loopback.auto") && 
+       return (profile->extsipip &&
+                       !switch_check_network_list_ip(network_ip, "loopback.auto") &&
                        !switch_check_network_list_ip(network_ip, profile->local_network));
 }
 
@@ -77,7 +77,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
        switch_assert(session != NULL);
        switch_assert(profile != NULL);
        switch_assert(tech_pvt != NULL);
-       
+
        switch_core_session_add_stream(session, NULL);
 
        switch_mutex_lock(tech_pvt->flag_mutex);
@@ -183,7 +183,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
        tech_pvt->mparams.cng_pt = tech_pvt->cng_pt;
        tech_pvt->mparams.rtp_timeout_sec = profile->rtp_timeout_sec;
        tech_pvt->mparams.rtp_hold_timeout_sec = profile->rtp_hold_timeout_sec;
-       
+
        if (profile->rtp_digit_delay) {
                tech_pvt->mparams.dtmf_delay = profile->rtp_digit_delay;
        }
@@ -589,7 +589,7 @@ char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char
                        new_uri = switch_core_session_sprintf(session, "%s;%s@%s", lhs, invite_tel_params, rhs);
                }
        }
-       
+
        return new_uri;
 }
 
@@ -609,7 +609,7 @@ char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix
                for (; hi; hi = hi->next) {
                        const char *name = (char *) hi->name;
                        char *value = (char *) hi->value;
-                       
+
                        if (!strcasecmp(name, "sip_geolocation")) {
                                stream.write_function(&stream, "Geolocation: %s\r\n", value);
                        }
@@ -643,7 +643,7 @@ void sofia_glue_set_extra_headers(switch_core_session_t *session, sip_t const *s
        switch_channel_t *channel = switch_core_session_get_channel(session);
        char pstr[32];
 
-       
+
        if (!sip || !channel) {
                return;
        }
@@ -759,7 +759,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                switch_true(switch_channel_get_variable_dup(tech_pvt->channel, "sofia_hold_inactive", SWITCH_FALSE, -1))) {
                hold_char = "#";
        }
-       
+
        if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING)) {
                const char *recover_contact = switch_channel_get_variable(tech_pvt->channel, "sip_recover_contact");
                recover_via = switch_channel_get_variable(tech_pvt->channel, "sip_recover_via");
@@ -767,7 +767,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                if (!zstr(invite_record_route)) {
                        record_route = switch_core_session_sprintf(session, "Record-Route: %s", invite_record_route);
                }
-               
+
                if (recover_contact) {
                        char *tmp = switch_core_session_strdup(session, recover_contact);
                        tech_pvt->redirected = sofia_glue_get_url_from_contact(tmp, 0);
@@ -845,7 +845,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                const char *from_display = switch_channel_get_variable(tech_pvt->channel, "sip_from_display");
                const char *invite_req_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_req_uri");
                const char *invite_domain = switch_channel_get_variable(tech_pvt->channel, "sip_invite_domain");
-               
+
                const char *use_name, *use_number;
 
                if (zstr(tech_pvt->dest)) {
@@ -1050,7 +1050,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                        }
                        switch_channel_set_variable(channel, "sip_req_uri", s);
                }
-               
+
                switch_channel_set_variable(channel, "sip_to_host", sofia_glue_get_host(to_str, switch_core_session_get_pool(session)));
                switch_channel_set_variable(channel, "sip_from_host", sofia_glue_get_host(from_str, switch_core_session_get_pool(session)));
 
@@ -1060,14 +1060,14 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                                                                                TAG_IF(!zstr(record_route), SIPTAG_HEADER_STR(record_route)),
                                                                                SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END()))) {
 
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT,
                                                          "Error creating HANDLE!\nurl_str=[%s]\ncall_id=[%s]\nto_str=[%s]\nfrom_str=[%s]\ninvite_contact=[%s]\n",
                                                          url_str,
                                                          call_id ? call_id : "N/A",
                                                          to_str,
                                                          from_str,
                                                          invite_contact);
-                       
+
                        switch_safe_free(d_url);
                        return SWITCH_STATUS_FALSE;
                }
@@ -1294,12 +1294,12 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
 
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s sending invite version: %s\nLocal SDP:\n%s\n",
-                                         switch_channel_get_name(tech_pvt->channel), switch_version_full_human(), 
+                                         switch_channel_get_name(tech_pvt->channel), switch_version_full_human(),
                                          tech_pvt->mparams.local_sdp_str ? tech_pvt->mparams.local_sdp_str : "NO SDP PRESENT\n");
 
 
 
-       if ((switch_channel_get_private(tech_pvt->channel, "t38_options")) ||  
+       if ((switch_channel_get_private(tech_pvt->channel, "t38_options")) ||
                ((switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) ||
                  switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) )
                        && switch_stristr("m=image", tech_pvt->mparams.local_sdp_str))) {
@@ -1504,7 +1504,7 @@ void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp)
                && (other_session = switch_core_session_locate(val))) {
                other_channel = switch_core_session_get_channel(other_session);
                switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
-               
+
 #if 0
                if (!sofia_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && !switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING) &&
                        (switch_channel_direction(other_channel) == SWITCH_CALL_DIRECTION_OUTBOUND &&
@@ -1527,7 +1527,7 @@ char *sofia_glue_get_path_from_contact(char *buf)
        contact = sofia_glue_get_url_from_contact(buf, SWITCH_TRUE);
 
        if (!contact) return NULL;
-       
+
        if ((p = strstr(contact, "fs_path="))) {
                p += 8;
 
@@ -1557,7 +1557,7 @@ char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup)
        char *url = NULL, *e;
 
        switch_assert(buf);
-       
+
        while(*buf == ' ') {
                buf++;
        }
@@ -1611,7 +1611,7 @@ switch_status_t sofia_glue_profile_rdlock__(const char *file, const char *func,
 switch_bool_t sofia_glue_profile_exists(const char *key)
 {
        switch_bool_t tf = SWITCH_FALSE;
-       
+
        switch_mutex_lock(mod_sofia_globals.hash_mutex);
        if (switch_core_hash_find(mod_sofia_globals.profile_hash, key)) {
                tf = SWITCH_TRUE;
@@ -1693,7 +1693,7 @@ void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *s
        switch_mutex_lock(mod_sofia_globals.hash_mutex);
        for (gp = profile->gateways; gp; gp = gp->next) {
                int reged = (gp->status == SOFIA_GATEWAY_UP);
-               
+
                if (up ? reged : !reged) {
                        stream->write_function(stream, "%s ", gp->name);
                }
@@ -1773,7 +1773,7 @@ void sofia_glue_global_siptrace(switch_bool_t on)
                for (hi = switch_core_hash_first(mod_sofia_globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
                        switch_core_hash_this(hi, &var, NULL, &val);
                        if ((pptr = (sofia_profile_t *) val)) {
-                               nua_set_params(pptr->nua, TPTAG_LOG(on), TAG_END());                            
+                               nua_set_params(pptr->nua, TPTAG_LOG(on), TAG_END());
                        }
                }
        }
@@ -1886,7 +1886,7 @@ void sofia_glue_del_profile(sofia_profile_t *profile)
        switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 }
 
-int sofia_recover_callback(switch_core_session_t *session) 
+int sofia_recover_callback(switch_core_session_t *session)
 {
 
        switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -1896,7 +1896,7 @@ int sofia_recover_callback(switch_core_session_t *session)
        const char *rr;
        int r = 0;
        const char *profile_name = switch_channel_get_variable_dup(channel, "recovery_profile_name", SWITCH_FALSE, -1);
-       
+
 
        if (zstr(profile_name)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Missing profile\n");
@@ -1923,14 +1923,14 @@ int sofia_recover_callback(switch_core_session_t *session)
                int te = atoi(tmp);
                if (te > 64) {
                        tech_pvt->te = (switch_payload_t)te;
-               } 
+               }
        }
 
        if ((tmp = switch_channel_get_variable(tech_pvt->channel, "rtp_2833_recv_payload"))) {
                int te = atoi(tmp);
                if (te > 64) {
                        tech_pvt->recv_te = (switch_payload_t)te;
-               } 
+               }
        }
 
        rr = switch_channel_get_variable(channel, "sip_invite_record_route");
@@ -1948,7 +1948,7 @@ int sofia_recover_callback(switch_core_session_t *session)
                if (zstr(rr)) {
                        switch_channel_set_variable_printf(channel, "sip_invite_route_uri", "<sip:%s@%s:%s;transport=%s>",
                                                                                           switch_channel_get_variable(channel, "sip_from_user"),
-                                                                                          switch_channel_get_variable(channel, "sip_network_ip"), 
+                                                                                          switch_channel_get_variable(channel, "sip_network_ip"),
                                                                                           switch_channel_get_variable(channel, "sip_network_port"),
                                                                                           switch_channel_get_variable(channel,"sip_via_protocol")
                                                                                           );
@@ -1975,7 +1975,7 @@ int sofia_recover_callback(switch_core_session_t *session)
        sofia_glue_attach_private(session, profile, tech_pvt, NULL);
        switch_channel_set_name(tech_pvt->channel, switch_channel_get_variable(channel, "channel_name"));
 
-       
+
        switch_channel_set_variable(channel, "sip_invite_call_id", switch_channel_get_variable(channel, "sip_call_id"));
 
        if (switch_true(switch_channel_get_variable(channel, "sip_nat_detected"))) {
@@ -2184,7 +2184,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
                "   expires           BIGINT\n"
                ");\n";
 
-       
+
        int x;
        char *indexes[] = {
                "create index sr_call_id on sip_registrations (call_id)",
@@ -2261,7 +2261,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
                "create index ssd_expires on sip_shared_appearance_dialogs (expires)",
                NULL
        };
-               
+
        switch_cache_db_handle_t *dbh = sofia_glue_get_db_handle(profile);
        char *test2;
        char *err;
@@ -2269,7 +2269,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
        if (!dbh) {
                return 0;
        }
-               
+
 
        test_sql = switch_mprintf("delete from sip_registrations where sub_host is null "
                                                          "and hostname='%q' "
@@ -2285,9 +2285,9 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
        switch_cache_db_test_reactive(dbh, "select ping_expires from sip_registrations", NULL, "alter table sip_registrations add column ping_expires INTEGER not null default 0");
        switch_cache_db_test_reactive(dbh, "select ping_time from sip_registrations", NULL, "alter table sip_registrations add column ping_time BIGINT not null default 0");
        switch_cache_db_test_reactive(dbh, "select force_ping from sip_registrations", NULL, "alter table sip_registrations add column force_ping INTEGER not null default 0");
-       
+
        test2 = switch_mprintf("%s;%s", test_sql, test_sql);
-                       
+
        if (switch_cache_db_execute_sql(dbh, test2, &err) != SWITCH_STATUS_SUCCESS) {
 
                if (switch_stristr("read-only", err)) {
@@ -2295,7 +2295,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "GREAT SCOTT!!! Cannot execute batched statements! [%s]\n"
                                                          "If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS\n", err);
-                       
+
                        switch_cache_db_release_db_handle(&dbh);
                        free(test2);
                        free(test_sql);
@@ -2310,7 +2310,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
        free(test_sql);
 
        test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and full_to='XXX'", mod_sofia_globals.hostname);
-                                                         
+
        switch_cache_db_test_reactive(dbh, test_sql, "DROP TABLE sip_subscriptions", sub_sql);
 
        free(test_sql);
@@ -2319,7 +2319,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
 
 
        switch_cache_db_test_reactive(dbh, test_sql, "DROP TABLE sip_dialogs", dialog_sql);
-               
+
        free(test_sql);
        test_sql = switch_mprintf("delete from sip_presence where hostname='%q' or open_closed=''", mod_sofia_globals.hostname);
 
@@ -2341,7 +2341,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
                                                          mod_sofia_globals.hostname);
 
        switch_cache_db_test_reactive(dbh, test_sql, "DROP TABLE sip_shared_appearance_dialogs", shared_appearance_dialogs_sql);
-               
+
        free(test_sql);
 
        for (x = 0; indexes[x]; x++) {
@@ -2359,7 +2359,7 @@ void sofia_glue_execute_sql(sofia_profile_t *profile, char **sqlp, switch_bool_t
        char *sql;
 
        switch_assert(sqlp && *sqlp);
-       sql = *sqlp;    
+       sql = *sqlp;
 
        switch_sql_queue_manager_push(profile->qm, sql, 1, !sql_already_dynamic);
 
@@ -2374,7 +2374,7 @@ void sofia_glue_execute_sql_now(sofia_profile_t *profile, char **sqlp, switch_bo
        char *sql;
 
        switch_assert(sqlp && *sqlp);
-       sql = *sqlp;    
+       sql = *sqlp;
 
        switch_mutex_lock(profile->dbh_mutex);
        switch_sql_queue_manager_push_confirm(profile->qm, sql, 0, !sql_already_dynamic);
@@ -2390,7 +2390,7 @@ void sofia_glue_execute_sql_soon(sofia_profile_t *profile, char **sqlp, switch_b
        char *sql;
 
        switch_assert(sqlp && *sqlp);
-       sql = *sqlp;    
+       sql = *sqlp;
 
        switch_sql_queue_manager_push(profile->qm, sql, 0, !sql_already_dynamic);
 
@@ -2404,7 +2404,7 @@ switch_cache_db_handle_t *_sofia_glue_get_db_handle(sofia_profile_t *profile, co
 {
        switch_cache_db_handle_t *dbh = NULL;
        char *dsn;
-       
+
        if (!zstr(profile->odbc_dsn)) {
                dsn = profile->odbc_dsn;
        } else {
@@ -2414,7 +2414,7 @@ switch_cache_db_handle_t *_sofia_glue_get_db_handle(sofia_profile_t *profile, co
        if (_switch_cache_db_get_db_handle_dsn(&dbh, dsn, file, func, line) != SWITCH_STATUS_SUCCESS) {
                dbh = NULL;
        }
-       
+
        return dbh;
 }
 
@@ -2535,7 +2535,7 @@ char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex
                if (mutex) {
                        switch_mutex_unlock(mutex);
                }
-               
+
                return NULL;
        }
 
@@ -2576,11 +2576,11 @@ char *sofia_glue_get_register_host(const char *uri)
        }
 
        register_host = strdup(s);
-       
-       /* remove port for register_host for testing nat acl take into account 
-          ipv6 addresses which are required to have brackets around the addr 
+
+       /* remove port for register_host for testing nat acl take into account
+          ipv6 addresses which are required to have brackets around the addr
        */
-       
+
        if ((p = strchr(register_host, ']'))) {
                if (*(p + 1) == ':') {
                        *(p + 1) = '\0';
@@ -2590,7 +2590,7 @@ char *sofia_glue_get_register_host(const char *uri)
                        *p = '\0';
                }
        }
-       
+
        /* register_proxy should always start with "sip:" or "sips:" */
        assert(register_host);
 
@@ -2751,12 +2751,12 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
                        user_via = sofia_glue_create_external_via(NULL, profile, transport);
                } else {
                        user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP);
-                       contact_str = profile->public_url;              
+                       contact_str = profile->public_url;
                }
        } else {
                id = switch_mprintf("sip:%s@%s", user, host);
                switch_assert(id);
-               
+
                if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) {
                        sofia_transport_t transport = sofia_glue_str2transport( ptr + 10 );
 
@@ -2818,7 +2818,7 @@ int sofia_glue_tech_simplify(private_object_t *tech_pvt)
                goto end;
        }
 
-       if (switch_channel_test_flag(tech_pvt->channel, CF_BRIDGED) && 
+       if (switch_channel_test_flag(tech_pvt->channel, CF_BRIDGED) &&
                (uuid = switch_channel_get_partner_uuid(tech_pvt->channel)) && (other_session = switch_core_session_locate(uuid))) {
 
                other_channel = switch_core_session_get_channel(other_session);
@@ -2846,10 +2846,10 @@ int sofia_glue_tech_simplify(private_object_t *tech_pvt)
                                        && strcmp(network_addr_a, switch_str_nil(tech_pvt->profile->extsipip))) {
 
                                        switch_core_session_message_t *msg;
-                                       
+
                                        switch_log_printf(SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, switch_channel_get_uuid(inbound_channel),
                                                                          SWITCH_LOG_NOTICE, "Will simplify channel [%s]\n", switch_channel_get_name(inbound_channel));
-                                       
+
                                        msg = switch_core_session_alloc(inbound_session, sizeof(*msg));
                                        MESSAGE_STAMP_FFL(msg);
                                        msg->message_id = SWITCH_MESSAGE_INDICATE_SIMPLIFY;
@@ -2861,7 +2861,7 @@ int sofia_glue_tech_simplify(private_object_t *tech_pvt)
                                        switch_core_recovery_track(inbound_session);
 
                                        switch_channel_set_flag(inbound_channel, CF_SIMPLIFY);
-                                       
+
                                }
                        }
 
@@ -2932,7 +2932,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
        }
 
        sofia_glue_get_addr(de->data->e_msg, np->network_ip, sizeof(np->network_ip), &np->network_port);
-       
+
        if (sofia_glue_check_nat(profile, np->network_ip)) {
                np->is_auto_nat = 1;
        }
@@ -3028,7 +3028,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
                if ((tp = switch_stristr("transport=", full_contact_dup))) {
                        tp += 10;
                }
-               
+
                if (zstr(tp)) {
                        tp = "udp";
                }
@@ -3039,7 +3039,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
                switch_zmalloc(path_encoded, path_encoded_len);
                switch_copy_string(path_encoded, ";fs_path=", 10);
                switch_url_encode(path_val, path_encoded + 9, path_encoded_len - 9);
-               
+
                contact_str = switch_mprintf("%s <%s;fs_nat=yes%s>", display, full_contact_dup, path_encoded);
 
                free(full_contact_dup);
@@ -3051,20 +3051,20 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
                if (zstr(contact_host)) {
                        np->is_nat = "No contact host";
                }
-               
+
                if (np->is_nat) {
                        contact_host = np->network_ip;
                        switch_snprintf(new_port, sizeof(new_port), ":%d", np->network_port);
                        port = NULL;
                }
-               
-               
+
+
                if (port) {
                        switch_snprintf(new_port, sizeof(new_port), ":%s", port);
                }
-               
+
                ipv6 = strchr(contact_host, ':');
-               
+
 
                if (contact->m_url->url_params) {
                        contact_str = switch_mprintf("%s <sip:%s%s%s%s%s%s;%s>%s",
@@ -3080,7 +3080,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
                                                                                 ipv6 ? "[" : "", contact_host, ipv6 ? "]" : "", new_port, np->is_nat ? ";fs_nat=yes" : "");
                }
        }
-               
+
        return contact_str;
 }
 
@@ -3137,7 +3137,7 @@ void sofia_glue_clear_soa(switch_core_session_t *session, switch_bool_t partner)
        if (partner && switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
                if (switch_core_session_compare(session, other_session)) {
                        struct private_object *other_tech_pvt = switch_core_session_get_private(other_session);
-                       
+
                        sofia_clear_flag(other_tech_pvt, TFLAG_ENABLE_SOA);
                }
                switch_core_session_rwunlock(other_session);
index 7cb9572c7cfb6f5c1e015f9d0f56e559baa8425a..a5923dda321fe01bd05f3d4e9a54256872ff4ec8 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -107,7 +107,7 @@ static void process_mp(switch_core_session_t *session, switch_stream_handle_t *s
                        stream->write_function(stream, "--%s\r\nContent-Type: %s\r\nContent-Length: %d\r\n%s\r\n", boundary, dname, strlen(dval), dval + 1);
                } else {
                        stream->write_function(stream, "--%s\r\nContent-Type: %s\r\nContent-Length: %d\r\n\r\n%s\r\n", boundary, dname, strlen(dval) + 1, dval);
-               }                                                       
+               }
        }
 }
 
index 6100766b41d676a72e84a1c075d6e1d084372c07..244c8909208c49485c475a668afe4e98fce33c60 100644 (file)
@@ -709,7 +709,7 @@ static void do_normal_probe(switch_event_t *event)
                probe_euser = (p + 1);
        }
 
-       if (probe_euser && probe_host && 
+       if (probe_euser && probe_host &&
                ((profile = sofia_glue_find_profile(probe_host)) || (profile_name && (profile = sofia_glue_find_profile(profile_name))))) {
                sql = switch_mprintf("select state,status,rpid,presence_id,uuid from sip_dialogs "
                                                         "where hostname='%q' and profile_name='%q' and call_info_state != 'seized' and "
@@ -856,7 +856,7 @@ static void do_dialog_probe(switch_event_t *event)
                if (!profile && profile_name) {
                        profile = sofia_glue_find_profile(profile_name);
                }
-               
+
                if (!profile) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot find profile for domain %s\n", probe_host);
                        goto end;
@@ -2237,7 +2237,7 @@ static void _send_presence_notify(sofia_profile_t *profile,
 
        if (!zstr(remote_ip) && sofia_glue_check_nat(profile, remote_ip)) {
                sofia_transport_t transport = sofia_glue_str2transport(tp);
-               
+
                switch (transport) {
                case SOFIA_TRANSPORT_TCP:
                        contact_str = profile->tcp_public_contact;
@@ -2700,7 +2700,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
                                break;
                        }
                } else {
-                       contact_str = profile->public_url;              
+                       contact_str = profile->public_url;
                }
        } else {
                char *ptr;
@@ -3207,7 +3207,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
                        prpid = rpid = dialog_rpid;
                }
 
-               contact_stripped = sofia_glue_strip_uri(contact_str); 
+               contact_stripped = sofia_glue_strip_uri(contact_str);
                pl = gen_pidf(user_agent, clean_id, contact_stripped, open, rpid, prpid, status, &ct);
                free(contact_stripped);
        }
@@ -3908,7 +3908,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
                char *contact = contact_str;
 
                sstr = switch_mprintf("active;expires=%ld", exp_delta);
-               
+
                if (strstr(buf, "fs_path=") && !strstr(contact_str, "fs_path=")) {
                        char *e = strchr(buf,';');
                        size_t l = e ? e-buf : strlen(buf);
@@ -3921,9 +3921,9 @@ void sofia_presence_handle_sip_i_subscribe(int status,
                                                         "set expires=%ld, "
                                                         "network_ip='%q',network_port='%d',sip_user='%q',sip_host='%q',full_via='%q',full_to='%q',full_from='%q',contact='%q' "
                                                         "where call_id='%q' and profile_name='%q' and hostname='%q'",
-                                                        (long) switch_epoch_time_now(NULL) + exp_delta, 
+                                                        (long) switch_epoch_time_now(NULL) + exp_delta,
                                                         np.network_ip, np.network_port, from_user, from_host, full_via, full_to, full_from, contact,
-                                                        
+
                                                         call_id, profile->name, mod_sofia_globals.hostname);
 
                if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
@@ -4510,7 +4510,7 @@ void sofia_presence_handle_sip_r_subscribe(int status,
                if (!sofia_private) {
                        nua_handle_destroy(nh);
                }
-               
+
                break;
        }
 
@@ -4911,17 +4911,17 @@ void sofia_presence_handle_sip_i_message(int status,
                                } else {
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "text/plain");
                                }
-                               
+
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", full_from);
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sip_profile", profile->name);
-                               
+
 
                                if (sip->sip_call_info) {
                                        sip_call_info_t *call_info = sip->sip_call_info;
                                        char *ci = sip_header_as_string(nua_handle_home(nh), (void *) call_info);
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sip_call_info", ci);
                                }
-                               
+
                                /* Loop thru unknown Headers Here so we can do something with them */
                                for (un = sip->sip_unknown; un; un = un->un_next) {
                                        if (!strncasecmp(un->un_name, "Diversion", 9)) {
@@ -4980,7 +4980,7 @@ void sofia_presence_handle_sip_i_message(int status,
                                                }
                                        }
                                }
-                               
+
                                if (msg) {
                                        switch_event_add_body(event, "%s", msg);
                                }
index b135c5f7dc168a356fa626c059447a0c36689eb8..4dd30ddb6784f5c709f7ad03cae76d00b36b42e1 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Ken Rice, <krice at freeswitch.org>  (work sponsored by Comet Signaling LLC, CopperCom, Inc and Asteria Solutions Group, Inc)
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -65,34 +65,34 @@ static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach)
 }
 
 static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr)
-{      
+{
        sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway;
        char *user_via = NULL;
        char *register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy);
        int ss_state = nua_callstate_authenticating;
-       
-       
+
+
        /* check for NAT and place a Via header if necessary (hostname or non-local IP) */
        if (register_host && sofia_glue_check_nat(gateway_ptr->profile, register_host)) {
                user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport);
        }
-               
+
        if (gw_sub_ptr->nh) {
                nua_handle_bind(gw_sub_ptr->nh, NULL);
                nua_handle_destroy(gw_sub_ptr->nh);
                gw_sub_ptr->nh = NULL;
                sofia_private_free(gw_sub_ptr->sofia_private);
        }
-               
+
        gw_sub_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
-                                                                        NUTAG_URL(gateway_ptr->register_proxy),                                                                         
+                                                                        NUTAG_URL(gateway_ptr->register_proxy),
                                                                         TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
                                                                         SIPTAG_TO_STR(gateway_ptr->register_to),
                                                                         NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
        if (!gw_sub_ptr->sofia_private) {
                switch_zmalloc(gw_sub_ptr->sofia_private, sizeof(*gw_sub_ptr->sofia_private));
        }
-       
+
        switch_set_string(gw_sub_ptr->sofia_private->gateway_name, gateway_ptr->name);
        nua_handle_bind(gw_sub_ptr->nh, gw_sub_ptr->sofia_private);
 
@@ -101,7 +101,7 @@ static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr)
 }
 
 static void sofia_reg_kill_sub(sofia_gateway_subscription_t *gw_sub_ptr)
-{      
+{
        sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway;
 
        sofia_private_free(gw_sub_ptr->sofia_private);
@@ -109,7 +109,7 @@ static void sofia_reg_kill_sub(sofia_gateway_subscription_t *gw_sub_ptr)
        if (gw_sub_ptr->nh) {
                nua_handle_bind(gw_sub_ptr->nh, NULL);
        }
-       
+
        if (gw_sub_ptr->state != SUB_STATE_SUBED && gw_sub_ptr->state != SUB_STATE_UNSUBSCRIBE) {
                if (gw_sub_ptr->nh) {
                        nua_handle_destroy(gw_sub_ptr->nh);
@@ -198,7 +198,7 @@ void sofia_reg_unregister(sofia_profile_t *profile)
                }
 
                for (gw_sub_ptr = gateway_ptr->subscriptions; gw_sub_ptr; gw_sub_ptr = gw_sub_ptr->next) {
-                       
+
                        if (gw_sub_ptr->state == SUB_STATE_SUBED) {
                                sofia_reg_kill_sub(gw_sub_ptr);
                        }
@@ -246,12 +246,12 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
                        case SUB_STATE_UNSUBED:
 
                                sofia_reg_new_sub_handle(gw_sub_ptr);
-                               
+
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name);
-                               
+
                                if (now) {
                                        nua_subscribe(gw_sub_ptr->nh,
-                                                                 NUTAG_URL(gw_sub_ptr->request_uri),                                                             
+                                                                 NUTAG_URL(gw_sub_ptr->request_uri),
                                                                  SIPTAG_EVENT_STR(gw_sub_ptr->event),
                                                                  TAG_IF(strcmp(gw_sub_ptr->content_type, "NO_CONTENT_TYPE"), SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type)),
                                                                  SIPTAG_TO_STR(gateway_ptr->register_from),
@@ -261,7 +261,7 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
                                                                  TAG_NULL());
                                        gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds;
                                } else {
-                                       nua_unsubscribe(gw_sub_ptr->nh,                                                                 
+                                       nua_unsubscribe(gw_sub_ptr->nh,
                                                                        NUTAG_URL(gw_sub_ptr->request_uri),
                                                                        SIPTAG_EVENT_STR(gw_sub_ptr->event),
                                                                        TAG_IF(strcmp(gw_sub_ptr->content_type, "NO_CONTENT_TYPE"), SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type)),
@@ -317,7 +317,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
                                switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->name);
                                free(pkey);
                        }
-                       
+
                        if (gateway_ptr->state == REG_STATE_NOREG) {
 
                                if (last) {
@@ -325,7 +325,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
                                } else {
                                        profile->gateways = gateway_ptr->next;
                                }
-                       
+
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleted gateway %s\n", gateway_ptr->name);
                                if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_GATEWAY_DEL) == SWITCH_STATUS_SUCCESS) {
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "profile-name", gateway_ptr->profile->name);
@@ -414,7 +414,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
                        if (delta < 1) {
                                delta = 1;
                        }
-                       
+
                        gateway_ptr->expires = now + delta;
 
                        gateway_ptr->state = REG_STATE_REGED;
@@ -480,7 +480,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
                case REG_STATE_TIMEOUT:
                        {
                                nua_handle_t *nh = gateway_ptr->nh;
-                               
+
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timeout Registering %s\n", gateway_ptr->name);
 
                                gateway_ptr->nh = NULL;
@@ -611,7 +611,7 @@ int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames
 
        dst = sofia_glue_get_destination(argv[3]);
        switch_assert(dst);
-       
+
        nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(dst->contact), SIPTAG_CONTACT_STR(profile->url),
                                        SIPTAG_CALL_ID_STR(call_id), TAG_END());
 
@@ -623,7 +623,7 @@ int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames
        pvt->ping_sent = switch_time_now();
        nua_handle_bind(nh, pvt);
 
-       nua_options(nh, 
+       nua_options(nh,
                                NTATAG_SIP_T2(5000),
                                NTATAG_SIP_T4(10000),
                                TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), TAG_END());
@@ -811,7 +811,7 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
                sql = switch_mprintf("delete from sip_registrations where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
        }
        sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
-       
+
 
 
 
@@ -863,7 +863,7 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
 
 long sofia_reg_uniform_distribution(int max)
 {
-/* 
+/*
  * Generate a random number following a uniform distribution between 0 and max
  */
        int result;
@@ -892,7 +892,7 @@ void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int inter
                                                                 "profile_name='%q' and orig_hostname='%q' and "
                                                                 "ping_expires > 0 and ping_expires <= %ld",
                                                                 mod_sofia_globals.hostname, profile->name, mod_sofia_globals.hostname, (long) now);
-                       
+
                        sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
                        switch_safe_free(sql);
                } else if (sofia_test_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING)) {
@@ -901,7 +901,7 @@ void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int inter
                                                                 " from sip_registrations where (status like '%%UDP-NAT%%' or force_ping=1)"
                                                                 " and hostname='%q' and profile_name='%q' and ping_expires > 0 and ping_expires <= %ld ",
                                                                 mod_sofia_globals.hostname, profile->name, (long) now);
-                       
+
                        sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
                        switch_safe_free(sql);
                } else if (sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) {
@@ -912,7 +912,7 @@ void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int inter
                                                                 "and profile_name='%q' and orig_hostname='%q' and "
                                                                 "ping_expires > 0 and ping_expires <= %ld",
                                                                 mod_sofia_globals.hostname, profile->name, mod_sofia_globals.hostname, (long) now);
-                       
+
                        sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
                        switch_safe_free(sql);
                } else {
@@ -1017,7 +1017,7 @@ void sofia_reg_check_sync(sofia_profile_t *profile)
 
        sql = switch_mprintf("delete from sip_authentication where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
        sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
-       
+
        sql = switch_mprintf("delete from sip_subscriptions where expires >= -1 and hostname='%q'", mod_sofia_globals.hostname);
        sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
 
@@ -1082,7 +1082,7 @@ switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *p
 
 
        sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_find_callback, &cbt);
-       
+
        switch_safe_free(sql);
 
        return cbt.list;
@@ -1145,8 +1145,8 @@ void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_
        if (regtype == REG_REGISTER) {
                nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
        } else if (regtype == REG_INVITE) {
-               nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, 
-                                       TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)), 
+               nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED,
+                                       TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)),
                                        SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
        }
 
@@ -1157,13 +1157,13 @@ uint32_t sofia_reg_reg_count(sofia_profile_t *profile, const char *user, const c
 {
        char buf[32] = "";
        char *sql;
-       
+
        sql = switch_mprintf("select count(*) from sip_registrations where profile_name='%q' and "
                                                 "sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", profile->name, user, host, host);
-       
+
        sofia_glue_execute_sql2str(profile, profile->dbh_mutex, sql, buf, sizeof(buf));
        switch_safe_free(sql);
-       return atoi(buf);                                                                                                       
+       return atoi(buf);
 }
 
 static int debounce_check(sofia_profile_t *profile, const char *user, const char *host)
@@ -1295,7 +1295,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
        } else {
                uparams = NULL;
        }
-       
+
 
        if (sip && sip->sip_via && (vproto = sip->sip_via->v_protocol)) {
                if (!strcasecmp(vproto, "sip/2.0/ws")) {
@@ -1360,7 +1360,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
        }
 
        if (!to_user || !to_host) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete header in REGISTER request from %s:%d\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete header in REGISTER request from %s:%d\n",
                                                  network_ip, network_port);
 
                nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
@@ -1599,7 +1599,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                                avoid_multi_reg = 1;
                        }
 
-                       /* Allow us to force the SIP user to be something specific - needed if 
+                       /* Allow us to force the SIP user to be something specific - needed if
                         * we - for example - want to be able to ensure that the username a UA can
                         * be contacted at is the same one that they used for authentication.
                         */
@@ -1735,7 +1735,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                        /* Log line added to support Fail2Ban */
                        if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth %s (%s) on sofia profile '%s' "
-                                                                 "for [%s@%s] from ip %s\n", forbidden ? "failure" : "challenge", 
+                                                                 "for [%s@%s] from ip %s\n", forbidden ? "failure" : "challenge",
                                                                  (regtype == REG_INVITE) ? "INVITE" : "REGISTER", profile->name, to_user, to_host, network_ip);
                        }
 
@@ -1790,7 +1790,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                /* Log line added to support Fail2Ban */
                if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth challenge (%s) on sofia profile '%s' "
-                                                         "for [%s@%s] from ip %s\n", (regtype == REG_INVITE) ? "INVITE" : "REGISTER", 
+                                                         "for [%s@%s] from ip %s\n", (regtype == REG_INVITE) ? "INVITE" : "REGISTER",
                                                          profile->name, to_user, to_host, network_ip);
                }
 
@@ -1899,8 +1899,8 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                } else {
                        char buf[32] = "";
 
-                       
-                       sql = switch_mprintf("select count(*) from sip_registrations where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'", 
+
+                       sql = switch_mprintf("select count(*) from sip_registrations where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'",
                                                                 to_user, username, reg_host, contact_str);
 
 
@@ -1916,13 +1916,13 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
 
                contact = sofia_glue_get_url_from_contact(contact_str, 1);
                url = switch_mprintf("sofia/%q/%s:%q", profile->name, proto, sofia_glue_strip_proto(contact));
-               
+
                switch_core_add_registration(to_user, reg_host, call_id, url, (long) reg_time + (long) exptime + profile->sip_expires_late_margin,
                                                                         network_ip, network_port_c, is_tls ? "tls" : is_tcp ? "tcp" : "udp", reg_meta);
 
                switch_safe_free(url);
                switch_safe_free(contact);
-               
+
                if ((is_wss || is_ws || (sofia_test_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE) && (is_tcp || is_tls))) && !sofia_private && call_id) {
                        char key[256] = "";
                        nua_handle_t *hnh;
@@ -1952,7 +1952,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                                switch_core_hash_insert(profile->reg_nh_hash, key, nh);
                        }
                }
-               
+
 
                if (!update_registration) {
                        sql = switch_mprintf("insert into sip_registrations "
@@ -1960,9 +1960,9 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                                        "user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm,"
                                        "mwi_user,mwi_host, orig_server_host, orig_hostname, sub_host, ping_status, ping_count, force_ping) "
                                        "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q','%q', '%q', %d, %d)",
-                                       call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : "", 
+                                       call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : "",
                                        contact_str, reg_desc, rpid, (long) reg_time + (long) exptime + profile->sip_expires_late_margin,
-                                       agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm, 
+                                       agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm,
                                                                 mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host, "Reachable", 0, force_ping);
                } else {
                        sql = switch_mprintf("update sip_registrations set call_id='%q',"
@@ -1975,14 +1975,14 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                                                                  mod_sofia_globals.hostname, mod_sofia_globals.hostname,
                                                                 (long) reg_time + (long) exptime + profile->sip_expires_late_margin, force_ping,
                                                                 to_user, username, reg_host, contact_str);
-               }                                
+               }
 
                if (sql) {
                        sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
                }
 
                if (!update_registration && sofia_reg_reg_count(profile, to_user, reg_host) == 1) {
-                       sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' and profile_name='%q' and open_closed='closed'", 
+                       sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' and profile_name='%q' and open_closed='closed'",
                                                                 to_user, reg_host, profile->name);
                        if (mod_sofia_globals.debug_presence > 0) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DELETE PRESENCE SQL: %s\n", sql);
@@ -1996,7 +1996,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                        } else {
                                sql = switch_mprintf("delete from sip_registrations where call_id='%q' and expires!=%ld", call_id, (long) reg_time + (long) exptime + profile->sip_expires_late_margin);
                        }
-                       
+
                        sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
                }
 
@@ -2055,7 +2055,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
                        switch_event_fire(&event);
                }
-               
+
 
                if (multi_reg) {
                        char *icontact, *p;
@@ -2073,7 +2073,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                        } else {
                                sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
                        }
-       
+
                        sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
 
                        switch_safe_free(icontact);
@@ -2115,10 +2115,10 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                                        }
                                }
 
-                               if ((sofia_test_pflag(profile, PFLAG_PRESENCE_ON_REGISTER) || 
-                                       (reg_count == 1 && sofia_test_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER)) 
+                               if ((sofia_test_pflag(profile, PFLAG_PRESENCE_ON_REGISTER) ||
+                                       (reg_count == 1 && sofia_test_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER))
                                         || send_pres == 1 || (reg_count == 1 && send_pres == 2)) && debounce_ok) {
-                               
+
                                        if (sofia_test_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER)) {
                                                if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
                                                        switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
@@ -2139,7 +2139,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                                                        switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
                                                        switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered");
                                                        switch_event_fire(&s_event);
-                                               }               
+                                               }
                                        }
                                }
                        } else {
@@ -2185,7 +2185,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                        nua_respond(nh, SIP_200_OK, TAG_IF(contact, SIPTAG_CONTACT(sip->sip_contact)), TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
                                                TAG_IF(!zstr(expbuf), SIPTAG_EXPIRES_STR(expbuf)),
                                                NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_DATE_STR(date), TAG_END());
+
                } else if ((contact_list = sofia_reg_find_reg_url_with_positive_expires_multi(profile, from_user, reg_host, reg_time, contact_str, exptime))) {
                        /* all + 1 tag_i elements initialized as NULL - last one implies TAG_END() */
                        switch_zmalloc(contact_tags, sizeof(*contact_tags) * (contact_list->count + 1));
@@ -2195,7 +2195,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
                                contact_tags[i].t_value = (tag_value_t) m->val;
                                ++i;
                        }
-                       
+
 
                        nua_respond(nh, SIP_200_OK, TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
                                                TAG_IF(!zstr(expbuf), SIPTAG_EXPIRES_STR(expbuf)),
@@ -2257,7 +2257,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h
        if (sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_host) {
                const char *to_host = sip->sip_to->a_url->url_host;
                if (profile->reg_db_domain) {
-                       if (!sofia_glue_profile_exists(to_host)) {                              
+                       if (!sofia_glue_profile_exists(to_host)) {
                                if (sofia_glue_add_profile(switch_core_strdup(profile->pool, to_host), profile) == SWITCH_STATUS_SUCCESS) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Auto-Adding Alias [%s] for profile [%s]\n", to_host, profile->name);
                                }
@@ -2367,7 +2367,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h
        }
 
   end:
-       
+
        if (!sofia_private_p || !*sofia_private_p) nua_handle_destroy(nh);
 
 }
@@ -2386,9 +2386,9 @@ void sofia_reg_handle_sip_r_register(int status,
                nua_handle_destroy(nh);
                return;
        }
-       
+
        if (sofia_private && !zstr(sofia_private->gateway_name)) {
-               gateway = sofia_reg_find_gateway(sofia_private->gateway_name); 
+               gateway = sofia_reg_find_gateway(sofia_private->gateway_name);
        }
 
        if (sofia_private && gateway) {
@@ -2424,7 +2424,7 @@ void sofia_reg_handle_sip_r_register(int status,
                                        if (expi > 0 && expi != gateway->freq) {
                                                //gateway->freq = expi;
                                                //gateway->expires_str = switch_core_sprintf(gateway->pool, "%d", expi);
-                                               
+
                                                if (expi > 60) {
                                                        gateway->expires = switch_epoch_time_now(NULL) + (expi - 15);
                                                } else {
@@ -2479,7 +2479,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
        const char *sip_auth_password = NULL;
        char *dup_user = NULL;
        char *dup_pass = NULL;
-       
+
        if (session && (channel = switch_core_session_get_channel(session))) {
                sip_auth_username = switch_channel_get_variable(channel, "sip_auth_username");
                sip_auth_password = switch_channel_get_variable(channel, "sip_auth_password");
@@ -2591,7 +2591,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
                                for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
                                        const char *var = switch_xml_attr_soft(x_param, "name");
                                        const char *val = switch_xml_attr_soft(x_param, "value");
-                                       
+
                                        if (!strcasecmp(var, "reverse-auth-user")) {
                                                dup_user = strdup(val);
                                                sip_auth_username = dup_user;
@@ -2613,7 +2613,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
        } else if (gateway) {
                switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->auth_username, gateway->register_password);
        } else {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
                                                  "Cannot locate any authentication credentials to complete an authentication request for realm '%s'\n", realm);
                goto cancel;
        }
@@ -2627,8 +2627,8 @@ void sofia_reg_handle_sip_r_challenge(int status,
 
        tl_gets(tags, NUTAG_CALLSTATE_REF(ss_state), SIPTAG_WWW_AUTHENTICATE_REF(authenticate), TAG_END());
 
-       nua_authenticate(nh, 
-                                        TAG_IF(sofia_private && !zstr(sofia_private->gateway_name), SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")), 
+       nua_authenticate(nh,
+                                        TAG_IF(sofia_private && !zstr(sofia_private->gateway_name), SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")),
                                         NUTAG_AUTH(authentication), TAG_END());
 
        goto end;
@@ -3025,7 +3025,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
                ret = AUTH_FORBIDDEN;
                goto end;
        }
-       
+
        if (zstr(passwd) && zstr(a1_hash)) {
                ret = AUTH_OK;
                goto skip_auth;
@@ -3343,7 +3343,7 @@ switch_status_t sofia_reg_gateway_rdlock__(const char *file, const char *func, i
 
 #ifdef SOFIA_DEBUG_RWLOCKS
        if (status == SWITCH_STATUS_SUCCESS) {
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "XXXXXXXXXXXXXX GW LOCK %s\n", gateway->profile->name);            
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "XXXXXXXXXXXXXX GW LOCK %s\n", gateway->profile->name);
        }
 #endif
 
@@ -3369,7 +3369,7 @@ switch_status_t sofia_reg_add_gateway(sofia_profile_t *profile, const char *key,
 
        gateway->next = profile->gateways;
        profile->gateways = gateway;
-       
+
        switch_mutex_unlock(profile->gw_mutex);
 
        switch_mutex_lock(mod_sofia_globals.hash_mutex);
index f8a3f4baef6cefcf419d5da85abbff96d299a1c2..92dee3f2cf8e42901a9aaa8a78c45365843f2b52 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005/2012, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Steve Underwood 0.0.1 <steveu@coppice.org>
  *
@@ -831,7 +831,7 @@ static void tech_init(private_t *tech_pvt, switch_core_session_t *session)
        tech_pvt->session = session;
 }
 
-/* 
+/*
    State methods. They get called when the state changes to the specified state.
    Returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next,
    so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
index 984d1d4f226a6b92066c8e8fba6513253092bd61..fcb303587282e57c5fa33dfa8fcd7bc137573bcc 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2011, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -63,11 +63,11 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
        int family = AF_INET;
 
        memset(handle, 0, sizeof(*handle));
-       
-       if (strchr(host, ':')) { 
+
+       if (strchr(host, ':')) {
                family = AF_INET6;
        }
-       
+
        if ((!(flags & MCAST_SEND) && !(flags & MCAST_RECV)) || (handle->sock = (mcast_socket_t)socket(family, SOCK_DGRAM, 0)) == mcast_sock_invalid ) {
                return -1;
        }
@@ -83,17 +83,17 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
                handle->send_addr.sin_port = htons(port);
                handle->family = AF_INET;
        }
-       
+
        if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)) != 0 ) {
                mcast_socket_close(handle);
                return -1;
        }
-       
+
 
        if ((flags & MCAST_RECV)) {
                if (handle->family == AF_INET) {
                        struct ip_mreq mreq;
-                       
+
                        handle->recv_addr.sin_family = AF_INET;
                        handle->recv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
                        handle->recv_addr.sin_port = htons(port);
@@ -116,24 +116,24 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
                        struct addrinfo addr_criteria;
                        struct addrinfo *mcast_addr;
                        char service[80] = "";
-                       
+
                        memset(&addr_criteria, 0, sizeof(addr_criteria));
                        addr_criteria.ai_family = AF_UNSPEC;
                        addr_criteria.ai_socktype = SOCK_DGRAM;
                        addr_criteria.ai_protocol = IPPROTO_UDP;
                        addr_criteria.ai_flags |= AI_NUMERICHOST;
-                       
+
                        snprintf(service, sizeof(service), "%d", port);
                        getaddrinfo(host, service, &addr_criteria, &mcast_addr);
 
-                       
+
                        memset(&handle->recv_addr6, 0, sizeof(handle->recv_addr6));
                        handle->recv_addr6.sin6_family = AF_INET6;
                        handle->recv_addr6.sin6_port = htons(port);
                        inet_pton(AF_INET6, "::0", &(handle->recv_addr6.sin6_addr));
 
                        memcpy(&mreq.ipv6mr_multiaddr, &((struct sockaddr_in6 *)mcast_addr->ai_addr)->sin6_addr,  sizeof(struct in6_addr));
-                                                                                        
+
                        mreq.ipv6mr_interface = 0;
                        setsockopt(handle->sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, (const char *)&mreq, sizeof(mreq));
 
@@ -165,7 +165,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
        if ((flags & MCAST_TTL_CONTINENT)) {
                handle->ttl = 128;
        }
-       
+
        if ((flags & MCAST_TTL_UNIVERSE)) {
                handle->ttl = 255;
        }
@@ -175,7 +175,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
        }
 
        handle->ready = 1;
-       
+
        return 0;
 }
 
index 2bc1dfa6d487819996cb92a61efe00703e666600..ace34fe7bc3d8346ae3982525452572995837835 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2011, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
index a2793fa8519bf7bddffbf671aa311f9edbd035ec..af3ddd6e8deedd506657fb634327051bdceb86fc 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2011, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -61,7 +61,7 @@ char *McastHandle::recv(int ms)
                *((char *)handle.buffer + r) = '\0';
                return (char *) handle.buffer;
        }
-       
+
        return NULL;
 }
 
index 07062162f221e64ef2e8cfa35432560f11b81966..1d744c970ddc5b28cca7c79c4e8cd6c957b9b620 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2011, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
index 4a928255354f19e5c8870d902781967959567be7..bae2665bb1b30f29436d2907f3b55c9271dc6e07 100644 (file)
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
  * Version 1.3.35
- * 
- * This file is not intended to be easily readable and contains a number of 
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGPERL
@@ -18,7 +18,7 @@ public:
     SwigValueWrapper() : tt(0) { }
     SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
     SwigValueWrapper(const T& t) : tt(new T(t)) { }
-    ~SwigValueWrapper() { delete tt; } 
+    ~SwigValueWrapper() { delete tt; }
     SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
     operator T&() const { return *tt; }
     T *operator&() { return tt; }
@@ -62,14 +62,14 @@ template <typename T> T SwigValueInit() {
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
@@ -77,7 +77,7 @@ template <typename T> T SwigValueInit() {
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
@@ -120,7 +120,7 @@ template <typename T> T SwigValueInit() {
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -158,7 +158,7 @@ template <typename T> T SwigValueInit() {
   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
   creating a static or dynamic library from the swig runtime code.
   In 99.9% of the cases, swig just needs to declare them as 'static'.
-  
+
   But only do this if is strictly necessary, ie, if you have problems
   with your compiler or so.
 */
@@ -184,16 +184,16 @@ template <typename T> T SwigValueInit() {
 #define SWIG_POINTER_OWN           0x1
 
 
-/* 
+/*
    Flags/methods for returning states.
-   
-   The swig conversion methods, as ConvertPtr, return and integer 
+
+   The swig conversion methods, as ConvertPtr, return and integer
    that tells if the conversion was successful or not. And if not,
    an error code can be returned (see swigerrors.swg for the codes).
-   
+
    Use the following macros/flags to set or process the returning
    states.
-   
+
    In old swig versions, you usually write code as:
 
      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
@@ -226,23 +226,23 @@ template <typename T> T SwigValueInit() {
     } else {
       // fail code
     }
-    
+
    I.e., now SWIG_ConvertPtr can return new objects and you can
    identify the case and take care of the deallocation. Of course that
    requires also to SWIG_ConvertPtr to return new result values, as
 
-      int SWIG_ConvertPtr(obj, ptr,...) {         
-        if (<obj is ok>) {                            
-          if (<need new object>) {                    
-            *ptr = <ptr to new allocated object>; 
-            return SWIG_NEWOBJ;                       
-          } else {                                    
-            *ptr = <ptr to old object>;               
-            return SWIG_OLDOBJ;                       
-          }                                   
-        } else {                                      
-          return SWIG_BADOBJ;                 
-        }                                             
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
       }
 
    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
@@ -256,7 +256,7 @@ template <typename T> T SwigValueInit() {
        int fooi(int);
 
    and you call
+
       food(1)   // cast rank '1'  (1 -> 1.0)
       fooi(1)   // cast rank '0'
 
@@ -264,10 +264,10 @@ template <typename T> T SwigValueInit() {
 
 
  */
-#define SWIG_OK                    (0) 
+#define SWIG_OK                    (0)
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -299,11 +299,11 @@ template <typename T> T SwigValueInit() {
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
 }
 #else /* no cast-rank mode */
 #  define SWIG_AddCast
@@ -352,7 +352,7 @@ typedef struct swig_module_info {
   void                    *clientdata;         /* Language specific module data */
 } swig_module_info;
 
-/* 
+/*
   Compare two type names skipping the space characters, therefore
   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
 
@@ -453,7 +453,7 @@ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
-/* 
+/*
    Dynamic pointer casting. Down an inheritance hierarchy
 */
 SWIGRUNTIME swig_type_info *
@@ -497,7 +497,7 @@ SWIG_TypePrettyName(const swig_type_info *type) {
     return type->name;
 }
 
-/* 
+/*
    Set the clientdata field for a type
 */
 SWIGRUNTIME void
@@ -505,14 +505,14 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
   swig_cast_info *cast = ti->cast;
   /* if (ti->clientdata == clientdata) return; */
   ti->clientdata = clientdata;
-  
+
   while (cast) {
     if (!cast->converter) {
       swig_type_info *tc = cast->type;
       if (!tc->clientdata) {
        SWIG_TypeClientData(tc, clientdata);
       }
-    }    
+    }
     cast = cast->next;
   }
 }
@@ -521,18 +521,18 @@ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
   SWIG_TypeClientData(ti, clientdata);
   ti->owndata = 1;
 }
-  
+
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
                            const char *name) {
   swig_module_info *iter = start;
   do {
@@ -541,11 +541,11 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
       register size_t r = iter->size - 1;
       do {
        /* since l+r >= 0, we can (>> 1) instead (/ 2) */
-       register size_t i = (l + r) >> 1; 
+       register size_t i = (l + r) >> 1;
        const char *iname = iter->types[i]->name;
        if (iname) {
          register int compare = strcmp(name, iname);
-         if (compare == 0) {       
+         if (compare == 0) {
            return iter->types[i];
          } else if (compare < 0) {
            if (i) {
@@ -570,14 +570,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
   Search for a swig_type_info structure for either a mangled name or a human readable name.
   It first searches the mangled names of the types, which is a O(log #types)
   If a type is not found it then searches the human readable names, which is O(#types).
-  
-  We start searching at module start, and finish searching when start == end.  
+
+  We start searching at module start, and finish searching when start == end.
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
 SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
                     const char *name) {
   /* STEP 1: Search the name field using binary search */
   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
@@ -596,12 +596,12 @@ SWIG_TypeQueryModule(swig_module_info *start,
       iter = iter->next;
     } while (iter != end);
   }
-  
+
   /* neither found a match */
   return 0;
 }
 
-/* 
+/*
    Pack binary data into a string
 */
 SWIGRUNTIME char *
@@ -617,7 +617,7 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
   return c;
 }
 
-/* 
+/*
    Unpack binary data from a string
 */
 SWIGRUNTIME const char *
@@ -631,21 +631,21 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
       uu = ((d - '0') << 4);
     else if ((d >= 'a') && (d <= 'f'))
       uu = ((d - ('a'-10)) << 4);
-    else 
+    else
       return (char *) 0;
     d = *(c++);
     if ((d >= '0') && (d <= '9'))
       uu |= (d - '0');
     else if ((d >= 'a') && (d <= 'f'))
       uu |= (d - ('a'-10));
-    else 
+    else
       return (char *) 0;
     *u = uu;
   }
   return c;
 }
 
-/* 
+/*
    Pack 'void *' into a string buffer.
 */
 SWIGRUNTIME char *
@@ -705,18 +705,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
 #endif
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError        -1 
-#define  SWIG_IOError             -2 
-#define  SWIG_RuntimeError        -3 
-#define  SWIG_IndexError          -4 
-#define  SWIG_TypeError           -5 
-#define  SWIG_DivisionByZero      -6 
-#define  SWIG_OverflowError       -7 
-#define  SWIG_SyntaxError         -8 
-#define  SWIG_ValueError          -9 
+#define  SWIG_UnknownError        -1
+#define  SWIG_IOError             -2
+#define  SWIG_RuntimeError        -3
+#define  SWIG_IndexError          -4
+#define  SWIG_TypeError           -5
+#define  SWIG_DivisionByZero      -6
+#define  SWIG_OverflowError       -7
+#define  SWIG_SyntaxError         -8
+#define  SWIG_ValueError          -9
 #define  SWIG_SystemError         -10
 #define  SWIG_AttributeError      -11
-#define  SWIG_MemoryError         -12 
+#define  SWIG_MemoryError         -12
 #define  SWIG_NullReferenceError   -13
 
 
@@ -817,7 +817,7 @@ extern "C" {
 
 #ifndef pTHX_
 #define pTHX_
-#endif   
+#endif
 
 #include <string.h>
 #ifdef __cplusplus
@@ -921,9 +921,9 @@ SWIG_Perl_ErrorType(int code) {
 
 /* Error manipulation */
 
-#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)
 #define SWIG_Error(code, msg)                          sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
-#define SWIG_fail                                      goto fail                                                   
+#define SWIG_fail                                      goto fail
 
 /* Perl-specific SWIG API */
 
@@ -961,15 +961,15 @@ extern "C" {
 #endif
 
 /* Macro to call an XS function */
-#ifdef PERL_OBJECT 
-#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
-#else 
-#  ifndef MULTIPLICITY 
-#    define SWIG_CALLXS(_name) _name(cv) 
-#  else 
-#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
-#  endif 
-#endif 
+#ifdef PERL_OBJECT
+#  define SWIG_CALLXS(_name) _name(cv,pPerl)
+#else
+#  ifndef MULTIPLICITY
+#    define SWIG_CALLXS(_name) _name(cv)
+#  else
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
+#  endif
+#endif
 
 #ifdef PERL_OBJECT
 #define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
@@ -1038,13 +1038,13 @@ static void SWIG_croak_null()
 #endif
 
 
-/* 
+/*
    Define how strict is the cast between strings and integers/doubles
    when overloading between these types occurs.
-   
+
    The default is making it as strict as possible by using SWIG_AddCast
    when needed.
-   
+
    You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
    disable the SWIG_AddCast, making the casting between string and
    numbers less strict.
@@ -1060,7 +1060,7 @@ static void SWIG_croak_null()
 #endif
 #ifdef SWIG_PERL_STRICT_STR2NUM
 /* string takes precedence */
-#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)
 #else
 /* number takes precedence */
 #define SWIG_Str2NumCast(x) x
@@ -1075,7 +1075,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) {
   if (!type) return NULL;
   if (type->clientdata != NULL) {
     return (const char*) type->clientdata;
-  } 
+  }
   else {
     return type->name;
   }
@@ -1083,7 +1083,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) {
 
 SWIGRUNTIME swig_cast_info *
 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0))
                            || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
 }
 
@@ -1150,11 +1150,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
     *ptr = voidptr;
   }
 
-  /* 
+  /*
    *  DISOWN implementation: we need a perl guru to check this one.
    */
   if (tsv && (flags & SWIG_POINTER_DISOWN)) {
-    /* 
+    /*
      *  almost copy paste code from below SWIG_POINTER_OWN setting
      */
     SV *obj = sv;
@@ -1163,7 +1163,7 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
     if (isGV(gv)) {
       HV *hv = GvHVn(gv);
       /*
-       * To set ownership (see below), a newSViv(1) entry is added. 
+       * To set ownership (see below), a newSViv(1) entry is added.
        * Hence, to remove ownership, we delete the entry.
        */
       if (hv_exists_ent(hv, obj, 0)) {
@@ -1292,13 +1292,13 @@ typedef struct {
 #ifndef PERL_OBJECT
 #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
   #ifndef MULTIPLICITY
-     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *))
   #else
-     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *))
   #endif
 #else
 #  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
-SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *))
 #endif
 {
   MAGIC *mg;
@@ -1438,9 +1438,9 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 
 
 
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
 
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
 
 
 
@@ -1460,12 +1460,12 @@ static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
 #define SWIG_name   "MCASTc::boot_MCAST"
 #define SWIG_prefix "MCASTc::"
 
-#define SWIGVERSION 0x010335 
+#define SWIGVERSION 0x010335
 #define SWIG_VERSION SWIGVERSION
 
 
-#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
 
 
 #include <stdexcept>
@@ -1507,7 +1507,7 @@ SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
 {
   if (SvPOK(obj)) {
     STRLEN len = 0;
-    char *cstr = SvPV(obj, len); 
+    char *cstr = SvPV(obj, len);
     size_t size = len + 1;
     if (cptr)  {
       if (alloc) {
@@ -1524,7 +1524,7 @@ SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
   } else {
     swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
     if (pchar_descriptor) {
-      char* vptr = 0; 
+      char* vptr = 0;
       if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
        if (cptr) *cptr = vptr;
        if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
@@ -1663,14 +1663,14 @@ SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
     } else {
       if (val) *val = static_cast< int >(v);
     }
-  }  
+  }
   return res;
 }
 
 
 SWIGINTERNINLINE SV *
 SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
-{    
+{
   SV *obj = sv_newmortal();
   sv_setiv(obj, (IV) value);
   return obj;
@@ -1679,7 +1679,7 @@ SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
 
 SWIGINTERNINLINE SV *
 SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
-{    
+{
   return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
 }
 
@@ -1697,9 +1697,9 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
 }
 
 
-SWIGINTERNINLINE SV * 
+SWIGINTERNINLINE SV *
 SWIG_FromCharPtr(const char *cptr)
-{ 
+{
   return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
 }
 
@@ -1747,7 +1747,7 @@ XS(_wrap_new_McastHandle) {
     int ecode3 = 0 ;
     int argvi = 0;
     dXSARGS;
-    
+
     if ((items < 3) || (items > 3)) {
       SWIG_croak("Usage: new_McastHandle(host,port,flags);");
     }
@@ -1759,23 +1759,23 @@ XS(_wrap_new_McastHandle) {
     ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
     if (!SWIG_IsOK(ecode2)) {
       SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_McastHandle" "', argument " "2"" of type '" "int""'");
-    } 
+    }
     arg2 = static_cast< int >(val2);
     ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
     if (!SWIG_IsOK(ecode3)) {
       SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_McastHandle" "', argument " "3"" of type '" "int""'");
-    } 
+    }
     arg3 = static_cast< int >(val3);
     result = (McastHandle *)new McastHandle((char const *)arg1,arg2,arg3);
     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_McastHandle, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
     if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    
-    
+
+
     XSRETURN(argvi);
   fail:
     if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-    
-    
+
+
     SWIG_croak_null();
   }
 }
@@ -1788,22 +1788,22 @@ XS(_wrap_delete_McastHandle) {
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
-    
+
     if ((items < 1) || (items > 1)) {
       SWIG_croak("Usage: delete_McastHandle(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_McastHandle, SWIG_POINTER_DISOWN |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_McastHandle" "', argument " "1"" of type '" "McastHandle *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_McastHandle" "', argument " "1"" of type '" "McastHandle *""'");
     }
     arg1 = reinterpret_cast< McastHandle * >(argp1);
     delete arg1;
-    
-    
-    
+
+
+
     XSRETURN(argvi);
   fail:
-    
+
     SWIG_croak_null();
   }
 }
@@ -1821,13 +1821,13 @@ XS(_wrap_McastHandle_send) {
     int alloc2 = 0 ;
     int argvi = 0;
     dXSARGS;
-    
+
     if ((items < 2) || (items > 2)) {
       SWIG_croak("Usage: McastHandle_send(self,data);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_McastHandle, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "McastHandle_send" "', argument " "1"" of type '" "McastHandle *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "McastHandle_send" "', argument " "1"" of type '" "McastHandle *""'");
     }
     arg1 = reinterpret_cast< McastHandle * >(argp1);
     res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
@@ -1837,11 +1837,11 @@ XS(_wrap_McastHandle_send) {
     arg2 = reinterpret_cast< char * >(buf2);
     result = (int)(arg1)->send((char const *)arg2);
     ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
+
     if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
     XSRETURN(argvi);
   fail:
-    
+
     if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
     SWIG_croak_null();
   }
@@ -1859,30 +1859,30 @@ XS(_wrap_McastHandle_recv) {
     int ecode2 = 0 ;
     int argvi = 0;
     dXSARGS;
-    
+
     if ((items < 1) || (items > 2)) {
       SWIG_croak("Usage: McastHandle_recv(self,ms);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_McastHandle, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "McastHandle_recv" "', argument " "1"" of type '" "McastHandle *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "McastHandle_recv" "', argument " "1"" of type '" "McastHandle *""'");
     }
     arg1 = reinterpret_cast< McastHandle * >(argp1);
     if (items > 1) {
       ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
       if (!SWIG_IsOK(ecode2)) {
         SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "McastHandle_recv" "', argument " "2"" of type '" "int""'");
-      } 
+      }
       arg2 = static_cast< int >(val2);
     }
     result = (char *)(arg1)->recv(arg2);
     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    
-    
+
+
     XSRETURN(argvi);
   fail:
-    
-    
+
+
     SWIG_croak_null();
   }
 }
@@ -1896,21 +1896,21 @@ XS(_wrap_McastHandle_filenum) {
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
-    
+
     if ((items < 1) || (items > 1)) {
       SWIG_croak("Usage: McastHandle_filenum(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_McastHandle, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "McastHandle_filenum" "', argument " "1"" of type '" "McastHandle *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "McastHandle_filenum" "', argument " "1"" of type '" "McastHandle *""'");
     }
     arg1 = reinterpret_cast< McastHandle * >(argp1);
     result = (int)(arg1)->filenum();
     ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-    
+
     XSRETURN(argvi);
   fail:
-    
+
     SWIG_croak_null();
   }
 }
@@ -1957,18 +1957,18 @@ static swig_command_info swig_commands[] = {
 };
 /* -----------------------------------------------------------------------------
  * Type initialization:
- * This problem is tough by the requirement that no dynamic 
- * memory is used. Also, since swig_type_info structures store pointers to 
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
  * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization. 
- * The idea is that swig generates all the structures that are needed. 
- * The runtime then collects these partially filled structures. 
- * The SWIG_InitializeModule function takes these initial arrays out of 
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
  * swig_module, and does all the lookup, filling in the swig_module.types
  * array with the correct data and linking the correct swig_cast_info
  * structures together.
  *
- * The generated swig_type_info structures are assigned staticly to an initial 
+ * The generated swig_type_info structures are assigned staticly to an initial
  * array. We just loop through that array, and handle each type individually.
  * First we lookup if this type has been already loaded, and if so, use the
  * loaded structure instead of the generated one. Then we have to fill in the
@@ -1978,17 +1978,17 @@ static swig_command_info swig_commands[] = {
  * a column is one of the swig_cast_info structures for that type.
  * The cast_initial array is actually an array of arrays, because each row has
  * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it 
+ * we find the array of casts associated with the type, and loop through it
  * adding the casts to the list. The one last trick we need to do is making
  * sure the type pointer in the swig_cast_info struct is correct.
  *
- * First off, we lookup the cast->type name to see if it is already loaded. 
+ * First off, we lookup the cast->type name to see if it is already loaded.
  * There are three cases to handle:
  *  1) If the cast->type has already been loaded AND the type we are adding
  *     casting info to has not been loaded (it is in this module), THEN we
  *     replace the cast->type pointer with the type pointer that has already
  *     been loaded.
- *  2) If BOTH types (the one we are adding casting info to, and the 
+ *  2) If BOTH types (the one we are adding casting info to, and the
  *     cast->type) are loaded, THEN the cast info has already been loaded by
  *     the previous module so we just ignore it.
  *  3) Finally, if cast->type has not already been loaded, then we add that
@@ -2013,9 +2013,9 @@ SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
   int found, init;
-  
+
   clientdata = clientdata;
-  
+
   /* check to see if the circular list has been setup, if not, set it up */
   if (swig_module.next==0) {
     /* Initialize the swig_module */
@@ -2026,7 +2026,7 @@ SWIG_InitializeModule(void *clientdata) {
   } else {
     init = 0;
   }
-  
+
   /* Try and load any already created modules */
   module_head = SWIG_GetModule(clientdata);
   if (!module_head) {
@@ -2045,20 +2045,20 @@ SWIG_InitializeModule(void *clientdata) {
       }
       iter=iter->next;
     } while (iter!= module_head);
-    
+
     /* if the is found in the list, then all is done and we may leave */
     if (found) return;
     /* otherwise we must add out module into the list */
     swig_module.next = module_head->next;
     module_head->next = &swig_module;
   }
-  
+
   /* When multiple interpeters are used, a module could have already been initialized in
        a different interpreter, but not yet have a pointer in this interpreter.
        In this case, we do not want to continue adding types... everything should be
        set up already */
   if (init == 0) return;
-  
+
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -2067,11 +2067,11 @@ SWIG_InitializeModule(void *clientdata) {
     swig_type_info *type = 0;
     swig_type_info *ret;
     swig_cast_info *cast;
-    
+
 #ifdef SWIGRUNTIME_DEBUG
     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
 #endif
-    
+
     /* if there is another module already loaded */
     if (swig_module.next != &swig_module) {
       type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
@@ -2090,7 +2090,7 @@ SWIG_InitializeModule(void *clientdata) {
     } else {
       type = swig_module.type_initial[i];
     }
-    
+
     /* Insert casting types */
     cast = swig_module.cast_initial[i];
     while (cast->type) {
@@ -2121,7 +2121,7 @@ SWIG_InitializeModule(void *clientdata) {
           if (!ocast) ret = 0;
         }
       }
-      
+
       if (!ret) {
 #ifdef SWIGRUNTIME_DEBUG
         printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
@@ -2138,7 +2138,7 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.types[i] = type;
   }
   swig_module.types[i] = 0;
-  
+
 #ifdef SWIGRUNTIME_DEBUG
   printf("**** SWIG_InitializeModule: Cast List ******\n");
   for (i = 0; i < swig_module.size; ++i) {
@@ -2166,10 +2166,10 @@ SWIG_PropagateClientData(void) {
   size_t i;
   swig_cast_info *equiv;
   static int init_run = 0;
-  
+
   if (init_run) return;
   init_run = 1;
-  
+
   for (i = 0; i < swig_module.size; i++) {
     if (swig_module.types[i]->clientdata) {
       equiv = swig_module.types[i]->cast;
@@ -2201,14 +2201,14 @@ extern "C"
 XS(SWIG_init) {
   dXSARGS;
   int i;
-  
+
   SWIG_InitializeModule(0);
-  
+
   /* Install commands */
   for (i = 0; swig_commands[i].name; i++) {
     newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
   }
-  
+
   /* Install variables */
   for (i = 0; swig_variables[i].name; i++) {
     SV *sv;
@@ -2218,9 +2218,9 @@ XS(SWIG_init) {
     } else {
       sv_setiv(sv,(IV) 0);
     }
-    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
   }
-  
+
   /* Install constant */
   for (i = 0; swig_constants[i].type; i++) {
     SV *sv;
@@ -2246,7 +2246,7 @@ XS(SWIG_init) {
     }
     SvREADONLY_on(sv);
   }
-  
+
   SWIG_TypeClientData(SWIGTYPE_p_McastHandle, (void*) "MCAST::McastHandle");
   ST(0) = &PL_sv_yes;
   XSRETURN(1);
index 2e075182859b0f0cd9b9341db14212dc0311882a..36ff5fcb503ce9bd23de60365fb6c3a9a5113ff2 100644 (file)
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
 
        mcast_socket_create("231.3.3.7", 1337, &handle, MCAST_SEND | MCAST_RECV | MCAST_TTL_HOST);
        perror("create");
-       
+
        if (!strcmp(argv[1], "send")) {
                mcast_socket_send(&handle, argv[2], strlen(argv[2]));
                exit(0);
index 075fef0d0b9ceb6881036918a16eb6fb3a4fb22b..2e0ea96610c962a9412e381fffc6bc3efe408d30 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Freeswitch Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Seven Du <dujinfang@gmail.com>
  *
@@ -168,7 +168,7 @@ static void close_socket(ws_socket_t *sock)
 void verto_broadcast(const char *event_channel, cJSON *json, const char *key, switch_event_channel_id_t id);
 static int ssl_init = 0;
 
-static int verto_init_ssl(verto_profile_t *profile) 
+static int verto_init_ssl(verto_profile_t *profile)
 {
        const char *err = "";
        int i = 0;
@@ -246,7 +246,7 @@ static int verto_init_ssl(verto_profile_t *profile)
 
        for (i = 0; i < profile->i; i++) {
                if (profile->ip[i].secure) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SSL NOT ENABLED FOR LISTENER %s:%d. REVERTING TO WS\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SSL NOT ENABLED FOR LISTENER %s:%d. REVERTING TO WS\n",
                                                          profile->ip[i].local_ip, profile->ip[i].local_port);
                        profile->ip[i].secure = 0;
                }
@@ -279,7 +279,7 @@ static uint32_t jsock_unsub_head(jsock_t *jsock, jsock_sub_node_head_t *head)
        jsock_sub_node_t *thisnp = NULL, *np, *last = NULL;
 
        np = head->tail = head->node;
-       
+
        while (np) {
 
                thisnp = np;
@@ -287,7 +287,7 @@ static uint32_t jsock_unsub_head(jsock_t *jsock, jsock_sub_node_head_t *head)
 
                if (!jsock || thisnp->jsock == jsock) {
                        x++;
-                       
+
                        if (last) {
                                last->next = np;
                        } else {
@@ -399,11 +399,11 @@ static void presence_ping(const char *event_channel)
                                        switch_channel_event_set_data(channel, event);
                                        switch_event_fire(&event);
                                }
-       
+
                                switch_core_session_rwunlock(session);
                        }
                }
-               
+
                switch_console_free_matches(&matches);
        }
 }
@@ -441,7 +441,7 @@ static switch_status_t jsock_sub_channel(jsock_t *jsock, const char *event_chann
                        switch_zmalloc(node, sizeof(*node));
                        node->jsock = jsock;
                        node->head = head;
-                       
+
                        if (!head->node) {
                                head->node = node;
                                head->tail = node;
@@ -540,7 +540,7 @@ static cJSON *jrpc_new_req(const char *method, const char *call_id, cJSON **para
 
        cJSON_AddItemToObject(msg, "method", cJSON_CreateString(method));
        cJSON_AddItemToObject(msg, "params", params);
-       
+
        if (call_id) {
                cJSON_AddItemToObject(params, "callID", cJSON_CreateString(call_id));
        }
@@ -548,7 +548,7 @@ static cJSON *jrpc_new_req(const char *method, const char *call_id, cJSON **para
        if (paramsP) {
                *paramsP = params;
        }
-       
+
        return msg;
 }
 
@@ -641,7 +641,7 @@ static switch_status_t jsock_queue_event(jsock_t *jsock, cJSON **json, switch_bo
 
        if (switch_queue_trypush(jsock->event_queue, jp) == SWITCH_STATUS_SUCCESS) {
                status = SWITCH_STATUS_SUCCESS;
-               
+
                if (jsock->lost_events) {
                        int le = jsock->lost_events;
                        jsock->lost_events = 0;
@@ -669,12 +669,12 @@ static void write_event(const char *event_channel, jsock_t *use_jsock, cJSON *ev
 {
        jsock_sub_node_head_t *head;
 
-       if ((head = switch_core_hash_find(verto_globals.event_channel_hash, event_channel))) {   
+       if ((head = switch_core_hash_find(verto_globals.event_channel_hash, event_channel))) {
                jsock_sub_node_t *np;
-               
+
                for(np = head->node; np; np = np->next) {
                        cJSON *msg = NULL, *params;
-                       
+
                        if (!use_jsock || use_jsock == np->jsock) {
                                params = cJSON_Duplicate(event, 1);
                                cJSON_AddItemToObject(params, "eventSerno", cJSON_CreateNumber(np->serno++));
@@ -731,7 +731,7 @@ static void jsock_send_event(cJSON *event)
                char *main_channel = strdup(event_channel);
                char *p = strchr(main_channel, '.');
                if (p) *p = '\0';
-               write_event(main_channel, use_jsock, event);            
+               write_event(main_channel, use_jsock, event);
                free(main_channel);
        }
        switch_thread_rwlock_unlock(verto_globals.event_channel_rwlock);
@@ -744,7 +744,7 @@ static void jsock_send_event(cJSON *event)
 
 static jrpc_func_t jrpc_get_func(jsock_t *jsock, const char *method)
 {
-       jrpc_func_t func = NULL; 
+       jrpc_func_t func = NULL;
        char *main_method = NULL;
 
        switch_assert(method);
@@ -820,7 +820,7 @@ static void set_perm(const char *str, switch_event_t **event)
                        cur = next;
                }
 
-               switch_safe_free(edup);         
+               switch_safe_free(edup);
 
        }
 }
@@ -862,7 +862,7 @@ static void check_permissions(jsock_t *jsock, switch_xml_t x_user, cJSON *params
        set_perm(allowed_jsapi, &jsock->allowed_jsapi);
        set_perm(allowed_fsapi, &jsock->allowed_fsapi);
        set_perm(allowed_event_channels, &jsock->allowed_event_channels);
-       
+
        switch_event_add_header_string(jsock->allowed_methods, SWITCH_STACK_BOTTOM, "login", MARKER);
 
 }
@@ -900,8 +900,8 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
                goto end;
        }
 
-       login = cJSON_GetObjectCstr(params, "login"); 
-       passwd = cJSON_GetObjectCstr(params, "passwd"); 
+       login = cJSON_GetObjectCstr(params, "login");
+       passwd = cJSON_GetObjectCstr(params, "passwd");
 
        if (zstr(login)) {
                goto end;
@@ -954,7 +954,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
 
                if ((json_ptr = cJSON_GetObjectItem(params, "loginParams"))) {
                        cJSON * i;
-                       
+
                        for(i = json_ptr->child; i; i = i->next) {
                                if (i->type == cJSON_True) {
                                        switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, "true");
@@ -969,7 +969,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
 
                if ((json_ptr = cJSON_GetObjectItem(params, "userVariables"))) {
                        cJSON * i;
-                       
+
                        for(i = json_ptr->child; i; i = i->next) {
                                if (i->type == cJSON_True) {
                                        switch_event_add_header_string(jsock->user_vars, SWITCH_STACK_BOTTOM, i->string, "true");
@@ -982,7 +982,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
                }
 
                switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, "action", "jsonrpc-authenticate");
-               
+
                if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, req_params) != SWITCH_STATUS_SUCCESS && !jsock->profile->blind_reg) {
                        *code = CODE_AUTH_FAILED;
                        switch_snprintf(message, mlen, "Login Incorrect");
@@ -995,7 +995,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
                        jsock->domain = switch_core_strdup(jsock->pool, domain);
                        jsock->uid = switch_core_sprintf(jsock->pool, "%s@%s", id, domain);
                        jsock->ready = 1;
-                       
+
                        if (!x_user) {
                                switch_event_destroy(&req_params);
                                r = SWITCH_TRUE;
@@ -1006,7 +1006,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
                                for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
                                        const char *var = switch_xml_attr_soft(x_param, "name");
                                        const char *val = switch_xml_attr_soft(x_param, "value");
-                                       
+
                                        if (!use_passwd && !strcasecmp(var, "password")) {
                                                use_passwd = val;
                                        } else if (!strcasecmp(var, "jsonrpc-password")) {
@@ -1032,7 +1032,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
                                for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
                                        const char *var = switch_xml_attr_soft(x_param, "name");
                                        const char *val = switch_xml_attr_soft(x_param, "value");
-                                       
+
                                        switch_event_add_header_string(jsock->vars, SWITCH_STACK_BOTTOM, var, val);
                                }
                        }
@@ -1062,14 +1062,14 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
 
                        switch_xml_free(x_user);
                }
-               
+
                switch_event_destroy(&req_params);
        }
 
  end:
 
        return r;
-       
+
 }
 
 static void set_call_params(cJSON *params, verto_pvt_t *tech_pvt) {
@@ -1079,7 +1079,7 @@ static void set_call_params(cJSON *params, verto_pvt_t *tech_pvt) {
        const char *callee_id_number = NULL;
 
        caller_id_name = switch_channel_get_variable(tech_pvt->channel, "caller_id_name");
-       caller_id_number = switch_channel_get_variable(tech_pvt->channel, "caller_id_number");  
+       caller_id_number = switch_channel_get_variable(tech_pvt->channel, "caller_id_number");
        callee_id_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name");
        callee_id_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number");
 
@@ -1088,8 +1088,8 @@ static void set_call_params(cJSON *params, verto_pvt_t *tech_pvt) {
 
        if (callee_id_name) cJSON_AddItemToObject(params, "callee_id_name", cJSON_CreateString(callee_id_name));
        if (callee_id_number) cJSON_AddItemToObject(params, "callee_id_number", cJSON_CreateString(callee_id_number));
-       
-       cJSON_AddItemToObject(params, "display_direction", 
+
+       cJSON_AddItemToObject(params, "display_direction",
                                                  cJSON_CreateString(switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound"));
 
 
@@ -1160,7 +1160,7 @@ static int attach_wake(void)
        int tries = 0;
 
  top:
-       
+
        status = switch_mutex_trylock(verto_globals.detach_mutex);
 
        if (status == SWITCH_STATUS_SUCCESS) {
@@ -1200,7 +1200,7 @@ static void tech_reattach(verto_pvt_t *tech_pvt, jsock_t *jsock)
        switch_core_session_request_video_refresh(tech_pvt->session);
 
        cJSON_AddItemToObject(params, "sdp", cJSON_CreateString(tech_pvt->mparams->local_sdp_str));
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Local attach SDP %s:\n%s\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Local attach SDP %s:\n%s\n",
                                          switch_channel_get_name(tech_pvt->channel),
                                          tech_pvt->mparams->local_sdp_str);
        set_call_params(params, tech_pvt);
@@ -1217,7 +1217,7 @@ static void drop_detached(void)
                if (!switch_channel_up_nosig(tech_pvt->channel)) {
                        continue;
                }
-               
+
                if (tech_pvt->detach_time && (now - tech_pvt->detach_time) > verto_globals.detach_timeout) {
                        switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE);
                }
@@ -1282,7 +1282,7 @@ static void process_jrpc_response(jsock_t *jsock, cJSON *json)
 static void set_session_id(jsock_t *jsock, const char *uuid)
 {
        //cJSON *params, *msg = jrpc_new(0);
-       
+
        if (!zstr(uuid)) {
                switch_set_string(jsock->uuid_str, uuid);
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s re-connecting session %s\n", jsock->name, jsock->uuid_str);
@@ -1307,7 +1307,7 @@ static cJSON *process_jrpc(jsock_t *jsock, cJSON *json)
        result = cJSON_GetObjectItem(json, "result");
        version = cJSON_GetObjectCstr(json, "jsonrpc");
        id = cJSON_GetObjectItem(json, "id");
-       
+
        if ((params = cJSON_GetObjectItem(json, "params"))) {
                sessid = cJSON_GetObjectCstr(params, "sessid");
        }
@@ -1327,7 +1327,7 @@ static cJSON *process_jrpc(jsock_t *jsock, cJSON *json)
                process_jrpc_response(jsock, json);
                return NULL;
        }
-       
+
        reply = jrpc_new(0);
 
        jrpc_add_id(reply, id, "", 0);
@@ -1347,7 +1347,7 @@ static cJSON *process_jrpc(jsock_t *jsock, cJSON *json)
                jrpc_add_error(reply, -32601, "Invalid Method, Missing Method or Permission Denied", id);
        } else {
                if (func(method, params, jsock, &response) == SWITCH_TRUE) {
-                       
+
                        if (params) {
                                echo = cJSON_GetObjectItem(params, "echoParams");
                        }
@@ -1411,11 +1411,11 @@ static switch_status_t process_input(jsock_t *jsock, uint8_t *data, switch_ssize
                reply = jrpc_new(0);
                jrpc_add_error(reply, -32600, "Invalid Request", NULL);
        }
-       
+
        if (reply) {
                ws_write_json(jsock, &reply, SWITCH_TRUE);
        }
-       
+
        if (json) {
                cJSON_Delete(json);
        }
@@ -1876,9 +1876,9 @@ static void client_run(jsock_t *jsock)
                        switch_ssize_t bytes;
                        ws_opcode_t oc;
                        uint8_t *data;
-                       
+
                        bytes = ws_read_frame(&jsock->ws, &oc, &data);
-                       
+
                        if (bytes < 0) {
                                die("BAD READ %" SWITCH_SSIZE_T_FMT "\n", bytes);
                                break;
@@ -1890,7 +1890,7 @@ static void client_run(jsock_t *jsock)
                                if (*s == '#') {
                                        char repl[2048] = "";
                                        switch_time_t a, b;
-                                       
+
                                        if (s[1] == 'S' && s[2] == 'P') {
 
                                                if (s[3] == 'U') {
@@ -1903,7 +1903,7 @@ static void client_run(jsock_t *jsock)
                                                        if (!(size = atoi(p))) {
                                                                continue;
                                                        }
-                                                       
+
                                                        a = switch_time_now();
                                                        do {
                                                                bytes = ws_read_frame(&jsock->ws, &oc, &data);
@@ -1912,7 +1912,7 @@ static void client_run(jsock_t *jsock)
                                                        b = switch_time_now();
 
                                                        if (!bytes || !data) continue;
-                                       
+
                                                        if (s[0] != '#') goto nm;
 
                                                        switch_snprintf(repl, sizeof(repl), "#SPU %ld", (long)((b - a) / 1000));
@@ -1952,7 +1952,7 @@ static void client_run(jsock_t *jsock)
                                if (process_input(jsock, data, bytes) != SWITCH_STATUS_SUCCESS) {
                                        die("Input Error\n");
                                }
-                               
+
                                if (!switch_test_flag(jsock, JPFLAG_CHECK_ATTACH) && switch_test_flag(jsock, JPFLAG_AUTHED)) {
                                        attach_calls(jsock);
                                        switch_set_flag(jsock, JPFLAG_CHECK_ATTACH);
@@ -1997,7 +1997,7 @@ static void *SWITCH_THREAD_FUNC client_thread(switch_thread_t *thread, void *obj
        add_jsock(jsock);
 
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Starting client thread.\n", jsock->name);
-       
+
        if ((jsock->ptype & PTYPE_CLIENT) || (jsock->ptype & PTYPE_CLIENT_SSL)) {
                client_run(jsock);
        } else {
@@ -2015,7 +2015,7 @@ static void *SWITCH_THREAD_FUNC client_thread(switch_thread_t *thread, void *obj
        if (jsock->client_socket != ws_sock_invalid) {
                close_socket(&jsock->client_socket);
        }
-       
+
        switch_event_destroy(&jsock->allowed_methods);
        switch_event_destroy(&jsock->allowed_fsapi);
        switch_event_destroy(&jsock->allowed_jsapi);
@@ -2033,7 +2033,7 @@ static void *SWITCH_THREAD_FUNC client_thread(switch_thread_t *thread, void *obj
        switch_thread_rwlock_wrlock(jsock->rwlock);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Thread ended\n", jsock->name);
        switch_thread_rwlock_unlock(jsock->rwlock);
-       
+
        return NULL;
 }
 
@@ -2048,7 +2048,7 @@ static switch_bool_t auth_api_command(jsock_t *jsock, const char *api_cmd, const
        switch_bool_t ok = SWITCH_TRUE;
 
   top:
-       
+
        if (!jsock->allowed_fsapi) {
                ok = SWITCH_FALSE;
                goto end;
@@ -2201,7 +2201,7 @@ static switch_status_t verto_connect(switch_core_session_t *session, const char
                for (hp = jsock->user_vars->headers; hp; hp = hp->next) {
                        switch_channel_set_variable(tech_pvt->channel, hp->name, hp->value);
                }
-               
+
                if ((var = switch_event_get_header(jsock->params, "caller-id-name"))) {
                        caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, var);
                }
@@ -2231,29 +2231,29 @@ static switch_status_t verto_connect(switch_core_session_t *session, const char
                                        return status;
                                }
                        }
+
                        switch_core_media_gen_local_sdp(session, SDP_TYPE_REQUEST, NULL, 0, NULL, 0);
                }
 
         msg = jrpc_new_req(method, tech_pvt->call_id, &params);
+
         if (tech_pvt->mparams->local_sdp_str) {
-            switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local %s SDP %s:\n%s\n", 
+            switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local %s SDP %s:\n%s\n",
                                                          method,
                                                          switch_channel_get_name(tech_pvt->channel),
                               tech_pvt->mparams->local_sdp_str);
+
             cJSON_AddItemToObject(params, "sdp", cJSON_CreateString(tech_pvt->mparams->local_sdp_str));
                        set_call_params(params, tech_pvt);
-                       
+
             jsock_queue_event(jsock, &msg, SWITCH_TRUE);
         } else {
             status = SWITCH_STATUS_FALSE;
         }
+
         switch_thread_rwlock_unlock(jsock->rwlock);
     }
+
     return status;
 }
 
@@ -2299,7 +2299,7 @@ static switch_status_t verto_on_init(switch_core_session_t *session)
                switch_core_session_clear_crypto(session);
 
                while(--tries > 0) {
-                       
+
                        status = verto_connect(session, "verto.attach");
 
                        if (status == SWITCH_STATUS_SUCCESS) {
@@ -2383,14 +2383,14 @@ static void verto_set_media_options(verto_pvt_t *tech_pvt, verto_profile_t *prof
                if (zstr(tech_pvt->mparams->rtpip)) {
                        tech_pvt->mparams->rtpip = tech_pvt->mparams->rtpip6;
                }
-               
+
                if (profile->rtpip_cur6 == profile->rtpip_index6) {
                        profile->rtpip_cur6 = 0;
                }
        }
 
        if (zstr(tech_pvt->mparams->rtpip)) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "%s has no media ip, check your configuration\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "%s has no media ip, check your configuration\n",
                                                  switch_channel_get_name(tech_pvt->channel));
                switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL);
        }
@@ -2414,7 +2414,7 @@ static void verto_set_media_options(verto_pvt_t *tech_pvt, verto_profile_t *prof
 
        tech_pvt->mparams->inbound_codec_string = switch_core_session_strdup(tech_pvt->session, profile->inbound_codec_string);
        tech_pvt->mparams->outbound_codec_string = switch_core_session_strdup(tech_pvt->session, profile->outbound_codec_string);
-       
+
        tech_pvt->mparams->jb_msec = "-1";
        switch_media_handle_set_media_flag(tech_pvt->smh, SCMF_SUPPRESS_CNG);
 
@@ -2425,7 +2425,7 @@ static void verto_set_media_options(verto_pvt_t *tech_pvt, verto_profile_t *prof
        //tech_pvt->mparams->manual_video_rtp_bugs = profile->manual_video_rtp_bugs;
 
        tech_pvt->mparams->local_network = switch_core_session_strdup(tech_pvt->session, profile->local_network);
-       
+
 
        //tech_pvt->mparams->rtcp_audio_interval_msec = profile->rtpp_audio_interval_msec;
        //tech_pvt->mparams->rtcp_video_interval_msec = profile->rtpp_video_interval_msec;
@@ -2448,7 +2448,7 @@ static switch_status_t verto_media(switch_core_session_t *session)
        switch_status_t status = SWITCH_STATUS_SUCCESS;
 
        switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
-       
+
        if (tech_pvt->r_sdp) {
                if (verto_tech_media(tech_pvt, tech_pvt->r_sdp, SDP_TYPE_REQUEST) != SWITCH_STATUS_SUCCESS) {
                        switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
@@ -2610,20 +2610,20 @@ static int verto_recover_callback(switch_core_session_t *session)
        tech_pvt->channel = channel;
        tech_pvt->jsock_uuid = (char *) jsock_uuid_str;
        switch_core_session_set_private_class(session, tech_pvt, SWITCH_PVT_SECONDARY);
-               
-               
+
+
        tech_pvt->call_id = switch_core_session_strdup(session, switch_core_session_get_uuid(session));
        if ((tech_pvt->smh = switch_core_session_get_media_handle(session))) {
                tech_pvt->mparams = switch_core_media_get_mparams(tech_pvt->smh);
                verto_set_media_options(tech_pvt, profile);
        }
-       
+
        switch_snprintf(name, sizeof(name), "verto.rtc/%s", tech_pvt->jsock_uuid);
        switch_channel_set_name(channel, name);
 
        switch_channel_add_state_handler(channel, &verto_state_handlers);
        switch_core_event_hook_add_receive_message(session, messagehook);
-       
+
        track_pvt(tech_pvt);
 
        //switch_channel_clear_flag(tech_pvt->channel, CF_ANSWERED);
@@ -2659,7 +2659,7 @@ static void pass_sdp(verto_pvt_t *tech_pvt)
 
 static switch_bool_t verto__answer_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response)
 {
-       cJSON *obj = cJSON_CreateObject(); 
+       cJSON *obj = cJSON_CreateObject();
        switch_core_session_t *session;
        cJSON *dialog = NULL;
        const char *call_id = NULL, *sdp = NULL;
@@ -2677,7 +2677,7 @@ static switch_bool_t verto__answer_func(const char *method, cJSON *params, jsock
                cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CallID missing"));
                err = 1; goto cleanup;
        }
-       
+
        if (!(sdp = cJSON_GetObjectCstr(params, "sdp"))) {
                cJSON_AddItemToObject(obj, "message", cJSON_CreateString("SDP missing"));
                err = 1; goto cleanup;
@@ -2692,7 +2692,7 @@ static switch_bool_t verto__answer_func(const char *method, cJSON *params, jsock
                switch_core_session_t *other_session = NULL;
 
                tech_pvt->r_sdp = switch_core_session_strdup(session, sdp);
-               switch_channel_set_variable(tech_pvt->channel, SWITCH_R_SDP_VARIABLE, sdp);             
+               switch_channel_set_variable(tech_pvt->channel, SWITCH_R_SDP_VARIABLE, sdp);
                switch_channel_set_variable(tech_pvt->channel, "verto_client_address", jsock->name);
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote SDP %s:\n%s\n", switch_channel_get_name(tech_pvt->channel), sdp);
                switch_core_media_set_sdp_codec_string(session, sdp, SDP_TYPE_RESPONSE);
@@ -2713,14 +2713,14 @@ static switch_bool_t verto__answer_func(const char *method, cJSON *params, jsock
                                cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CODEC ERROR"));
                                err = 1;
                        }
-                       
+
                        if (!err && switch_core_media_activate_rtp(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
                                switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                cJSON_AddItemToObject(obj, "message", cJSON_CreateString("MEDIA ERROR"));
                                err = 1;
                        }
                }
-               
+
                if (!err) {
                        if (callee_id_name) {
                                switch_channel_set_profile_var(tech_pvt->channel, "callee_id_name", callee_id_name);
@@ -2739,7 +2739,7 @@ static switch_bool_t verto__answer_func(const char *method, cJSON *params, jsock
 
  cleanup:
 
-       
+
        if (!err) return SWITCH_TRUE;
 
 
@@ -2752,13 +2752,13 @@ static switch_bool_t verto__answer_func(const char *method, cJSON *params, jsock
 
 static switch_bool_t verto__bye_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response)
 {
-       cJSON *obj = cJSON_CreateObject(); 
+       cJSON *obj = cJSON_CreateObject();
        switch_core_session_t *session;
        cJSON *dialog = NULL;
        const char *call_id = NULL, *cause_str = NULL;
        int err = 0;
        switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
-       
+
        *response = obj;
 
        if (!(dialog = cJSON_GetObjectItem(params, "dialogParams"))) {
@@ -2779,7 +2779,7 @@ static switch_bool_t verto__bye_func(const char *method, cJSON *params, jsock_t
                }
        }
 
-       cJSON_AddItemToObject(obj, "callID", cJSON_CreateString(call_id)); 
+       cJSON_AddItemToObject(obj, "callID", cJSON_CreateString(call_id));
 
        if ((session = switch_core_session_locate(call_id))) {
                verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY);
@@ -2798,7 +2798,7 @@ static switch_bool_t verto__bye_func(const char *method, cJSON *params, jsock_t
 
  cleanup:
 
-       
+
        if (!err) return SWITCH_TRUE;
 
 
@@ -2917,7 +2917,7 @@ static switch_bool_t attended_transfer(switch_core_session_t *session, switch_co
        if (tech_pvt && b_tech_pvt) {
                switch_channel_set_variable(tech_pvt->channel, "refer_uuid", switch_core_session_get_uuid(b_tech_pvt->session));
                switch_channel_set_variable(b_tech_pvt->channel, "transfer_disposition", "replaced");
-       
+
                br_a = switch_channel_get_partner_uuid(tech_pvt->channel);
                br_b = switch_channel_get_partner_uuid(b_tech_pvt->channel);
 
@@ -3000,7 +3000,7 @@ static switch_bool_t attended_transfer(switch_core_session_t *session, switch_co
                        switch_channel_set_flag(tchannel, CF_ATTENDED_TRANSFER);
                        switch_core_session_rwunlock(tmp);
                }
-               
+
                if (switch_true(switch_channel_get_variable(tech_pvt->channel, "recording_follow_transfer")) &&
                        (tmp = switch_core_session_locate(br_a))) {
                        switch_channel_set_variable(switch_core_session_get_channel(tmp), "transfer_disposition", "bridge");
@@ -3083,12 +3083,12 @@ static switch_bool_t attended_transfer(switch_core_session_t *session, switch_co
 
 static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response)
 {
-       cJSON *obj = cJSON_CreateObject(); 
+       cJSON *obj = cJSON_CreateObject();
        switch_core_session_t *session;
        cJSON *dialog = NULL;
        const char *call_id = NULL, *destination = NULL, *action = NULL;
        int err = 0;
-       
+
        *response = obj;
 
        if (!(dialog = cJSON_GetObjectItem(params, "dialogParams"))) {
@@ -3106,14 +3106,14 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock
                err = 1; goto cleanup;
        }
 
-       cJSON_AddItemToObject(obj, "callID", cJSON_CreateString(call_id)); 
-       cJSON_AddItemToObject(obj, "action", cJSON_CreateString(action)); 
+       cJSON_AddItemToObject(obj, "callID", cJSON_CreateString(call_id));
+       cJSON_AddItemToObject(obj, "action", cJSON_CreateString(action));
 
 
        if ((session = switch_core_session_locate(call_id))) {
                verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY);
-               
-               if (!strcasecmp(action, "transfer")) {                  
+
+               if (!strcasecmp(action, "transfer")) {
                        switch_core_session_t *other_session = NULL;
 
                        if (!(destination = cJSON_GetObjectCstr(params, "destination"))) {
@@ -3121,7 +3121,7 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock
                                err = 1; goto rwunlock;
                        }
 
-                       if (switch_core_session_get_partner(tech_pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) {                      
+                       if (switch_core_session_get_partner(tech_pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                switch_ivr_session_transfer(other_session, destination, NULL, NULL);
                                cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CALL TRANSFERRED"));
                                switch_core_session_rwunlock(other_session);
@@ -3157,11 +3157,11 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock
                        switch_core_media_toggle_hold(session, !!!switch_channel_test_flag(tech_pvt->channel, CF_PROTO_HOLD));
                }
 
-               cJSON_AddItemToObject(obj, "holdState", cJSON_CreateString(switch_channel_test_flag(tech_pvt->channel, CF_PROTO_HOLD) ? "held" : "active")); 
+               cJSON_AddItemToObject(obj, "holdState", cJSON_CreateString(switch_channel_test_flag(tech_pvt->channel, CF_PROTO_HOLD) ? "held" : "active"));
 
 
        rwunlock:
-               
+
                switch_core_session_rwunlock(session);
        } else {
                cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CALL DOES NOT EXIST"));
@@ -3170,7 +3170,7 @@ static switch_bool_t verto__modify_func(const char *method, cJSON *params, jsock
 
  cleanup:
 
-       
+
        if (!err) return SWITCH_TRUE;
 
 
@@ -3224,7 +3224,7 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock
 
 
        switch_channel_set_variable(tech_pvt->channel, SWITCH_R_SDP_VARIABLE, tech_pvt->r_sdp);
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote SDP %s:\n%s\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote SDP %s:\n%s\n",
                                          switch_channel_get_name(tech_pvt->channel), tech_pvt->r_sdp);
 
        switch_core_media_clear_ice(tech_pvt->session);
@@ -3246,7 +3246,7 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock
                cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CODEC NEGOTIATION ERROR"));
                err = 1; goto cleanup;
        }
-       
+
  cleanup:
 
        if (tech_pvt) {
@@ -3273,7 +3273,7 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock
 
        cJSON_AddItemToObject(obj, "code", cJSON_CreateNumber(CODE_SESSION_ERROR));
 
-       return SWITCH_FALSE;    
+       return SWITCH_FALSE;
 }
 
 static void parse_user_vars(cJSON *obj, switch_core_session_t *session)
@@ -3310,21 +3310,21 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
        char *pproto = NULL;
 
        *response = cJSON_CreateObject();
-       
+
        if ((dialog = cJSON_GetObjectItem(params, "dialogParams")) && (call_id = cJSON_GetObjectCstr(dialog, "callID"))) {
                switch_core_session_t *session = NULL;
-               
+
                if ((session = switch_core_session_locate(call_id))) {
 
                        parse_user_vars(dialog, session);
 
-                       if ((dtmf = cJSON_GetObjectCstr(params, "dtmf"))) {  
+                       if ((dtmf = cJSON_GetObjectCstr(params, "dtmf"))) {
                                verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY);
                                char *send = switch_mprintf("~%s", dtmf);
 
                                if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
                                        switch_core_session_t *other_session = NULL;
-                                       
+
                                        if (switch_core_session_get_partner(tech_pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                                switch_core_session_send_dtmf_string(other_session, send);
                                                switch_core_session_rwunlock(other_session);
@@ -3339,7 +3339,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                        switch_core_session_rwunlock(session);
                }
        }
-       
+
        if ((txt = cJSON_GetObjectItem(params, "txt"))) {
                switch_core_session_t *session;
 
@@ -3348,7 +3348,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                        char charbuf[2] = "";
                        char *chardata = NULL;
                        cJSON *data;
-                       
+
                        if ((data = cJSON_GetObjectItem(txt, "code"))) {
                                charbuf[0] = data->valueint;
                                chardata = charbuf;
@@ -3366,7 +3366,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                                switch_mutex_lock(tech_pvt->text_read_mutex);
                                switch_buffer_write(tech_pvt->text_read_buffer, chardata, strlen(chardata));
                                switch_mutex_unlock(tech_pvt->text_read_mutex);
-                       
+
                                if ((switch_mutex_trylock(tech_pvt->text_cond_mutex) == SWITCH_STATUS_SUCCESS)) {
                                        switch_thread_cond_signal(tech_pvt->text_cond);
                                        switch_mutex_unlock(tech_pvt->text_cond_mutex);
@@ -3374,7 +3374,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                        }
                        switch_core_session_rwunlock(session);
                }
-               
+
        }
 
        if ((msg = cJSON_GetObjectItem(params, "msg"))) {
@@ -3384,7 +3384,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                cJSON *i, *indialog =  cJSON_GetObjectItem(msg, "inDialog");
                const char *body = cJSON_GetObjectCstr(msg, "body");
                switch_bool_t is_dialog = indialog && (indialog->type == cJSON_True || (indialog->type == cJSON_String && switch_true(indialog->valuestring)));
-               
+
                if (!zstr(to)) {
                        if (strchr(to, '+')) {
                                pproto = strdup(to);
@@ -3394,21 +3394,21 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                                proto = pproto;
                        }
                }
-               
+
                if (!zstr(to) && !zstr(body) && switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", VERTO_CHAT_PROTO);
-                       
+
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", jsock->uid);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", jsock->id);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", jsock->domain);
 
-                       
+
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "text/plain");
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", jsock->id);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "verto_profile", jsock->profile->name);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "verto_jsock_uuid", jsock->uuid_str);
-                       
+
                        for(i = msg->child; i; i = i->next) {
                                if (!zstr(i->string) && !zstr(i->valuestring) && (!strncasecmp(i->string, "from_", 5) || !strncasecmp(i->string, "to_", 3))) {
                                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, i->string, i->valuestring);
@@ -3424,11 +3424,11 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                        if (strcasecmp(proto, VERTO_CHAT_PROTO)) {
                                switch_core_chat_send(proto, event);
                        }
-                       
+
                        if (is_dialog) {
                                if ((dialog = cJSON_GetObjectItem(params, "dialogParams")) && (call_id = cJSON_GetObjectCstr(dialog, "callID"))) {
                                        switch_core_session_t *session = NULL;
-                                       
+
                                        if ((session = switch_core_session_locate(call_id))) {
                                                switch_core_session_queue_event(session, &event);
                                                switch_core_session_rwunlock(session);
@@ -3438,7 +3438,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                        } else {
                                switch_core_chat_send("GLOBAL", event);
                        }
-                       
+
                        if (event) {
                                switch_event_destroy(&event);
                        }
@@ -3448,10 +3448,10 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
 
                } else {
                        r = SWITCH_FALSE;
-                       cJSON_AddItemToObject(*response, "message", cJSON_CreateString("INVALID MESSAGE to and body params required")); 
+                       cJSON_AddItemToObject(*response, "message", cJSON_CreateString("INVALID MESSAGE to and body params required"));
                }
-               
-               
+
+
                switch_safe_free(pproto);
        }
 
@@ -3476,7 +3476,7 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
        const char *var, *destination_number, *call_id = NULL, *sdp = NULL,
                *caller_id_name = NULL, *caller_id_number = NULL, *remote_caller_id_name = NULL, *remote_caller_id_number = NULL,*context = NULL;
        switch_event_header_t *hp;
-       
+
        *response = obj;
 
        if (switch_event_create_plain(&var_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) {
@@ -3549,7 +3549,7 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
 
        if ((canvas = cJSON_GetObjectItem(dialog, "conferenceCanvasID"))) {
                int canvas_id = 0;
-               
+
                if (!zstr(canvas->valuestring)) {
                        canvas_id = atoi(canvas->valuestring);
                } else if (canvas->valueint) {
@@ -3575,9 +3575,9 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
                } else if (bandwidth->valueint) {
                        bwval = bandwidth->valueint;
                }
-               
+
                if (bwval < 0) bwval = 0;
-               
+
                if (core_bw && bwval && bwval < core_bw) {
                        switch_channel_set_variable_printf(channel, "rtp_video_max_bandwidth_in", "%d", bwval);
                }
@@ -3622,7 +3622,7 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
 
        remote_caller_id_name = cJSON_GetObjectCstr(dialog, "remote_caller_id_name");
        remote_caller_id_number = cJSON_GetObjectCstr(dialog, "remote_caller_id_number");
-       
+
        if (zstr(caller_id_name)) {
                if ((var = switch_event_get_header(jsock->params, "caller-id-name"))) {
                        caller_id_name = var;
@@ -3636,7 +3636,7 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
                        caller_id_number = var;
                }
        }
-       
+
        if (!(context = switch_event_get_header(jsock->vars, "user_context"))) {
                context = switch_either(jsock->context, jsock->profile->context);
        }
@@ -3649,13 +3649,13 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
                                                                                                        jsock->remote_host,
                                                                                                        cJSON_GetObjectCstr(dialog, "ani"),
                                                                                                        cJSON_GetObjectCstr(dialog, "aniii"),
-                                                                                                       cJSON_GetObjectCstr(dialog, "rdnis"), 
-                                                                                                       modname, 
+                                                                                                       cJSON_GetObjectCstr(dialog, "rdnis"),
+                                                                                                       modname,
                                                                                                        context,
                                                                                                        destination_number))) {
-                       
+
                switch_channel_set_caller_profile(channel, caller_profile);
-               
+
        }
 
        switch_ivr_set_user(session, jsock->uid);
@@ -3677,15 +3677,15 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
        switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, sdp);
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote SDP %s:\n%s\n", switch_channel_get_name(tech_pvt->channel), sdp);
 
-       cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CALL CREATED")); 
-       cJSON_AddItemToObject(obj, "callID", cJSON_CreateString(tech_pvt->call_id)); 
+       cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CALL CREATED"));
+       cJSON_AddItemToObject(obj, "callID", cJSON_CreateString(tech_pvt->call_id));
 
        switch_channel_add_state_handler(channel, &verto_state_handlers);
        switch_core_event_hook_add_receive_message(session, messagehook);
        switch_channel_set_state(channel, CS_INIT);
        track_pvt(tech_pvt);
        switch_core_session_thread_launch(session);
-       
+
  cleanup:
 
        switch_event_destroy(&var_event);
@@ -3706,7 +3706,7 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
        cJSON_AddItemToObject(obj, "code", cJSON_CreateNumber(CODE_SESSION_ERROR));
 
        return SWITCH_FALSE;
-       
+
 }
 
 static switch_bool_t event_channel_check_auth(jsock_t *jsock, const char *event_channel)
@@ -3762,14 +3762,14 @@ static switch_bool_t parse_subs(jsock_t *jsock, const char *event_channel, cJSON
 
        if (event_channel_check_auth(jsock, event_channel)) {
                if (!*sub_list) {
-                       *sub_list = cJSON_CreateArray(); 
+                       *sub_list = cJSON_CreateArray();
                }
 
                if (jsock_sub_channel(jsock, event_channel) == SWITCH_STATUS_SUCCESS) {
                        cJSON_AddItemToArray(*sub_list, cJSON_CreateString(event_channel));
                } else {
                        if (!*exist_list) {
-                               *exist_list = cJSON_CreateArray(); 
+                               *exist_list = cJSON_CreateArray();
                        }
                        cJSON_AddItemToArray(*exist_list, cJSON_CreateString(event_channel));
                }
@@ -3777,7 +3777,7 @@ static switch_bool_t parse_subs(jsock_t *jsock, const char *event_channel, cJSON
                r = SWITCH_TRUE;
        } else {
                if (!*err_list) {
-                       *err_list = cJSON_CreateArray(); 
+                       *err_list = cJSON_CreateArray();
                }
                cJSON_AddItemToArray(*err_list, cJSON_CreateString(event_channel));
        }
@@ -3800,7 +3800,7 @@ static switch_bool_t verto__subscribe_func(const char *method, cJSON *params, js
                                parse_subs(jsock, jchannel->valuestring, &subs, &errs, &exist);
                        } else if (jchannel->type == cJSON_Array) {
                                int i, len = cJSON_GetArraySize(jchannel);
-                               
+
                                for(i = 0; i < len; i++) {
                                        cJSON *str = cJSON_GetArrayItem(jchannel, i);
                                        if (str->type == cJSON_String) {
@@ -3830,16 +3830,16 @@ static switch_bool_t verto__subscribe_func(const char *method, cJSON *params, js
        return r;
 }
 
-static void do_unsub(jsock_t *jsock, const char *event_channel, cJSON **subs, cJSON **errs) 
+static void do_unsub(jsock_t *jsock, const char *event_channel, cJSON **subs, cJSON **errs)
 {
        if (jsock_unsub_channel(jsock, event_channel)) {
                if (!*subs) {
-                       *subs = cJSON_CreateArray(); 
+                       *subs = cJSON_CreateArray();
                }
                cJSON_AddItemToArray(*subs, cJSON_CreateString(event_channel));
        } else {
                if (!*errs) {
-                       *errs = cJSON_CreateArray(); 
+                       *errs = cJSON_CreateArray();
                }
                cJSON_AddItemToArray(*errs, cJSON_CreateString(event_channel));
        }
@@ -3860,7 +3860,7 @@ static switch_bool_t verto__unsubscribe_func(const char *method, cJSON *params,
                                do_unsub(jsock, jchannel->valuestring, &subs, &errs);
                        } else if (jchannel->type == cJSON_Array) {
                                int i, len = cJSON_GetArraySize(jchannel);
-                               
+
                                for(i = 0; i < len; i++) {
                                        cJSON *str = cJSON_GetArrayItem(jchannel, i);
                                        if (str->type == cJSON_String) {
@@ -3910,7 +3910,7 @@ static switch_bool_t verto__broadcast_func(const char *method, cJSON *params, js
        }
 
 
-       cJSON_AddItemToObject(params, "userid", cJSON_CreateString(jsock->uid)); 
+       cJSON_AddItemToObject(params, "userid", cJSON_CreateString(jsock->uid));
 
        display = switch_event_get_header(jsock->params, "caller-id-name");
        if (display) {
@@ -3918,7 +3918,7 @@ static switch_bool_t verto__broadcast_func(const char *method, cJSON *params, js
        }
 
        jevent = cJSON_Duplicate(params, 1);
-       
+
        broadcast = cJSON_GetObjectItem(params, "localBroadcast");
 
        if (broadcast && broadcast->type == cJSON_True) {
@@ -4025,7 +4025,7 @@ static switch_bool_t fsapi_func(const char *method, cJSON *params, jsock_t *jsoc
        reply = cJSON_CreateObject();
 
        SWITCH_STANDARD_STREAM(stream);
-       
+
        if (cmd && (status = switch_api_execute(cmd->valuestring, arg ? arg->valuestring : NULL, NULL, &stream)) == SWITCH_STATUS_SUCCESS) {
                cJSON_AddItemToObject(reply, "message", cJSON_CreateString((char *) stream.data));
        } else {
@@ -4060,7 +4060,7 @@ static void jrpc_init(void)
        jrpc_add_func("verto.unsubscribe", verto__unsubscribe_func);
        jrpc_add_func("verto.broadcast", verto__broadcast_func);
        jrpc_add_func("verto.modify", verto__modify_func);
-       
+
 }
 
 
@@ -4101,7 +4101,7 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock, int family)
                        die("ACCEPT FAILED\n");
                }
        }
-       
+
        for (i = 0; i < profile->i; i++) {
                if ( profile->server_socket[i] == sock ) {
                        if (profile->ip[i].secure) {
@@ -4113,7 +4113,7 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock, int family)
 
        jsock->local_sock = sock;
        jsock->profile = profile;
-       
+
        if (zstr(jsock->name)) {
                if (family == PF_INET) {
                        jsock->remote_port = ntohs(jsock->remote_addr.sin_port);
@@ -4125,18 +4125,18 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock, int family)
                        jsock->name = switch_core_sprintf(pool, "[%s]:%d", jsock->remote_host, jsock->remote_port);
                }
        }
-       
+
        jsock->ptype = ptype;
 
        for(i = 0; i < profile->conn_acl_count; i++) {
                if (!switch_check_network_list_ip(jsock->remote_host, profile->conn_acl[i])) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Client Connect from %s:%d refused by ACL %s\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Client Connect from %s:%d refused by ACL %s\n",
                                                          jsock->name, jsock->remote_host, jsock->remote_port, profile->conn_acl[i]);
                        goto error;
                }
        }
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Client Connect from %s:%d accepted\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Client Connect from %s:%d accepted\n",
                                          jsock->name, jsock->remote_host, jsock->remote_port);
 
        if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_CLIENT_CONNECT) == SWITCH_STATUS_SUCCESS) {
@@ -4176,7 +4176,7 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock, int family)
        return 0;
 
  error:
-       
+
        if (jsock) {
                if (jsock->client_socket != ws_sock_invalid) {
                        close_socket(&jsock->client_socket);
@@ -4188,7 +4188,7 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock, int family)
        return -1;
 }
 
-static ws_socket_t prepare_socket(ips_t *ips) 
+static ws_socket_t prepare_socket(ips_t *ips)
 {
        ws_socket_t sock = ws_sock_invalid;
 #ifndef WIN32
@@ -4209,7 +4209,7 @@ static ws_socket_t prepare_socket(ips_t *ips)
        if ((sock = socket(family, SOCK_STREAM, IPPROTO_TCP)) < 0) {
                die("Socket Error!\n");
        }
-       
+
        if ( setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr)) < 0 ) {
                die("Socket setsockopt Error!\n");
        }
@@ -4231,7 +4231,7 @@ static ws_socket_t prepare_socket(ips_t *ips)
                        die("Bind Error!\n");
                }
        }
-       
+
     if (listen(sock, MAXPENDING) < 0) {
                die("Listen error\n");
        }
@@ -4268,7 +4268,7 @@ static void handle_mcast_sub(verto_profile_t *profile)
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MCAST JSON PARSE ERR: %s\n", (char *)profile->mcast_sub.buffer);
                }
-               
+
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MCAST INVALID READ %d\n", bytes);
        }
@@ -4283,7 +4283,7 @@ static int profile_one_loop(verto_profile_t *profile)
        int max = 2;
 
        memset(&pfds[0], 0, sizeof(pfds[0]) * MAX_BIND+2);
-               
+
        for (i = 0; i < profile->i; i++)  {
                pfds[i].sock = profile->server_socket[i];
                pfds[i].events = SWITCH_POLL_READ|SWITCH_POLL_ERROR;
@@ -4305,7 +4305,7 @@ static int profile_one_loop(verto_profile_t *profile)
        if (res == 0) {
                return 0;
        }
-                       
+
        for (x = 0; x < max; x++) {
                if (pfds[x].revents & SWITCH_POLL_ERROR) {
                        die("POLL ERROR\n");
@@ -4314,7 +4314,7 @@ static int profile_one_loop(verto_profile_t *profile)
                if (pfds[x].revents & SWITCH_POLL_HUP) {
                        die("POLL HUP\n");
                }
-                       
+
                if (pfds[x].revents & SWITCH_POLL_READ) {
                        if (profile->mcast_ip && pfds[x].sock == (switch_os_socket_t)profile->mcast_sub.sock) {
                                handle_mcast_sub(profile);
@@ -4374,7 +4374,7 @@ static void kill_profiles(void)
        int sanity = 50;
 
        switch_mutex_lock(verto_globals.mutex);
-       for(pp = verto_globals.profile_head; pp; pp = pp->next) {       
+       for(pp = verto_globals.profile_head; pp; pp = pp->next) {
                kill_profile(pp);
        }
        switch_mutex_unlock(verto_globals.mutex);
@@ -4398,7 +4398,7 @@ static int runtime(verto_profile_t *profile)
                        listeners++;
                }
        }
-       
+
        if (!listeners) {
                die("Client Socket Error! No Listeners!\n");
        }
@@ -4409,7 +4409,7 @@ static int runtime(verto_profile_t *profile)
                if (mcast_socket_create(profile->mcast_ip, profile->mcast_port, &profile->mcast_sub, MCAST_RECV | MCAST_TTL_HOST) < 0) {
                        ok++;
                }
-               
+
                if (ok && mcast_socket_create(profile->mcast_ip, profile->mcast_port + 1, &profile->mcast_pub, MCAST_SEND | MCAST_TTL_HOST) > 0) {
                        mcast_socket_close(&profile->mcast_sub);
                        ok = 0;
@@ -4421,8 +4421,8 @@ static int runtime(verto_profile_t *profile)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "MCAST Disabled\n");
                }
        }
-       
-       
+
+
        while(profile->running) {
                if (profile_one_loop(profile) < 0) {
                        goto error;
@@ -4444,7 +4444,7 @@ static int runtime(verto_profile_t *profile)
        }
 
        return r;
-       
+
 }
 
 static void do_shutdown(void)
@@ -4540,7 +4540,7 @@ static switch_bool_t profile_exists(const char *name)
                }
        }
        switch_mutex_unlock(verto_globals.mutex);
-       
+
        return r;
 }
 
@@ -4574,7 +4574,7 @@ static switch_status_t add_profile(verto_profile_t *profile)
        if (!profile_exists(profile->name)) {
                status = SWITCH_STATUS_SUCCESS;
        }
-       
+
        if (status == SWITCH_STATUS_SUCCESS) {
                profile->next = verto_globals.profile_head;
                verto_globals.profile_head = profile;
@@ -4582,13 +4582,13 @@ static switch_status_t add_profile(verto_profile_t *profile)
        }
 
        switch_mutex_unlock(verto_globals.mutex);
-       
+
        return status;
 }
 
 static switch_status_t parse_config(const char *cf)
 {
-       
+
        switch_xml_t cfg, xml, settings, param, xprofile, xprofiles;
        switch_xml_t xvhosts, xvhost, rewrites, rule;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -4636,7 +4636,7 @@ static switch_status_t parse_config(const char *cf)
 
                                var = (char *) switch_xml_attr_soft(param, "name");
                                val = (char *) switch_xml_attr_soft(param, "value");
-                       
+
                                if (!strcasecmp(var, "bind-local")) {
                                        const char *secure = switch_xml_attr_soft(param, "secure");
                                        if (i < MAX_BIND) {
@@ -4659,9 +4659,9 @@ static switch_status_t parse_config(const char *cf)
                                } else if (!strcasecmp(var, "secure-chain")) {
                                        set_string(profile->chain, val);
                                } else if (!strcasecmp(var, "inbound-codec-string") && !zstr(val)) {
-                                       profile->inbound_codec_string = switch_core_strdup(profile->pool, val); 
+                                       profile->inbound_codec_string = switch_core_strdup(profile->pool, val);
                                } else if (!strcasecmp(var, "outbound-codec-string") && !zstr(val)) {
-                                       profile->outbound_codec_string = switch_core_strdup(profile->pool, val); 
+                                       profile->outbound_codec_string = switch_core_strdup(profile->pool, val);
                                } else if (!strcasecmp(var, "blind-reg") && !zstr(val)) {
                                        profile->blind_reg = switch_true(val);
                                } else if (!strcasecmp(var, "userauth") && !zstr(val)) {
@@ -4717,7 +4717,7 @@ static switch_status_t parse_config(const char *cf)
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid External RTP IP.\n");
                                        } else {
                                                profile->extrtpip = switch_core_strdup(profile->pool, val);
-                                       }                                       
+                                       }
                                } else if (!strcasecmp(var, "debug")) {
                                        if (val) {
                                                profile->debug = atoi(val);
@@ -4747,7 +4747,7 @@ static switch_status_t parse_config(const char *cf)
 
                        if (zstr(profile->ip[0].local_ip) ) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: local_ip bad\n", profile->name);
                        if (profile->ip[0].local_port <= 0  ) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: local_port bad\n", profile->name);
-                       
+
                        if (zstr(profile->ip[0].local_ip) || profile->ip[0].local_port <= 0) {
                                del_profile(profile);
                                switch_core_destroy_memory_pool(&pool);
@@ -4756,7 +4756,7 @@ static switch_status_t parse_config(const char *cf)
 
                                for (i = 0; i < profile->i; i++) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-                                                                         strchr(profile->ip[i].local_ip, ':') ? "%s Bound to [%s]:%d\n" : "%s Bound to %s:%d\n", 
+                                                                         strchr(profile->ip[i].local_ip, ':') ? "%s Bound to [%s]:%d\n" : "%s Bound to %s:%d\n",
                                                                          profile->name, profile->ip[i].local_ip, profile->ip[i].local_port);
                                }
                        }
@@ -4882,7 +4882,7 @@ static int init(void)
        parse_config("verto.conf");
 
        switch_mutex_lock(verto_globals.mutex);
-       for(p = verto_globals.profile_head; p; p = p->next) {    
+       for(p = verto_globals.profile_head; p; p = p->next) {
                verto_init_ssl(p);
        }
        switch_mutex_unlock(verto_globals.mutex);
@@ -4903,7 +4903,7 @@ static void print_status(verto_profile_t *profile, switch_stream_handle_t *strea
        for(p = profile->jsock_head; p; p = p->next) {
                if (p->ptype & PTYPE_CLIENT) {
                        int i;
-                       
+
                        for (i = 0; i < profile->i; i++) {
                                if (profile->server_socket[i] == p->local_sock) {
                                        stream->write_function(stream, "%s\t%s:%d\n", p->name, profile->ip[i].local_ip, profile->ip[i].local_port);
@@ -5065,7 +5065,7 @@ static void *SWITCH_THREAD_FUNC profile_thread(switch_thread_t *thread, void *ob
        profile->running = 0;
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "profile %s shutdown, Waiting for %d threads\n", profile->name, profile->jsock_count);
-       
+
        while(--sanity > 0 && profile->jsock_count > 0) {
                switch_yield(100000);
        }
@@ -5121,8 +5121,8 @@ static void run_profiles(void)
 static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session,
                                                                                                  switch_event_t *var_event,
                                                                                                  switch_caller_profile_t *outbound_profile,
-                                                                                                 switch_core_session_t **new_session, 
-                                                                                                 switch_memory_pool_t **pool, 
+                                                                                                 switch_core_session_t **new_session,
+                                                                                                 switch_memory_pool_t **pool,
                                                                                                  switch_originate_flag_t flags,
                                                                                                  switch_call_cause_t *cancel_cause);
 switch_io_routines_t verto_io_routines = {
@@ -5152,7 +5152,7 @@ static switch_status_t verto_read_text_frame(switch_core_session_t *session, swi
 {
        verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY);
        switch_status_t status;
-       
+
        switch_mutex_lock(tech_pvt->text_cond_mutex);
 
        status = switch_thread_cond_timedwait(tech_pvt->text_cond, tech_pvt->text_cond_mutex, 100000);
@@ -5183,7 +5183,7 @@ static switch_status_t verto_write_text_frame(switch_core_session_t *session, sw
 
        switch_mutex_lock(tech_pvt->text_write_mutex);
 
-       
+
        if (frame) {
                switch_buffer_write(tech_pvt->text_write_buffer, frame->data, frame->datalen);
        }
@@ -5208,7 +5208,7 @@ static switch_status_t verto_write_text_frame(switch_core_session_t *session, sw
                        }
                }
        }
-       
+
 
        switch_mutex_unlock(tech_pvt->text_write_mutex);
 
@@ -5260,9 +5260,9 @@ static char *verto_get_dial_string(const char *uid, switch_stream_handle_t *rstr
 
        switch_mutex_lock(verto_globals.mutex);
        for(profile = verto_globals.profile_head; profile; profile = profile->next) {
-               
+
                switch_mutex_lock(profile->mutex);
-               
+
                for(jsock = profile->jsock_head; jsock; jsock = jsock->next) {
                        if (jsock->ready && !zstr(jsock->uid) && !zstr(uid) && !strcmp(uid, jsock->uid)) {
                                use_stream->write_function(use_stream, "%s/u:%s,", EP_NAME, jsock->uuid_str);
@@ -5305,8 +5305,8 @@ SWITCH_STANDARD_API(verto_contact_function)
 static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session,
                                                                                                  switch_event_t *var_event,
                                                                                                  switch_caller_profile_t *outbound_profile,
-                                                                                                 switch_core_session_t **new_session, 
-                                                                                                 switch_memory_pool_t **pool, 
+                                                                                                 switch_core_session_t **new_session,
+                                                                                                 switch_memory_pool_t **pool,
                                                                                                  switch_originate_flag_t flags,
                                                                                                  switch_call_cause_t *cancel_cause)
 {
@@ -5343,16 +5343,16 @@ static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session
                        if ((flags & SOF_NO_LIMITS)) {
                                myflags |= SOF_NO_LIMITS;
                        }
-                       
+
                        if ((flags & SOF_FORKED_DIAL)) {
                                myflags |= SOF_NOBLOCK;
                        }
-                       
+
                        if (switch_ivr_originate(session, new_session, &cause, dial_str, 0, NULL,
                                                                         NULL, NULL, outbound_profile, var_event, myflags, cancel_cause) == SWITCH_STATUS_SUCCESS) {
                                switch_core_session_rwunlock(*new_session);
                        }
-                       
+
                        free(dial_str);
                }
 
@@ -5360,7 +5360,7 @@ static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session
        } else {
                const char *dialed_user = switch_event_get_header(var_event, "dialed_user");
                const char *dialed_domain = switch_event_get_header(var_event, "dialed_domain");
-               
+
                if (dialed_user) {
                        if (dialed_domain) {
                                switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, "verto_orig_dest", "%s@%s", dialed_user, dialed_domain);
@@ -5381,7 +5381,7 @@ static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session
                switch_caller_profile_t *caller_profile;
                verto_pvt_t *tech_pvt = NULL;
                char name[512];
-               
+
                tech_pvt = switch_core_session_alloc(*new_session, sizeof(*tech_pvt));
                tech_pvt->pool = switch_core_session_get_pool(*new_session);
                tech_pvt->session = *new_session;
@@ -5393,7 +5393,7 @@ static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session
 
                if (session) {
                        switch_channel_t *ochannel = switch_core_session_get_channel(session);
-                       
+
                        if (switch_true(switch_channel_get_variable(ochannel, SWITCH_BYPASS_MEDIA_VARIABLE))) {
                                switch_channel_set_flag(channel, CF_PROXY_MODE);
                                switch_channel_set_flag(ochannel, CF_PROXY_MODE);
@@ -5405,7 +5405,7 @@ static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session
                if ((tech_pvt->smh = switch_core_session_get_media_handle(*new_session))) {
                        tech_pvt->mparams = switch_core_media_get_mparams(tech_pvt->smh);
                }
-               
+
                switch_snprintf(name, sizeof(name), "verto.rtc/%s", tech_pvt->jsock_uuid);
                switch_channel_set_name(channel, name);
                switch_channel_set_variable(channel, "jsock_uuid_str", tech_pvt->jsock_uuid);
@@ -5413,9 +5413,9 @@ static switch_call_cause_t verto_outgoing_channel(switch_core_session_t *session
 
 
                if ((caller_profile = switch_caller_profile_dup(switch_core_session_get_pool(*new_session), outbound_profile))) {
-                       switch_channel_set_caller_profile(channel, caller_profile);        
-               } 
-               
+                       switch_channel_set_caller_profile(channel, caller_profile);
+               }
+
                switch_channel_add_state_handler(channel, &verto_state_handlers);
                switch_core_event_hook_add_receive_message(*new_session, messagehook);
                switch_channel_set_state(channel, CS_INIT);
@@ -5482,9 +5482,9 @@ static int verto_send_chat(const char *uid, const char *call_id, cJSON *msg)
 
        switch_mutex_lock(verto_globals.mutex);
        for(profile = verto_globals.profile_head; profile; profile = profile->next) {
-               
+       
                switch_mutex_lock(profile->mutex);
-               
+
                for(jsock = profile->jsock_head; jsock; jsock = jsock->next) {
                        if (jsock->ready && !zstr(jsock->uid) && !strcmp(uid, jsock->uid)) {
                                jsock_queue_event(jsock, &msg, SWITCH_FALSE);
@@ -5505,7 +5505,7 @@ static switch_status_t chat_send(switch_event_t *message_event)
        const char *to = switch_event_get_header(message_event, "to");
        const char *from = switch_event_get_header(message_event, "from");
        const char *body = switch_event_get_body(message_event);
-       const char *call_id = switch_event_get_header(message_event, "call_id"); 
+       const char *call_id = switch_event_get_header(message_event, "call_id");
 
        //DUMP_EVENT(message_event);
 
@@ -5516,14 +5516,14 @@ static switch_status_t chat_send(switch_event_t *message_event)
 
                obj = jrpc_new_req("verto.info", call_id, &params);
                msg = json_add_child_obj(params, "msg", NULL);
-               
+
                cJSON_AddItemToObject(msg, "from", cJSON_CreateString(from));
                cJSON_AddItemToObject(msg, "to", cJSON_CreateString(to));
                cJSON_AddItemToObject(msg, "body", cJSON_CreateString(body));
 
                for (eh = message_event->headers; eh; eh = eh->next) {
                        if ((!strncasecmp(eh->name, "from_", 5) || !strncasecmp(eh->name, "to_", 3))) {
-                               cJSON_AddItemToObject(msg, eh->name, cJSON_CreateString(eh->value)); 
+                               cJSON_AddItemToObject(msg, eh->name, cJSON_CreateString(eh->value));
                        }
                }
 
@@ -5546,7 +5546,7 @@ static switch_cache_db_handle_t *json_get_db_handle(void)
 
        switch_cache_db_handle_t *dbh = NULL;
        const char *dsn;
-       
+
 
        if (!(dsn = switch_core_get_variable("json_db_handle"))) {
                dsn = "json";
@@ -5556,7 +5556,7 @@ static switch_cache_db_handle_t *json_get_db_handle(void)
        if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) {
                dbh = NULL;
        }
-       
+
        return dbh;
 }
 
@@ -5564,7 +5564,7 @@ static switch_cache_db_handle_t *json_get_db_handle(void)
 static int jcallback(void *pArg, int argc, char **argv, char **columnNames)
 {
        char **data = (char **) pArg;
-       
+
        if (argv[0] && !*data) {
                *data = strdup(argv[0]);
        }
@@ -5767,7 +5767,7 @@ SWITCH_STANDARD_JSON_API(json_store_function)
                switch_mutex_unlock(json_GLOBALS.store_mutex);
        } else {
                JSON_STORE = switch_core_hash_find(json_GLOBALS.store_hash, storename);
-               
+
                if (!JSON_STORE) {
                        JSON_STORE = cJSON_CreateObject();
                        switch_core_hash_insert(json_GLOBALS.store_hash, storename, JSON_STORE);
@@ -5778,7 +5778,7 @@ SWITCH_STANDARD_JSON_API(json_store_function)
        switch(cmd) {
        case CMD_RETRIEVE:
                obj = json_retrieve(file, NULL);
-               
+
                if (!obj) {
                        error = "CANNOT LOAD DATA";
 
@@ -5787,7 +5787,7 @@ SWITCH_STANDARD_JSON_API(json_store_function)
                        } else {
                                switch_mutex_unlock(json_GLOBALS.store_mutex);
                        }
-                       
+
                        goto end;
                }
 
@@ -5831,7 +5831,7 @@ SWITCH_STANDARD_JSON_API(json_store_function)
        default:
                break;
        }
-       
+
 
        if (switch_true(verbose) || cmd == CMD_DUMP) {
                cJSON *dump;
@@ -5856,7 +5856,7 @@ SWITCH_STANDARD_JSON_API(json_store_function)
        } else {
                switch_mutex_unlock(json_GLOBALS.store_mutex);
        }
-       
+
        if (cmd == CMD_COMMIT || commit) {
                switch_bool_t ok;
 
@@ -5879,7 +5879,7 @@ SWITCH_STANDARD_JSON_API(json_store_function)
 
 
  end:
-       
+
        if (!zstr(error)) {
                cJSON_AddItemToObject(reply, "errorMessage", cJSON_CreateString(error));
        }
@@ -5932,7 +5932,7 @@ static void presence_event_handler(switch_event_t *event)
        add_it("calleeIDName", "caller-callee-id-name");
        add_it("calleeIDNumber", "caller-callee-id-number");
        add_it("channelUUID", "unique-id");
-       
+
        add_it("presenceCallDirection", "presence-call-direction");
        add_it("channelPresenceID", "channel-presence-id");
        add_it("channelPresenceData", "channel-presence-data");
@@ -5942,7 +5942,7 @@ static void presence_event_handler(switch_event_t *event)
                        add_it(hp->name, hp->name);
                }
        }
-       
+
        switch_event_channel_broadcast(event_channel, &msg, __FILE__, NO_EVENT_CHANNEL_ID);
 
        free(event_channel);
@@ -5970,7 +5970,7 @@ static void event_handler(switch_event_t *event)
                event_channel = switch_mprintf("FSevent.%s", switch_event_name(event->event_id));
                switch_tolower_max(event_channel + 8);
        }
-       
+
        cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(event_channel));
        cJSON_AddItemToObject(msg, "data", data);
 
@@ -5997,17 +5997,17 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_LOGIN);
                return SWITCH_STATUS_TERM;
        }
-       
+
        if (switch_event_reserve_subclass(MY_EVENT_CLIENT_DISCONNECT) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_CLIENT_DISCONNECT);
                return SWITCH_STATUS_TERM;
        }
-       
+
        if (switch_event_reserve_subclass(MY_EVENT_CLIENT_CONNECT) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_CLIENT_CONNECT);
                return SWITCH_STATUS_TERM;
        }
-       
+
        memset(&verto_globals, 0, sizeof(verto_globals));
        verto_globals.pool = pool;
 #ifndef WIN32
@@ -6034,7 +6034,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load)
        switch_thread_cond_create(&verto_globals.detach_cond, verto_globals.pool);
        verto_globals.detach_timeout = 120;
 
-       
+
 
 
        memset(&json_GLOBALS, 0, sizeof(json_GLOBALS));
@@ -6050,7 +6050,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load)
 
        switch_event_channel_bind(SWITCH_EVENT_CHANNEL_GLOBAL, verto_broadcast, &verto_globals.event_channel_id);
 
-       
+
        r = init();
 
        if (r) return SWITCH_STATUS_TERM;
@@ -6102,7 +6102,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_verto_shutdown)
        switch_event_free_subclass(MY_EVENT_LOGIN);
        switch_event_free_subclass(MY_EVENT_CLIENT_DISCONNECT);
        switch_event_free_subclass(MY_EVENT_CLIENT_CONNECT);
-       
+
        json_cleanup();
        switch_core_hash_destroy(&json_GLOBALS.store_hash);
 
index a54aea043baf13a462d3eca4797f6e8284e5b868..0ff73cdd2576c7cd17d210ad1a9c4c1b0096306b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Seven Du <dujinfang@gmail.com>
  *
@@ -41,7 +41,7 @@
 #else
 #include <sys/socket.h>
 #include <arpa/inet.h>
-#include <sys/wait.h> 
+#include <sys/wait.h>
 #endif
 #include <string.h>
 #ifndef WIN32
@@ -70,8 +70,8 @@
 
 #define VERTO_CHAT_PROTO "verto"
 
-#define copy_string(x,y,z) strncpy(x, y, z - 1) 
-#define set_string(x,y) strncpy(x, y, sizeof(x)-1) 
+#define copy_string(x,y,z) strncpy(x, y, z - 1)
+#define set_string(x,y) strncpy(x, y, sizeof(x)-1)
 
 #define CODE_INVALID -32600
 #define CODE_AUTH_REQUIRED -32000
@@ -131,7 +131,7 @@ struct jsock_s {
        char *uid;
        char *dialplan;
        char *context;
-       
+
 
        char remote_host[256];
        int remote_port;
@@ -139,7 +139,7 @@ struct jsock_s {
 
        struct verto_profile_s *profile;
        switch_thread_rwlock_t *rwlock;
-       
+
        switch_mutex_t *write_mutex;
        switch_mutex_t *filter_mutex;
 
@@ -189,9 +189,9 @@ typedef struct verto_pvt_s {
        switch_frame_t text_read_frame;
 
        switch_thread_cond_t *text_cond;
-       switch_mutex_t *text_cond_mutex; 
-       switch_mutex_t *text_read_mutex; 
-       switch_mutex_t *text_write_mutex; 
+       switch_mutex_t *text_cond_mutex;
+       switch_mutex_t *text_read_mutex;
+       switch_mutex_t *text_write_mutex;
 
        switch_buffer_t *text_read_buffer;
        switch_buffer_t *text_write_buffer;
@@ -235,7 +235,7 @@ struct verto_profile_s {
        int ssl_ready;
        int ready;
        int debug;
-       
+
        int in_thread;
        int blind_reg;
 
@@ -310,8 +310,8 @@ struct globals_s {
        switch_thread_rwlock_t *tech_rwlock;
 
        switch_thread_cond_t *detach_cond;
-       switch_mutex_t *detach_mutex; 
-       switch_mutex_t *detach2_mutex; 
+       switch_mutex_t *detach_mutex;
+       switch_mutex_t *detach2_mutex;
 
        uint32_t detached;
        uint32_t detach_timeout;
index 8922569df0c1f9ccfb2e16a2bccb92a32e3a91a4..54e12543d4e933d19f967817168069302f6a2103 100644 (file)
@@ -14,7 +14,7 @@
 #define ms_sleep(x)    usleep( x * 1000);
 #else
 #define ms_sleep(x) Sleep( x );
-#endif                         
+#endif
 
 #ifdef _MSC_VER
 /* warning C4706: assignment within conditional expression*/
@@ -32,11 +32,11 @@ static struct ws_globals_s ws_globals;
 
 #ifndef WSS_STANDALONE
 
-void init_ssl(void) 
+void init_ssl(void)
 {
        //      SSL_library_init();
 }
-void deinit_ssl(void) 
+void deinit_ssl(void)
 {
        return;
 }
@@ -169,28 +169,28 @@ static int cheezy_get_var(char *data, char *name, char *buf, size_t buflen)
          e = strchr(v, '\n');
        }
       }
-                       
+
       if (v && e) {
        int cplen;
        size_t len = e - v;
-       
+
        if (len > buflen - 1) {
          cplen = buflen -1;
        } else {
          cplen = len;
        }
-       
+
        strncpy(buf, v, cplen);
        *(buf+cplen) = '\0';
        return 1;
       }
-      
+
     }
   }
   return 0;
 }
 
-static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t olen) 
+static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t olen)
 {
        int y=0,bytes=0;
        size_t x=0;
@@ -234,7 +234,7 @@ static void sha1_digest(char *digest, unsigned char *in)
        SHA1Update(&sha, in, strlen(in));
        SHA1Final(&sha, digest);
 }
-#else 
+#else
 
 static void sha1_digest(unsigned char *digest, char *in)
 {
@@ -277,13 +277,13 @@ int ws_handshake(wsh_t *wsh)
        }
 
        *(wsh->buffer + wsh->datalen) = '\0';
-       
+
        if (strncasecmp(wsh->buffer, "GET ", 4)) {
                goto err;
        }
-       
+
        p = wsh->buffer + 4;
-       
+
        e = strchr(p, ' ');
        if (!e) {
                goto err;
@@ -296,11 +296,11 @@ int ws_handshake(wsh_t *wsh)
        cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key));
        cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version));
        cheezy_get_var(wsh->buffer, "Sec-WebSocket-Protocol", proto, sizeof(proto));
-       
+
        if (!*key) {
                goto err;
        }
-               
+
        snprintf(input, sizeof(input), "%s%s", key, WEBSOCKET_GUID);
        sha1_digest(output, input);
        b64encode((unsigned char *)output, SHA1_HASH_SIZE, (unsigned char *)b64, sizeof(b64));
@@ -309,7 +309,7 @@ int ws_handshake(wsh_t *wsh)
                snprintf(proto_buf, sizeof(proto_buf), "Sec-WebSocket-Protocol: %s\r\n", proto);
        }
 
-       snprintf(respond, sizeof(respond), 
+       snprintf(respond, sizeof(respond),
                         "HTTP/1.1 101 Switching Protocols\r\n"
                         "Upgrade: websocket\r\n"
                         "Connection: Upgrade\r\n"
@@ -358,7 +358,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
 
                        if (r == -1) {
                                err = SSL_get_error(wsh->ssl, r);
-                               
+
                                if (err == SSL_ERROR_WANT_READ) {
                                        if (!block) {
                                                r = -2;
@@ -393,7 +393,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
                        }
                }
        } while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 1000);
-       
+
  end:
 
        if (wsh->x >= 10000 || (block && wsh->x >= 1000)) {
@@ -407,7 +407,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
        if (r >= 0) {
                wsh->x = 0;
        }
-       
+
        return r;
 }
 
@@ -448,13 +448,13 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
                if (ssl_err) {
                        r = ssl_err * -1;
                }
-               
+
                return r;
        }
 
        do {
                r = send(wsh->sock, (void *)((unsigned char *)data + wrote), bytes - wrote, 0);
-               
+
                if (r > 0) {
                        wrote += r;
                }
@@ -471,9 +471,9 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
                        }
                        ms_sleep(ms);
                }
-               
+
        } while (--sanity > 0 && ((r == -1 && xp_is_blocking(xp_errno())) || (wsh->block && wrote < bytes)));
-       
+
        //if (r<0) {
                //printf("wRITE FAIL: %s\n", strerror(errno));
        //}
@@ -559,7 +559,7 @@ int establish_logical_layer(wsh_t *wsh)
                        if (code == 0) {
                                return -1;
                        }
-                       
+
                        if (code < 0) {
                                if (code == -1 && SSL_get_error(wsh->ssl, code) != SSL_ERROR_WANT_READ) {
                                        return -1;
@@ -579,11 +579,11 @@ int establish_logical_layer(wsh_t *wsh)
                        }
 
                } while (wsh->sanity > 0);
-               
+
                if (!wsh->sanity) {
                        return -1;
                }
-               
+
        }
 
        while (!wsh->down && !wsh->handshake) {
@@ -601,7 +601,7 @@ int establish_logical_layer(wsh_t *wsh)
        }
 
        wsh->logical_established = 1;
-       
+
        return 0;
 }
 
@@ -662,7 +662,7 @@ void ws_destroy(wsh_t *wsh)
        if (wsh->down > 1) {
                return;
        }
-       
+
        wsh->down = 2;
 
        if (wsh->write_buffer) {
@@ -688,15 +688,15 @@ void ws_destroy(wsh_t *wsh)
 
 }
 
-ssize_t ws_close(wsh_t *wsh, int16_t reason) 
+ssize_t ws_close(wsh_t *wsh, int16_t reason)
 {
-       
+
        if (wsh->down) {
                return -1;
        }
 
        wsh->down = 1;
-       
+
        if (wsh->uri) {
                free(wsh->uri);
                wsh->uri = NULL;
@@ -724,7 +724,7 @@ ssize_t ws_close(wsh_t *wsh, int16_t reason)
        wsh->sock = ws_sock_invalid;
 
        return reason * -1;
-       
+
 }
 
 
@@ -743,7 +743,7 @@ uint64_t ntoh64(uint64_t val)
 
 ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
 {
-       
+
        ssize_t need = 2;
        char *maskp;
        int ll = 0;
@@ -778,7 +778,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                }
                return ws_close(wsh, WS_PROTO_ERR);
        }
-       
+
        if (wsh->datalen < need) {
                if ((wsh->datalen += ws_raw_read(wsh, wsh->buffer + wsh->datalen, 9 - wsh->datalen, WS_BLOCK)) < need) {
                        /* too small - protocol err */
@@ -804,7 +804,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                {
                        int fin = (wsh->buffer[0] >> 7) & 1;
                        int mask = (wsh->buffer[1] >> 7) & 1;
-                       
+
 
                        if (!fin && *oc != WSOC_CONTINUATION) {
                                frag = 1;
@@ -814,7 +814,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
 
                        if (mask) {
                                need += 4;
-                               
+
                                if (need > wsh->datalen) {
                                        /* too small - protocol err */
                                        *oc = WSOC_CLOSE;
@@ -824,7 +824,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
 
                        wsh->plen = wsh->buffer[1] & 0x7f;
                        wsh->payload = &wsh->buffer[2];
-                       
+
                        if (wsh->plen == 127) {
                                uint64_t *u64;
                                int more = 0;
@@ -847,7 +847,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
 
 
                                }
-                               
+
                                u64 = (uint64_t *) wsh->payload;
                                wsh->payload += 8;
                                wsh->plen = ntoh64(*u64);
@@ -884,7 +884,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
 
                        if (need + blen > (ssize_t)wsh->bbuflen) {
                                void *tmp;
-                               
+
                                wsh->bbuflen = need + blen + wsh->rplen;
 
                                if ((tmp = realloc(wsh->bbuffer, wsh->bbuflen))) {
@@ -897,11 +897,11 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                        }
 
                        wsh->rplen = wsh->plen - need;
-                       
+
                        if (wsh->rplen) {
                                memcpy(wsh->body, wsh->payload, wsh->rplen);
                        }
-                       
+
                        while(need) {
                                ssize_t r = ws_raw_read(wsh, wsh->body + wsh->rplen, need, WS_BLOCK);
 
@@ -915,7 +915,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                                wsh->rplen += r;
                                need -= r;
                        }
-                       
+
                        if (mask && maskp) {
                                ssize_t i;
 
@@ -923,7 +923,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                                        wsh->body[i] ^= maskp[i % 4];
                                }
                        }
-                       
+
 
                        if (*oc == WSOC_PING) {
                                ws_write_frame(wsh, WSOC_PONG, wsh->body, wsh->rplen);
@@ -939,7 +939,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                        }
 
                        *data = (uint8_t *)wsh->bbuffer;
-                       
+
                        //printf("READ[%ld][%d]-----------------------------:\n[%s]\n-------------------------------\n", wsh->packetlen, *oc, (char *)*data);
 
 
@@ -987,7 +987,7 @@ ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes)
 
                hdr[1] = 127;
                hlen += 8;
-               
+
                u64 = (uint64_t *) &hdr[2];
                *u64 = hton64(bytes);
        }
@@ -1002,17 +1002,17 @@ ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes)
                        abort();
                }
        }
-       
+
        bp = (uint8_t *) wsh->write_buffer;
        memcpy(bp, (void *) &hdr[0], hlen);
        memcpy(bp + hlen, data, bytes);
-       
+
        raw_ret = ws_raw_write(wsh, bp, (hlen + bytes));
 
        if (raw_ret != (ssize_t) (hlen + bytes)) {
                return raw_ret;
        }
-       
+
        return bytes;
 }
 
index 12b3a2560d6a5d4a0acc1d5fb6195b62250ac1ce..5b4986acb4b1bcac8483b0f9db0a5ea8c06434a9 100644 (file)
@@ -9,7 +9,7 @@
 #include <sys/types.h>
 #ifndef _MSC_VER
 #include <arpa/inet.h>
-#include <sys/wait.h> 
+#include <sys/wait.h>
 #include <sys/socket.h>
 #include <unistd.h>
 #else
@@ -25,7 +25,7 @@
 //#include "sha1.h"
 #include <openssl/ssl.h>
 
-#if defined(_MSC_VER) || defined(__APPLE__) || defined(__FreeBSD__) || (defined(__SVR4) && defined(__sun)) 
+#if defined(_MSC_VER) || defined(__APPLE__) || defined(__FreeBSD__) || (defined(__SVR4) && defined(__sun))
 #define __bswap_64(x) \
   x = (x>>56) | \
     ((x<<40) & 0x00FF000000000000) | \
@@ -137,7 +137,7 @@ int xp_is_blocking(int errcode);
 
 #ifndef _MSC_VER
 static inline uint64_t get_unaligned_uint64(const void *p)
-{   
+{
     const struct { uint64_t d; } __attribute__((packed)) *pp = p;
     return pp->d;
 }
index 5eba349998953615af50ed437af21e6092be5e86..145d8112ffc50d85e8e1e60357456f952f9eabed 100644 (file)
@@ -93,27 +93,27 @@ typedef struct {
   char *content_type;
   mod_amqp_keypart_t format_fields[MAX_ROUTING_KEY_FORMAT_FIELDS+1];
 
-  
+
   /* Array to store the possible event subscriptions */
   int event_subscriptions;
   switch_event_node_t *event_nodes[SWITCH_EVENT_ALL];
   switch_event_types_t event_ids[SWITCH_EVENT_ALL];
   switch_event_node_t *eventNode;
-  
+
 
   /* Because only the 'running' thread will be reading or writing to the two connection pointers
-   * this does not 'yet' need a read/write lock. Before these structures can be destroyed, 
+   * this does not 'yet' need a read/write lock. Before these structures can be destroyed,
    * the running thread must be joined first.
    */
   mod_amqp_connection_t *conn_root;
   mod_amqp_connection_t *conn_active;
-  
+
   /* Rabbit connections are not thread safe so one connection per thread.
      Communicate with sender thread using a queue */
   switch_thread_t *producer_thread;
   switch_queue_t *send_queue;
   unsigned int send_queue_size;
-  
+
   int reconnect_interval_ms;
   int circuit_breaker_ms;
   switch_time_t circuit_breaker_reset_time;
@@ -126,7 +126,7 @@ typedef struct {
 
 typedef struct {
   char *name;
-  
+
   char *exchange;
   char *queue;
   char *binding_key;
@@ -134,7 +134,7 @@ typedef struct {
   /* Note: The AMQP channel is not reentrant this MUTEX serializes sending events. */
   mod_amqp_connection_t *conn_root;
   mod_amqp_connection_t *conn_active;
-  
+
   int reconnect_interval_ms;
 
   /* Listener thread */
@@ -148,7 +148,7 @@ typedef struct {
 
 typedef struct {
   char *name;
-  
+
   char *exchange;
   char *exchange_type;
   int exchange_durable;
@@ -159,7 +159,7 @@ typedef struct {
   /* Note: The AMQP channel is not reentrant this MUTEX serializes sending events. */
   mod_amqp_connection_t *conn_root;
   mod_amqp_connection_t *conn_active;
-  
+
   int reconnect_interval_ms;
 
   /* Logging thread */
index 1c4676cc22266c4cd9f5d99e9134ce8fa8c15af3..bf0428fdba7f6fec16fa968e7c2465c18b387cbc 100644 (file)
@@ -179,7 +179,7 @@ switch_status_t mod_amqp_command_create(char *name, switch_xml_t cfg)
        }
        profile->conn_active = NULL;
        /* We are not going to open the command queue connection on create, but instead wait for the running thread to open it */
-       
+
        /* Start the worker threads */
        switch_threadattr_create(&thd_attr, profile->pool);
        switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -279,7 +279,7 @@ void * SWITCH_THREAD_FUNC mod_amqp_command_thread(switch_thread_t *thread, void
                                continue;
                        }
 
-                       /* Check if exchange already exists */ 
+                       /* Check if exchange already exists */
                        amqp_exchange_declare(profile->conn_active->state, 1,
                                                                  amqp_cstring_bytes(profile->exchange),
                                                                  amqp_cstring_bytes("topic"),
index da512cef39e4a0949d0b8c555e8c334395324bf4..8218f282ec4bb101f9b5572e44b37c8ca84dc0f1 100644 (file)
@@ -250,12 +250,12 @@ switch_status_t mod_amqp_logging_create(char *name, switch_xml_t cfg)
                                                  0, /* passive */
                                                  profile->exchange_durable,
                                                  amqp_empty_table);
-       
+
        if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring exchange")) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] failed to create exchange\n", profile->name);
                goto err;
        }
-       
+
        /* Create a bounded FIFO queue for sending messages */
        if (switch_queue_create(&(profile->send_queue), profile->send_queue_size, profile->pool) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create send queue of size %d!\n", profile->send_queue_size);
@@ -382,7 +382,7 @@ void * SWITCH_THREAD_FUNC mod_amqp_logging_thread(switch_thread_t *thread, void
 
       default:
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send failed with a generic error\n");
-       
+
        /* Send failed and closed the connection; reconnect will happen at the beginning of the loop
         * NB: do we need a delay here to prevent a fast reconnect-send-fail loop? */
        break;
index 12ba35a5df86b31839bb4acdb66ce4d654da2d59..72185477f878f84dd64867e7ebc6d20a2607405a 100644 (file)
@@ -332,12 +332,12 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg)
                                                  0, /* passive */
                                                  profile->exchange_durable,
                                                  amqp_empty_table);
-       
+
        if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring exchange")) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] failed to create exchange\n", profile->name);
                goto err;
        }
-       
+
        /* Create a bounded FIFO queue for sending messages */
        if (switch_queue_create(&(profile->send_queue), profile->send_queue_size, profile->pool) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create send queue of size %d!\n", profile->send_queue_size);
index 08c033262f56cc39c6953e316258c220f81aa1eb..1ce494a334e04b5404e2a1dbd854b106ab53153a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * mod_cdr_csv.c -- Asterisk Compatible CDR Module
  *
  */
index 36fa9f65c4fcd5a67a4dba53023773623da3f27d..381e127401d6ca07943e1f415720c36f6c6aa4d0 100644 (file)
@@ -67,7 +67,7 @@ int mongo_env_write_socket( mongo *conn, const void *buf, int len ) {
     while ( len ) {
         int sent = send( conn->sock, cbuf, len, flags );
         if ( sent == -1 ) {
-            if (errno == EPIPE) 
+            if (errno == EPIPE)
                 conn->connected = 0;
             conn->err = MONGO_IO_ERROR;
             return MONGO_ERROR;
index 4b38928b05965f4f06876f464981681fab42d488..6cb980d093365ff4eb348799c4dafcf60118212c 100644 (file)
@@ -154,7 +154,7 @@ int mongo_env_socket_connect( mongo *conn, const char *host, int port ) {
     if ( ! conn->connected ) {
         conn->err = MONGO_CONN_FAIL;
         return MONGO_ERROR;
-    } 
+    }
     else {
         mongo_clear_errors( conn );
         return MONGO_OK;
index db80dea23c986c5413a8f79334e05e5fbd0dcbe2..57332a8a01323ba3189b488f6a622f55caaf0a47 100644 (file)
@@ -564,7 +564,7 @@ MONGO_EXPORT int gridfile_get_numchunks( gridfile *gfile ) {
 
 MONGO_EXPORT void gridfile_get_chunk( gridfile *gfile, int n, bson* out ) {
     bson query;
-    
+
     bson_iterator it;
     bson_oid_t id;
     int result;
index 618ffbdfdfec09f231a57e81406f0a2fa6ab828d..51da18d078bbb459170f67712e8b9b720bc1bf9d 100644 (file)
@@ -376,7 +376,7 @@ static int mongo_check_is_master( mongo *conn ) {
         if( bson_find( &it, &out, "ismaster" ) )
             ismaster = bson_iterator_bool( &it );
         if( bson_find( &it, &out, "maxBsonObjectSize" ) ) {
-            max_bson_size = bson_iterator_int( &it ); 
+            max_bson_size = bson_iterator_int( &it );
         }
         conn->max_bson_size = max_bson_size;
     } else {
@@ -556,7 +556,7 @@ static int mongo_replset_check_host( mongo *conn ) {
             ismaster = bson_iterator_bool( &it );
 
         if( bson_find( &it, &out, "maxBsonObjectSize" ) )
-            max_bson_size = bson_iterator_int( &it ); 
+            max_bson_size = bson_iterator_int( &it );
         conn->max_bson_size = max_bson_size;
 
         if( bson_find( &it, &out, "setName" ) ) {
index 74a4c5df8ea56f85fb80e2dad06ec1cc3fbf2aa7..cdd9d3390d9937c5a328784435fc5bca1b2e3df2 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -23,7 +23,7 @@
  *
  * Contributor(s):
  * Daniel Swarbrick <daniel.swarbrick@gmail.com>
- * 
+ *
  * mod_cdr_mongodb.c -- MongoDB CDR Module
  *
  * Derived from:
index c6c22f27ebd490c77db6e34c6a7bd1c4535e39d4..81070438ff64781312dc12bea0cb031804242b47 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -25,7 +25,7 @@
  *
  * Contributor(s):
  * Daniel Swarbrick <daniel.swarbrick@gmail.com>
- * 
+ *
  * mod_cdr_sqlite.c -- SQLite CDR Module
  *
  * Derived from:
index 62deb84f67a6f6e7ed55c1281016e3f1d312a58e..9620809090df8292d0b0c9e50e9390b4cb22169b 100644 (file)
@@ -16,7 +16,7 @@
     <!-- in additon to cookie, optionally restrict by ACL -->
     <!--<param name="apply-inbound-acl" value="lan"/>-->
     <!-- alternative is "binary" -->
-    <!--<param name="encoding" value="string"/>--> 
+    <!--<param name="encoding" value="string"/>-->
     <!-- provide compatability with previous OTP release (use with care) -->
     <!--<param name="compat-rel" value="12"/> -->
   </settings>
index 8df561a1393307e71021a00082d6c78682f8d7d4..7d23815585631bd18f9bd94288e72287ae178e0f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Andrew Thompson <andrew@hijacked.us>
  * Rob Charlton <rob.charlton@savageminds.com>
@@ -42,7 +42,7 @@
 
 /* Stolen from code added to ei in R12B-5.
  * Since not everyone has this version yet;
- * provide our own version. 
+ * provide our own version.
  * */
 
 #define put8(s,n) do { \
@@ -132,7 +132,7 @@ void ei_encode_switch_event_tag(ei_x_buff * ebuf, switch_event_t *event, char *t
        ei_encode_switch_event_headers(ebuf, event);
 }
 
-/* function to make rpc call to remote node to retrieve a pid - 
+/* function to make rpc call to remote node to retrieve a pid -
    calls module:function(Ref). The response comes back as
    {rex, {Ref, Pid}}
  */
index 56f0c45850046e6cce8d21756dd843315b689d7a..292134d716ddf3d54154d00047e8eb9e5fb14652 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Andrew Thompson <andrew@hijacked.us>
  * Rob Charlton <rob.charlton@savageminds.com>
@@ -180,7 +180,7 @@ static switch_status_t handle_msg_fetch_reply(listener_t *listener, ei_x_buff *
                /* reply mutex is locked */
                if ((p = find_fetch_reply(uuid_str))) {
                        switch (p->state) {
-                       case reply_waiting: 
+                       case reply_waiting:
                                {
                                        /* clone the reply so it doesn't get destroyed on us */
                                        ei_x_buff *nbuf = malloc(sizeof(*nbuf));
@@ -188,14 +188,14 @@ static switch_status_t handle_msg_fetch_reply(listener_t *listener, ei_x_buff *
                                        memcpy(nbuf->buff, buf->buff, buf->buffsz);
                                        nbuf->index = buf->index;
                                        nbuf->buffsz = buf->buffsz;
-                                       
+
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got reply for %s\n", uuid_str);
-                                       
+
                                        /* copy info into the reply struct */
                                        p->state = reply_found;
                                        p->reply = nbuf;
                                        strncpy(p->winner, listener->peer_nodename, MAXNODELEN);
-                                       
+
                                        /* signal waiting thread that its time to wake up */
                                        switch_thread_cond_signal(p->ready_or_found);
                                        /* reply OK */
@@ -440,7 +440,7 @@ static switch_status_t handle_msg_session_event(listener_t *listener, erlang_msg
 
                        switch_thread_rwlock_unlock(session->event_rwlock);
                        switch_thread_rwlock_unlock(session->rwlock);
-                       
+
                        ei_x_encode_atom(rbuf, "ok");
                } else {
                        ei_x_encode_tuple_header(rbuf, 2);
@@ -838,7 +838,7 @@ static switch_status_t handle_msg_sendevent(listener_t *listener, int arity, ei_
                                        } else if (!fail)  {
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, key, value);
                                        }
-                                       
+
                                        /* Do not free malloc here! The above commands utilize the raw allocated memory and skip any copying/duplication. Faster. */
                                }
 
@@ -891,7 +891,7 @@ static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_
                                                fail = SWITCH_TRUE;
                                                break;
                                        }
-                                       
+
                                        ei_get_type(buf->buff, &buf->index, &type, &size);
                                        value = malloc(size + 1);
 
@@ -1233,7 +1233,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg,
                switch_core_hash_this(iter, &key, NULL, &val);
                se = (session_elem_t*)val;
                if (switch_test_flag(se, LFLAG_WAITING_FOR_PID) && se->spawn_reply && !strncmp(se->spawn_reply->hash, hash, 100)) {
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "found matching session for %s : %s\n", hash, se->uuid_str);
 
                        switch_mutex_lock(se->spawn_reply->mutex);
@@ -1256,7 +1256,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg,
 
        if (found) {
                return SWITCH_STATUS_FALSE;
-       } 
+       }
 
        ei_x_encode_tuple_header(rbuf, 2);
        ei_x_encode_atom(rbuf, "error");
index 2cc7d680e3862703303dedc5fc71ca2fdf31673d..51839141e91c220f7a5b156385171df439a394b0 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Andrew Thompson <andrew@hijacked.us>
  * Rob Charlton <rob.charlton@savageminds.com>
@@ -409,7 +409,7 @@ static void destroy_session_elem(session_elem_t *session_element)
 session_elem_t *find_session_elem_by_uuid(listener_t *listener, const char *uuid)
 {
        session_elem_t *session = NULL;
-       
+
        switch_thread_rwlock_rdlock(listener->session_rwlock);
        if ((session = (session_elem_t*)switch_core_hash_find(listener->sessions, uuid))) {
                switch_thread_rwlock_rdlock(session->rwlock);
@@ -430,7 +430,7 @@ session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid)
        switch_thread_rwlock_rdlock(listener->session_rwlock);
        for (iter = switch_core_hash_first(listener->sessions); iter; iter = switch_core_hash_next(&iter)) {
                switch_core_hash_this(iter, &key, NULL, &val);
-               
+
                if (((session_elem_t*)val)->process.type == ERLANG_PID && !ei_compare_pids(pid, &((session_elem_t*)val)->process.pid)) {
                        session = (session_elem_t*)val;
                        switch_thread_rwlock_rdlock(session->rwlock);
@@ -443,7 +443,7 @@ session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid)
        return session;
 }
 
-static fetch_reply_t *new_fetch_reply(const char *uuid_str) 
+static fetch_reply_t *new_fetch_reply(const char *uuid_str)
 {
        fetch_reply_t *reply = NULL;
        switch_memory_pool_t *pool = NULL;
@@ -456,7 +456,7 @@ static fetch_reply_t *new_fetch_reply(const char *uuid_str)
        reply = switch_core_alloc(pool, sizeof(*reply));
        switch_assert(reply != NULL);
        memset(reply, 0, sizeof(*reply));
-       
+
        reply->uuid_str = switch_core_strdup(pool, uuid_str);
        reply->pool = pool;
        switch_thread_cond_create(&reply->ready_or_found, pool);
@@ -471,7 +471,7 @@ static fetch_reply_t *new_fetch_reply(const char *uuid_str)
        return reply;
 }
 
-static void destroy_fetch_reply(fetch_reply_t *reply) 
+static void destroy_fetch_reply(fetch_reply_t *reply)
 {
        switch_core_hash_delete_locked(mod_erlang_event_globals.fetch_reply_hash, reply->uuid_str, mod_erlang_event_globals.fetch_reply_mutex);
        /* lock so nothing can have it while we delete it */
@@ -484,7 +484,7 @@ static void destroy_fetch_reply(fetch_reply_t *reply)
        switch_core_destroy_memory_pool(&(reply->pool));
 }
 
-fetch_reply_t *find_fetch_reply(const char *uuid) 
+fetch_reply_t *find_fetch_reply(const char *uuid)
 {
        fetch_reply_t *reply = NULL;
 
@@ -736,7 +736,7 @@ static switch_status_t check_attached_sessions(listener_t *listener, int *msgs_s
 
                                /*switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "flushed event %s for %s\n", switch_event_name(pevent->event_id), sp->uuid_str); */
 
-                               /* events from attached sessions are wrapped in a {call_event,<EVT>} tuple 
+                               /* events from attached sessions are wrapped in a {call_event,<EVT>} tuple
                                   to distinguish them from normal events (if they are sent to the same process)
                                 */
 
@@ -776,7 +776,7 @@ static switch_status_t check_attached_sessions(listener_t *listener, int *msgs_s
 
                        /*switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "popped event %s for %s\n", switch_event_name(pevent->event_id), sp->uuid_str); */
 
-                       /* events from attached sessions are wrapped in a {call_event,<EVT>} tuple 
+                       /* events from attached sessions are wrapped in a {call_event,<EVT>} tuple
                           to distinguish them from normal events (if they are sent to the same process)
                         */
                        ei_x_buff ebuf;
@@ -1227,7 +1227,7 @@ static int config(void)
        prefs.compat_rel = 0;
        prefs.max_event_bulk = 1;
        prefs.max_log_bulk = 1;
-       
+
 
        if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
@@ -1531,14 +1531,14 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul
 
        /* insert the waiting marker */
        switch_set_flag(session_element, LFLAG_WAITING_FOR_PID);
-       
+
        /* attach the session to the listener */
        add_session_elem_to_listener(listener, session_element);
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Added session to listener\n");
 
        switch_mutex_lock(p->mutex);
-       
+
        if (!strcmp(function, "!")) {
                /* send a message to request a pid */
                ei_x_buff rbuf;
@@ -1668,7 +1668,7 @@ SWITCH_STANDARD_APP(erlang_outbound_function)
                return;
        }
 
-       
+
        /* first work out if there is a listener already talking to the node we want to talk to */
        listener = find_listener(node);
        /* if there is no listener, then create one */
index 3ec5e5aad54cdb2e27fc20e88ad2650f68226e7d..2f2c0ed0591001affdaf1838dd28799be55f9f34 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Andrew Thompson <andrew@hijacked.us>
  * Rob Charlton <rob.charlton@savageminds.com>
index 97fb9342622c353a10af7ec737b1001656178efd..011166b27066dd7c5e8102371931d5933368b71f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index e463bf3f8366230fe5c753bbd8303dac9872bb40..415e30131a26efbb495f4b47bed6b45395766f6a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Seven Du <dujinfang@gmail.com>
  *
@@ -313,7 +313,7 @@ static void event_handler(switch_event_t *event)
                                const char *hval;
 
                                send = 0;
-                               
+
                                for (hp = l->filters->headers; hp; hp = hp->next) {
                                        if ((hval = switch_event_get_header(event, hp->name))) {
                                                const char *comp_to = hp->value;
@@ -515,8 +515,8 @@ SWITCH_STANDARD_APP(socket_function)
 
                switch_ivr_parse_all_events(session);
 
-               if (switch_channel_get_state(channel) != CS_HIBERNATE && 
-                       !switch_channel_test_flag(channel, CF_REDIRECT) && !switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_RESET) 
+               if (switch_channel_get_state(channel) != CS_HIBERNATE &&
+                       !switch_channel_test_flag(channel, CF_REDIRECT) && !switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_RESET)
                        && (switch_test_flag(listener, LFLAG_RESUME) || ((var = switch_channel_get_variable(channel, "socket_resume")) && switch_true(var)))) {
                        switch_channel_set_state(channel, CS_EXECUTE);
                }
@@ -602,7 +602,7 @@ static void remove_listener(listener_t *listener)
 
 static void send_disconnect(listener_t *listener, const char *message)
 {
-       
+
        char disco_buf[512] = "";
        switch_size_t len, mlen;
 
@@ -611,7 +611,7 @@ static void send_disconnect(listener_t *listener, const char *message)
        }
 
        mlen = strlen(message);
-       
+
        if (listener->session) {
                switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n"
                                                "Controlled-Session-UUID: %s\n"
@@ -1226,7 +1226,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
                        ptr = (mbuf + pos);
 
                }
-               
+
                status = switch_socket_recv(listener->sock, ptr, &mlen);
 
                if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) {
@@ -1298,7 +1298,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
                                                                                        status = switch_socket_recv(listener->sock, p, &mlen);
 
                                                                                        if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) {
-                                                                                               free(body);                                                                                             
+                                                                                               free(body);
                                                                                                switch_goto_status(SWITCH_STATUS_FALSE, end);
                                                                                        }
 
@@ -1426,7 +1426,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
                        }
                }
 
-               if (switch_test_flag(listener, LFLAG_HANDLE_DISCO) && 
+               if (switch_test_flag(listener, LFLAG_HANDLE_DISCO) &&
                        listener->linger_timeout != (time_t) -1 && switch_epoch_time_now(NULL) > listener->linger_timeout) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "linger timeout, closing socket\n");
                        status = SWITCH_STATUS_FALSE;
@@ -1437,23 +1437,23 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
                        switch_set_flag_locked(listener, LFLAG_HANDLE_DISCO);
                        if (switch_test_flag(listener, LFLAG_LINGER)) {
                                char disco_buf[512] = "";
-                               
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "%s Socket Linger %d\n", 
+
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "%s Socket Linger %d\n",
                                                                  switch_channel_get_name(channel), (int)listener->linger_timeout);
-                               
+
                                switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n"
                                                                "Controlled-Session-UUID: %s\n"
-                                                               "Content-Disposition: linger\n" 
+                                                               "Content-Disposition: linger\n"
                                                                "Channel-Name: %s\n"
                                                                "Linger-Time: %d\n"
-                                                               "Content-Length: 0\n\n", 
+                                                               "Content-Length: 0\n\n",
                                                                switch_core_session_get_uuid(listener->session), switch_channel_get_name(channel), (int)listener->linger_timeout);
 
 
                                if (listener->linger_timeout != (time_t) -1) {
                                        listener->linger_timeout += switch_epoch_time_now(NULL);
                                }
-                               
+
                                len = strlen(disco_buf);
                                switch_socket_send(listener->sock, disco_buf, &len);
                        } else {
@@ -1608,7 +1608,7 @@ static switch_bool_t auth_api_command(listener_t *listener, const char *api_cmd,
        switch_bool_t ok = SWITCH_TRUE;
 
   top:
-       
+
        if (!switch_core_hash_find(listener->allowed_api_hash, check_cmd)) {
                ok = SWITCH_FALSE;
                goto end;
@@ -1662,7 +1662,7 @@ static void set_all_custom(listener_t *listener)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "ADDING CUSTOM EVENT: %s\n", m->val);
                        switch_core_hash_insert(listener->event_hash, m->val, MARKER);
                }
-               
+
                switch_console_free_matches(&events);
        }
 }
@@ -1674,7 +1674,7 @@ static void set_allowed_custom(listener_t *listener)
        void *val;
 
        switch_assert(listener->allowed_event_hash);
-       
+
        for (hi = switch_core_hash_first(listener->allowed_event_hash); hi; hi = switch_core_hash_next(&hi)) {
                switch_core_hash_this(hi, &var, NULL, &val);
                switch_core_hash_insert(listener->event_hash, (char *)var, MARKER);
@@ -1759,7 +1759,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                *tmp++ = '\0';
                                pass = tmp;
                        }
-                       
+
                        if (zstr(user) || zstr(domain_name)) {
                                switch_snprintf(reply, reply_len, "-ERR invalid");
                                switch_clear_flag_locked(listener, LFLAG_RUNNING);
@@ -2039,11 +2039,11 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                if ((uuid = cmd + 9)) {
                                        char *fmt;
                                        strip_cr(uuid);
-                                       
+
                                        if ((fmt = strchr(uuid, ' '))) {
                                                *fmt++ = '\0';
                                        }
-                                               
+
                                        if (!(listener->session = switch_core_session_locate(uuid))) {
                                                if (fmt) {
                                                        switch_snprintf(reply, reply_len, "-ERR invalid uuid");
@@ -2060,7 +2060,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                                        listener->format = EVENT_FORMAT_PLAIN;
                                                } else if (!strcasecmp(fmt, "json")) {
                                                        listener->format = EVENT_FORMAT_JSON;
-                                               }                                               
+                                               }
                                        }
 
                                        switch_set_flag_locked(listener, LFLAG_SESSION);
@@ -2216,7 +2216,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                const char *uuid = NULL;
                char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
                switch_uuid_str(uuid_str, sizeof(uuid_str));
-               
+
                switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-UUID", uuid_str);
 
                strip_cr(cmd);
@@ -2274,7 +2274,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                        if ((arg_copy = strchr(api_copy, ' '))) {
                                *arg_copy++ = '\0';
                        }
-                       
+
                        ok = auth_api_command(listener, api_copy, arg_copy);
                        free(api_copy);
 
@@ -2284,13 +2284,13 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                goto done;
                        }
                }
-               
+
                if (!(acs.console_execute = switch_true(console_execute))) {
                        if ((arg = strchr(api_cmd, ' '))) {
                                *arg++ = '\0';
                        }
                }
-               
+
                acs.listener = listener;
                acs.api_cmd = api_cmd;
                acs.arg = arg;
@@ -3011,13 +3011,13 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)
                        if (listener->sa && (listener->remote_port = switch_sockaddr_get_port(listener->sa))) {
                                launch_listener_thread(listener);
                                continue;
-                       } 
+                       }
                }
-               
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error initilizing connection\n");
                close_socket(&listener->sock);
                expire_listener(&listener);
-       
+
        }
 
   end:
index fe8e78e45e5560ac1163382d60a2fc2b263abc40..b01b8083e68f074fd1928dede12c792384d4d574 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index e29e710f13e20522b2c2908cfcad1bdc915a7774..b7f517bac28f8acf1aa193bda3d4638aafc549ad 100644 (file)
@@ -26,7 +26,7 @@ public:
 
                // Use the JSON string as the message body
                zmq::message_t msg(pjson, strlen(pjson), free_message_data, NULL);
-               
+
                // Send the message
                _publisher.send(msg);
        }
@@ -78,7 +78,7 @@ public:
        void Listen() {
                // All we do is sit here and block the run loop thread so it doesn't return
                // it seems that if you want to keep your module running you can't return from the run loop
-               
+
                char_msg msg;
                while(true) {
                        // Listen for term message
index 3e5cdaf1532ccb76a4c1daf0939ca3107d3688b9..1b44a273b074ef2d10ed8117b8fd4f807f2a21a0 100644 (file)
@@ -1,6 +1,6 @@
 <configuration name="format_cdr.conf" description="Multi Format CDR CURL logger">
 
- <!-- You can have multiple profiles, to allow logging to both json and cdr simultaneously, or to 
+ <!-- You can have multiple profiles, to allow logging to both json and cdr simultaneously, or to
         different paths or servers with different settings, just be sure to use different name for
         each profile. -->
  <profiles>
@@ -35,7 +35,7 @@
     <!-- optional: if not present we do log the b leg -->
     <!-- true or false if we should create a cdr for the b leg of a call-->
     <param name="log-b-leg" value="false"/>
-    
+
     <!-- optional: if not present, all filenames are the uuid of the call -->
     <!-- true or false if a leg files are prefixed "a_" -->
     <param name="prefix-a-leg" value="true"/>
     <!-- encode the post data may be 'true' for url encoding, 'false' for no encoding, 'base64' for base64 encoding or 'textxml' for text/xml -->
     <param name="encode" value="true"/>
 
-    <!-- optional: set to true to disable Expect: 100-continue lighttpd requires this setting --> 
-    <!--<param name="disable-100-continue" value="true"/>--> 
-    
+    <!-- optional: set to true to disable Expect: 100-continue lighttpd requires this setting -->
+    <!--<param name="disable-100-continue" value="true"/>-->
+
     <!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->
     <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/format_cdr -->
     <!-- <param name="err-log-dir" value="/tmp"/> -->
 
     <!-- which auhtentification scheme to use. Supported values are: basic, digest, NTLM, GSS-NEGOTIATE or "any" for automatic detection -->
-    <!--<param name="auth-scheme" value="basic"/>--> 
+    <!--<param name="auth-scheme" value="basic"/>-->
 
     <!-- optional: this will enable the CA root certificate check by libcurl to
          verify that the certificate was issued by a major Certificate Authority.
index e5e0f36907530e94c8dcfec2edc05a24793a778b..1031caa0699e19b9719152e4d602b9de25f94415 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Brian West <brian@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Justin Cassidy <xachenant@hotmail.com>
@@ -90,7 +90,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_format_cdr_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_format_cdr_shutdown);
 SWITCH_MODULE_DEFINITION(mod_format_cdr, mod_format_cdr_load, mod_format_cdr_shutdown, NULL);
 
-/* this function would have access to the HTML returned by the webserver, we don't need it 
+/* this function would have access to the HTML returned by the webserver, we don't need it
  * and the default curl activity is to print to stdout, something not as desirable
  * so we have a dummy function here
  */
@@ -382,7 +382,7 @@ static switch_status_t my_on_reporting_cb(switch_core_session_t *session, cdr_pr
                if (!zstr(profile->ssl_cacert_file)) {
                        switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, profile->ssl_cacert_file);
                }
-               
+
                switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, profile->timeout);
 
                /* these were used for testing, optionally they may be enabled if someone desires
@@ -496,7 +496,7 @@ static switch_status_t my_on_reporting_cb(switch_core_session_t *session, cdr_pr
        {
                switch_xml_free(xml_cdr);
        }
-       
+
        if ( json_cdr )
        {
                cJSON_Delete(json_cdr);
@@ -660,7 +660,7 @@ switch_status_t mod_format_cdr_load_profile_xml(switch_xml_t xprofile)
                                                        profile->base_err_log_dir[profile->err_dir_count++] = switch_core_sprintf(profile->pool, "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
                                                }
                                        }
-                                       
+
                                }
                        } else if (!strcasecmp(var, "enable-cacert-check") && switch_true(val)) {
                                profile->enable_cacert_check = 1;
@@ -697,12 +697,12 @@ switch_status_t mod_format_cdr_load_profile_xml(switch_xml_t xprofile)
                                profile->encode_values = switch_true(val) ? ENCODING_DEFAULT : ENCODING_NONE;
                        }
                }
-               
+
                if (!profile->err_dir_count) {
                        if (!zstr(profile->base_log_dir)) {
                                profile->base_err_log_dir[profile->err_dir_count++] = switch_core_strdup(profile->pool, profile->base_log_dir);
                        } else {
-                               profile->base_err_log_dir[profile->err_dir_count++] = switch_core_sprintf(profile->pool, "%s%sformat_cdr", 
+                               profile->base_err_log_dir[profile->err_dir_count++] = switch_core_sprintf(profile->pool, "%s%sformat_cdr",
                                        SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
                        }
                }
@@ -743,7 +743,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_format_cdr_load)
 
        memset(&globals, 0, sizeof(globals));
 
-       if (switch_event_bind_removable(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, 
+       if (switch_event_bind_removable(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY,
                        event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
                return SWITCH_STATUS_GENERR;
@@ -789,7 +789,7 @@ void mod_format_cdr_profile_shutdown(cdr_profile_t *profile)
        }
 
        switch_safe_free(profile->log_dir);
-       
+
        switch_thread_rwlock_destroy(profile->log_path_lock);
 
        switch_core_destroy_memory_pool(&profile->pool);
index a51a6518cffb6ab8cbb3b17aad3bfffb47ede053..18626562773f6a6bf4dcdbcb31d9e84b59534c75 100644 (file)
@@ -9,7 +9,7 @@
                        <!-- Whether to URL encode the individual JSON values. Defaults to true, set to false for standard JSON. -->
                        <param name="encode-values" value="true"/>
 
-                       <!-- Normally if url and log-dir are present, url is attempted first and log-dir second. 
+                       <!-- Normally if url and log-dir are present, url is attempted first and log-dir second.
                             This options allows to do both systematically. -->
                        <param name="log-http-and-disk" value="false"/>
 
index 7e1383aa71d6dd8eaa46fbf2198dd614dd564dd8..a6eddc9f8e41316c5ccea7f88918b8fd548e6d98 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Brian West <brian@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Justin Cassidy <xachenant@hotmail.com>
@@ -89,7 +89,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_json_cdr_shutdown);
 SWITCH_MODULE_DEFINITION(mod_json_cdr, mod_json_cdr_load, mod_json_cdr_shutdown, NULL);
 
-/* this function would have access to the HTML returned by the webserver, we don't need it 
+/* this function would have access to the HTML returned by the webserver, we don't need it
  * and the default curl activity is to print to stdout, something not as desirable
  * so we have a dummy function here
  */
@@ -207,12 +207,12 @@ static void backup_cdr(cdr_data_t *data)
 
                        switch_log_printf(SWITCH_CHANNEL_UUID_LOG(data->uuid), SWITCH_LOG_INFO, "Backup file %s\n", path);
                        if (path) {
-#ifdef _MSC_VER 
+#ifdef _MSC_VER
                                mode_t mode = S_IRUSR | S_IWUSR;
-#else 
+#else
                                mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-#endif 
-                               if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)) > -1) { 
+#endif
+                               if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)) > -1) {
                                        switch_size_t json_len = strlen(json_text);
                                        switch_ssize_t wrote = 0, x;
                                        do { x = write(fd, json_text, json_len);
@@ -231,18 +231,18 @@ static void backup_cdr(cdr_data_t *data)
                                        char ebuf[512] = { 0 };
                                        switch_log_printf(SWITCH_CHANNEL_UUID_LOG(data->uuid), SWITCH_LOG_ERROR, "Can't open %s! [%s]\n",
                                                                          path, switch_strerror_r(errno, ebuf, sizeof(ebuf)));
-                               
+
                                }
                                switch_safe_free(path);
                        }
                }
        } else {
                switch_log_printf(SWITCH_CHANNEL_UUID_LOG(data->uuid), SWITCH_LOG_NOTICE, "Not writing to file\n");
-       }       
+       }
 }
 
-       
-void destroy_cdr_data(cdr_data_t *data) 
+
+void destroy_cdr_data(cdr_data_t *data)
 {
        switch_safe_free(data->json_text);
        switch_safe_free(data->json_text_escaped);
@@ -314,7 +314,7 @@ static void process_cdr(cdr_data_t *data)
 
                        curl_json_text = switch_mprintf("cdr=%s", data->json_text_escaped);
                        switch_assert(curl_json_text != NULL);
-                       
+
                } else {
                        headers = switch_curl_slist_append(headers, "Content-Type: application/json");
                        curl_json_text = (char *)data->json_text;
@@ -463,15 +463,15 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error Generating Data!\n");
                return SWITCH_STATUS_FALSE;
        }
-       
+
        cdr_data = malloc(sizeof(cdr_data_t));
        switch_assert(cdr_data);
-       
+
        json_text = cJSON_PrintUnformatted(json_cdr);
 
        if (globals.url_count && globals.encode) {
                switch_size_t need_bytes = strlen(json_text) * 3;
-               
+
                json_text_escaped = malloc(need_bytes);
                switch_assert(json_text_escaped);
                memset(json_text_escaped, 0, need_bytes);
@@ -500,12 +500,12 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                if (switch_queue_trypush(globals.queue, cdr_data) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unable to push cdr to queue\n");
                        backup_cdr(cdr_data);
-                       destroy_cdr_data(cdr_data);                     
+                       destroy_cdr_data(cdr_data);
                }
        } else {
                process_cdr(cdr_data);
        }
-       
+
        cJSON_Delete(json_cdr);
 
        return SWITCH_STATUS_SUCCESS;
@@ -649,7 +649,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load)
                                                        globals.base_err_log_dir[globals.err_dir_count++] = switch_core_sprintf(globals.pool, "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
                                                }
                                        }
-                                       
+
                                }
                        } else if (!strcasecmp(var, "enable-cacert-check") && switch_true(val)) {
                                globals.enable_cacert_check = 1;
@@ -744,7 +744,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_json_cdr_shutdown)
        }
 
        switch_safe_free(globals.log_dir);
-       
+
        for (;err_dir_index < globals.err_dir_count; err_dir_index++) {
                switch_safe_free(globals.err_log_dir[err_dir_index]);
        }
index ed4ed0f0fd75c19375701f17f7a3c2fb759af71a..1748b7c3eeeb09924e7ca090cb6c69e64a773478 100644 (file)
@@ -207,7 +207,7 @@ SWITCH_DECLARE(switch_status_t) kazoo_api_execute(const char *cmd, const char *a
 
        cmd_used = (char *) cmd;
        arg_used = (char *) arg;
-                       
+
 
        if (!stream->param_event) {
                switch_event_create(&stream->param_event, SWITCH_EVENT_API);
@@ -246,7 +246,7 @@ SWITCH_DECLARE(switch_status_t) kazoo_api_execute(const char *cmd, const char *a
        if (cmd_used != cmd) {
                switch_safe_free(cmd_used);
        }
-       
+
        if (arg_used != arg) {
                switch_safe_free(arg_used);
        }
index 7a744dbc6e2b719ae2236044ed113c28ccd8989f..1ca10a72d7543ffb9d4c9fa7fd7cc0688a31d1cc 100644 (file)
@@ -304,7 +304,7 @@ static switch_status_t odbc_cdr_reporting(switch_core_session_t *session)
                                char *full_path = NULL;
                                switch_stream_handle_t stream_field = { 0 };
                                switch_stream_handle_t stream_value = { 0 };
-                               switch_bool_t insert_fail = SWITCH_FALSE;                               
+                               switch_bool_t insert_fail = SWITCH_FALSE;
 
                                SWITCH_STANDARD_STREAM(stream_field);
                                SWITCH_STANDARD_STREAM(stream_value);
index aecbaf0c6247f2597208a5a353954678f047f904..490a7911f1dfe2e098d1026a29738052d79a9eb6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Chris Parker <cparker@segv.org>
  * Mathieu Rene <mrene@avgs.ca>
  *
@@ -225,7 +225,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
                   return SWITCH_STATUS_TERM;
                   }
                 */
-               
+
                if ((signal_bond = switch_channel_get_partner_uuid(channel)) && !zstr(signal_bond)) {
                        if (rc_avpair_add(rad_config, &send, PW_FS_OTHER_LEG_ID, (void*) signal_bond, -1, PW_FS_PEC) == NULL) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Freeswitch-Other-Leg-Id: %s\n", uuid_str);
@@ -687,10 +687,10 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                                rc_destroy(rad_config);
                                goto end;
                        }
-                       
+
                        {
                                const char *direction_str = profile->direction == SWITCH_CALL_DIRECTION_INBOUND ? "inbound" : "outbound";
-                               
+
                                if (rc_avpair_add(rad_config, &send, PW_FS_DIRECTION, (void *) direction_str, -1, PW_FS_PEC) == NULL) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Direction: %s\n", direction_str);
                                        rc_destroy(rad_config);
index a3effad00541807e82a400c2f6c7af6bc663446d..0257f6130347db9ac1ecdb538c88327b16647f70 100644 (file)
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Chris Parker <cparker AT segv.org>
  *
  * Description: Contains definitions and structs used by the radius cdr module.
index 4a290b91307fd4165fb6ff1205657908afbca9d0..707350a97d574ce8ec16caecdc4f066b8b7b5f81 100644 (file)
@@ -541,7 +541,7 @@ void iks_sha_print_base64(iksha *sha, char *buf)
                hex_digit[1] = hex_buf[i + 1];
                bin_buf[i / 2] = strtol(hex_digit, NULL, 16);
        }
-       
+
        switch_b64_encode(bin_buf, SHA_1_HASH_BUF_SIZE / 2, (unsigned char *)buf, SHA_1_HASH_BUF_SIZE);
 }
 
index fd72b43378f9d1168d9355e9affd8c448e5c6b22..7a7a46c346898527f89b62cd79562ecc04bd53fd 100644 (file)
@@ -4072,7 +4072,7 @@ SWITCH_STANDARD_APP(rayo_app)
                        }
                }
                if (!call) {
-                       /* this scenario can only happen if a call was originated through a mechanism other than <dial> 
+                       /* this scenario can only happen if a call was originated through a mechanism other than <dial>
                           and then the rayo APP was executed to offer control */
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Outbound call that wasn't created with <dial>, will try to offer control\n");
                }
@@ -5179,7 +5179,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load)
                return SWITCH_STATUS_TERM;
        }
 
-       
+
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading module\n");
@@ -5288,7 +5288,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load)
  * Shutdown module.  Notifies threads to stop.
  */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rayo_shutdown)
-{      
+{
        switch_status_t result;
 
        switch_event_free_subclass("rayo::cpa");
index a2fa679a2b8737a95c3275f171474667c3425ede..19f2ddafd76613ae467349166905bf6c9b36a4f6 100644 (file)
@@ -262,7 +262,7 @@ static void rayo_cpa_component_hangup(const char *jid, void *user_data)
 }
 
 /**
- * Handle hungup call event 
+ * Handle hungup call event
  */
 static void on_channel_hangup_complete_event(switch_event_t *event)
 {
@@ -353,7 +353,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg,
        /* acknowledge command */
        rayo_component_send_start(RAYO_COMPONENT(component), iq);
 
-       /* TODO hangup race condition */        
+       /* TODO hangup race condition */
        subscribe(switch_core_session_get_uuid(session), "hangup", RAYO_JID(component));
 
        /* ready to forward detector events */
@@ -374,7 +374,7 @@ switch_status_t rayo_cpa_component_load(switch_loadable_module_interface_t **mod
        rayo_actor_command_handler_add(RAT_CALL_COMPONENT, "cpa", "set:"RAYO_EXT_NS":stop", stop_cpa_component);
        switch_event_bind("rayo_cpa_component", SWITCH_EVENT_CUSTOM, "rayo::cpa", on_rayo_cpa_detector_event, NULL);
        switch_event_bind("rayo_cpa_component", SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE, NULL, on_channel_hangup_complete_event, NULL);
-       
+
        globals.pool = pool;
        switch_core_hash_init(&globals.subscribers);
        switch_mutex_init(&globals.subscribers_mutex, SWITCH_MUTEX_NESTED, pool);
index 0905f6e547218cf826f81dd06f100aaf941cc4a0..ef00f3968dce719d414e7965208aa976e6efc083 100644 (file)
@@ -219,7 +219,7 @@ SWITCH_STANDARD_API(rayo_cpa_detector_api)
 
        cmd_dup = strdup(cmd);
        argc = switch_separate_string(cmd_dup, ' ', argv, sizeof(argv) / sizeof(argv[0]));
-       
+
        if (argc != 3) {
                stream->write_function(stream, "-ERR: USAGE %s\n", RAYO_CPA_DETECTOR_SYNTAX);
        } else {
index 77855463d6e19267a31cfddef55c31ac08956813..6e1feefb825747b45007f2e0af42364ce7a9d50f 100644 (file)
@@ -280,7 +280,7 @@ static switch_status_t input_handler_on_dtmf(switch_core_session_t *session, con
                switch_hash_index_t *hi;
 
                switch_mutex_lock(handler->mutex);
-       
+
                /* check input on each component */
                for (hi = switch_core_hash_first(handler->dtmf_components); hi; hi = switch_core_hash_next(&hi)) {
                        const void *jid;
index c93146d13b85b0f1a33264fc0fb6b22b4f70fa8d..4277ea305b3b1aa2491af61d05e4b53d78d7933c 100644 (file)
@@ -63,7 +63,7 @@ void parse_plain_auth_message(const char *message, char **authzid, char **authci
        } else {
                *authzid = strdup(decoded);
        }
-       
+
  end:
        switch_safe_free(decoded);
 }
index c18761b158a3be1b412b435b3753c7146096a96f..e04bea31a3832741d7c8e280f41758e18e1888e4 100644 (file)
@@ -47,7 +47,7 @@ switch_status_t mod_smpp_interface_chat_send(switch_event_t *event)
        if (zstr(gw_name)) {
                gw_name = "default";
        }
-       
+
        gateway = switch_core_hash_find(mod_smpp_globals.gateways, gw_name);
 
        if (!gateway) {
@@ -86,17 +86,17 @@ SWITCH_STANDARD_APP(mod_smpp_app_send_function)
        if (switch_event_create(&message, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) {
                return;
        }
-       
+
        /* Copy over recognized channel vars. Then call the chat send function */
        /* Cycle through all of the channel headers, and ones with 'smpp_' prefix copy over without the prefix */
        for ( chan_var = switch_channel_variable_first(channel); chan_var; chan_var = chan_var->next) {
                if ( !strncmp(chan_var->name, "smpp_", 5) ) {
                        switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, chan_var->name + 5, chan_var->value);
                } else {
-                       switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, chan_var->name, chan_var->value);                  
+                       switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, chan_var->name, chan_var->value);
                }
        }
-       
+
        /* Unlock the channel variables */
        switch_channel_variable_last(channel);
        mod_smpp_chat_send_function(message, data);
@@ -137,7 +137,7 @@ SWITCH_STANDARD_API(mod_smpp_send_api)
        if (switch_event_create(&message, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) {
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
-       
+
        switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, "to_user", argv[1]);
        switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, "from_user", argv[2]);
        switch_event_set_body(message, argv[3]);
@@ -149,10 +149,10 @@ SWITCH_STANDARD_API(mod_smpp_send_api)
  done:
        switch_safe_free(cmd_dup);
        return status;
-                                                                       
+
 }
 
-switch_status_t mod_smpp_do_config() 
+switch_status_t mod_smpp_do_config()
 {
        char *conf = "smpp.conf";
        switch_xml_t xml, cfg, gateways, gateway, params, param;
@@ -163,11 +163,11 @@ switch_status_t mod_smpp_do_config()
        }
 
        if ( (gateways = switch_xml_child(cfg, "gateways")) != NULL) {
-               for (gateway = switch_xml_child(gateways, "gateway"); gateway; gateway = gateway->next) {               
+               for (gateway = switch_xml_child(gateways, "gateway"); gateway; gateway = gateway->next) {
                        mod_smpp_gateway_t *new_gateway = NULL;
                        char *host = NULL, *system_id = NULL, *password = NULL, *profile = NULL, *system_type = NULL;
                        int port = 0, debug = 0;
-                       
+
                        char *name = (char *)switch_xml_attr_soft(gateway, "name");
 
                        // Load params
@@ -202,9 +202,9 @@ switch_status_t mod_smpp_do_config()
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateways config is missing\n");
                goto err;
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
-       
+
  err:
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Configuration failed\n");
        return SWITCH_STATUS_GENERR;
@@ -220,12 +220,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_smpp_load)
 
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       
+
        memset(&mod_smpp_globals, 0, sizeof(mod_smpp_globals_t));
        mod_smpp_globals.pool = pool;
        mod_smpp_globals.debug = 0;
        switch_core_hash_init(&(mod_smpp_globals.gateways));
-       
+
        if ( mod_smpp_do_config() != SWITCH_STATUS_SUCCESS ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load due to bad configs\n");
                return SWITCH_STATUS_TERM;
@@ -234,9 +234,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_smpp_load)
        SWITCH_ADD_CHAT(mod_smpp_chat_interface, "smpp", mod_smpp_interface_chat_send);
        SWITCH_ADD_API(mod_smpp_api_interface, "smpp_debug", "mod_smpp toggle debug", mod_smpp_debug_api, NULL);
        SWITCH_ADD_API(mod_smpp_api_interface, "smpp_send", "mod_smpp send", mod_smpp_send_api, NULL);
-       SWITCH_ADD_CHAT_APP(mod_smpp_chat_app_interface, "smpp_send", "send message to gateway", "send message to gateway", 
+       SWITCH_ADD_CHAT_APP(mod_smpp_chat_app_interface, "smpp_send", "send message to gateway", "send message to gateway",
                                                mod_smpp_chat_send_function, "", SCAF_NONE);
-       SWITCH_ADD_APP(mod_smpp_app_interface, "smpp_send", NULL, NULL, mod_smpp_app_send_function, 
+       SWITCH_ADD_APP(mod_smpp_app_interface, "smpp_send", NULL, NULL, mod_smpp_app_send_function,
                                   "smpp_send", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 
        /* indicate that the module should continue to be loaded */
index 318ceb765da34f4f9d77ff645d427902bcd8d7fa..3320a7829bfb3d3593f66598dcdd8bdb975731a2 100644 (file)
@@ -77,7 +77,7 @@ typedef struct mod_smpp_message_s {
 /* mod_smpp_gateway.c */
 switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway);
 switch_status_t mod_smpp_gateway_connect(mod_smpp_gateway_t *gateway);
-switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, char*host, int port, int debug, char *system_id, 
+switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, char*host, int port, int debug, char *system_id,
                                                                                char *password, char *system_type, char *profile);
 switch_status_t mod_smpp_gateway_destroy(mod_smpp_gateway_t **gateway);
 switch_status_t mod_smpp_gateway_send_message(mod_smpp_gateway_t *gateway, switch_event_t *message);
index 7125f04e0f7fcb803bebbd5b05aa2e443bc8ac91..e4a927b1117cb6b0f8decb4494f08fb5f90c7bd2 100644 (file)
 
 static void *SWITCH_THREAD_FUNC mod_smpp_gateway_read_thread(switch_thread_t *thread, void *obj);
 
-switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, char *host, int port, int debug, char *system_id, 
+switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, char *host, int port, int debug, char *system_id,
                                                                                char *password, char *system_type, char *profile) {
        mod_smpp_gateway_t *gateway = NULL;
        switch_memory_pool_t *pool = NULL;
-       
+
        switch_core_new_memory_pool(&pool);
 
        gateway = switch_core_alloc(pool, sizeof(mod_smpp_gateway_t));
@@ -57,13 +57,13 @@ switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, cha
        gateway->system_type = system_type ? switch_core_strdup(gateway->pool, system_type) : "freeswitch_smpp";
        gateway->profile = profile ? switch_core_strdup(gateway->pool, profile) : "default";
 
-       if ( switch_sockaddr_info_get(&(gateway->socketaddr), gateway->host, SWITCH_INET, 
+       if ( switch_sockaddr_info_get(&(gateway->socketaddr), gateway->host, SWITCH_INET,
                                                                  gateway->port, 0, mod_smpp_globals.pool) != SWITCH_STATUS_SUCCESS ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get socketaddr info\n");
                goto err;
        }
 
-       if ( switch_socket_create(&(gateway->socket), switch_sockaddr_get_family(gateway->socketaddr), 
+       if ( switch_socket_create(&(gateway->socket), switch_sockaddr_get_family(gateway->socketaddr),
                                                          SOCK_STREAM, SWITCH_PROTO_TCP, mod_smpp_globals.pool) != SWITCH_STATUS_SUCCESS ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create the socket\n");
                goto err;
@@ -84,7 +84,7 @@ switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, cha
        switch_core_hash_insert(mod_smpp_globals.gateways, name, (void *) gateway);
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Gateway %s created\n", gateway->host);
-       
+
        *gw = gateway;
        return SWITCH_STATUS_SUCCESS;
 
@@ -110,15 +110,15 @@ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway) {
     req_b->addr_ton         = 1;
 
        strncpy( (char *)req_b->address_range, gateway->host, sizeof(req_b->address_range));
-       
+
        if ( gateway->system_id ) {
                strncpy((char *)req_b->system_id, gateway->system_id, sizeof(req_b->system_id));
        }
-       
+
        if ( gateway->password ) {
                strncpy((char *)req_b->password, gateway->password, sizeof(req_b->password));
        }
-       
+
        if ( gateway->system_type ) {
                strncpy((char *)req_b->system_type, gateway->system_type, sizeof(req_b->system_type));
        }
@@ -146,7 +146,7 @@ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway) {
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
 
-    if( write_len != local_buffer_len ){ 
+    if( write_len != local_buffer_len ){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Was not able to send entire buffer\n");
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
@@ -170,7 +170,7 @@ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway) {
        if ( req_b ) {
                switch_safe_free(req_b);
        }
-       
+
        return status;
 }
 
@@ -182,7 +182,7 @@ switch_status_t mod_smpp_gateway_connect(mod_smpp_gateway_t *gateway) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to connect the socket %d\n", status);
                return SWITCH_STATUS_GENERR;
        }
-       
+
        if ( mod_smpp_gateway_authenticate(gateway) != SWITCH_STATUS_SUCCESS ) {
                return SWITCH_STATUS_GENERR;
        }
@@ -210,7 +210,7 @@ switch_status_t mod_smpp_gateway_connection_read(mod_smpp_gateway_t *gateway, sw
            switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
 
-       if ( read_len != 4 ){ 
+       if ( read_len != 4 ){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in recv(PEEK) %d\n", (unsigned int )read_len);
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
@@ -218,7 +218,7 @@ switch_status_t mod_smpp_gateway_connection_read(mod_smpp_gateway_t *gateway, sw
        read_len = ntohl(*local_buffer32 );
 
        if ( read_len > 1500 ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Corrupted PDU size from gateway [%s]\n", gateway->name);               
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Corrupted PDU size from gateway [%s]\n", gateway->name);
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
 
@@ -252,14 +252,14 @@ switch_status_t mod_smpp_gateway_connection_read(mod_smpp_gateway_t *gateway, sw
        case DELIVER_SM:
                if ( gennack->command_status == ESME_ROK ) {
                        deliver_sm_t *res = (deliver_sm_t *) data;
-                       
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New SMS received from[%s] to[%s] message[%s]\n", 
+
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New SMS received from[%s] to[%s] message[%s]\n",
                                                          res->source_addr, res->destination_addr, res->short_message);
-                       
+
                        mod_smpp_message_decode(gateway, res, &evt);
                }
                break;
-       case ENQUIRE_LINK: 
+       case ENQUIRE_LINK:
        case ENQUIRE_LINK_RESP:
        case SUBMIT_SM_RESP:
                switch (gennack->command_status) {
@@ -287,7 +287,7 @@ switch_status_t mod_smpp_gateway_connection_read(mod_smpp_gateway_t *gateway, sw
                *event = evt;
        }
 
- done: 
+ done:
        switch_safe_free(local_buffer);
        return status;
 }
@@ -332,7 +332,7 @@ static void *SWITCH_THREAD_FUNC mod_smpp_gateway_read_thread(switch_thread_t *th
                        }
 
                        mod_smpp_gateway_send_deliver_sm_response(gateway, event);
-                       
+
                        switch_core_chat_send("smpp", event);
                        switch_event_destroy(&event);
                        /* Fire message to the chat plan, then respond */
@@ -345,7 +345,7 @@ static void *SWITCH_THREAD_FUNC mod_smpp_gateway_read_thread(switch_thread_t *th
                        if ( event ) {
                                char *str = NULL;
                                switch_event_serialize(event, &str, SWITCH_FALSE);
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown packet event: %s\n", str);                             
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown packet event: %s\n", str);
                                switch_safe_free(str);
                        }
                }
@@ -383,7 +383,7 @@ switch_status_t mod_smpp_gateway_send_enquire_link_response(mod_smpp_gateway_t *
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
 
-    if( write_len != local_buffer_len ){ 
+    if( write_len != local_buffer_len ){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Was not able to send entire buffer\n");
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
@@ -424,7 +424,7 @@ switch_status_t mod_smpp_gateway_send_deliver_sm_response(mod_smpp_gateway_t *ga
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
 
-    if( write_len != local_buffer_len ){ 
+    if( write_len != local_buffer_len ){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Was not able to send entire buffer\n");
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
@@ -464,7 +464,7 @@ switch_status_t mod_smpp_gateway_send_unbind(mod_smpp_gateway_t *gateway)
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
 
-    if( write_len != local_buffer_len ){ 
+    if( write_len != local_buffer_len ){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Was not able to send entire buffer\n");
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
@@ -475,16 +475,16 @@ switch_status_t mod_smpp_gateway_send_unbind(mod_smpp_gateway_t *gateway)
        return status;
 }
 
-switch_status_t mod_smpp_gateway_destroy(mod_smpp_gateway_t **gw) 
+switch_status_t mod_smpp_gateway_destroy(mod_smpp_gateway_t **gw)
 {
        mod_smpp_gateway_t *gateway = NULL;
 
        if ( !gw || !*gw ) {
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        gateway = *gw;
-       
+
        switch_core_hash_delete(mod_smpp_globals.gateways, gateway->name);
 
        gateway->running = 0;
@@ -518,7 +518,7 @@ switch_status_t mod_smpp_gateway_send_message(mod_smpp_gateway_t *gateway, switc
        int local_buffer_len = sizeof(local_buffer);
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        switch_size_t write_len = 0;
-       
+
        if ( mod_smpp_message_create(gateway, message, &msg) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to send message due to message_create failure\n");
                switch_goto_status(SWITCH_STATUS_GENERR, done);
@@ -527,14 +527,14 @@ switch_status_t mod_smpp_gateway_send_message(mod_smpp_gateway_t *gateway, switc
     memset(local_buffer, 0, sizeof(local_buffer));
 
     if( smpp34_pack2( local_buffer, sizeof(local_buffer),      &local_buffer_len, (void*)&(msg->req)) != 0 ){
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Unable to encode message:%d:\n%s\n", smpp34_errno, smpp34_strerror); 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Unable to encode message:%d:\n%s\n", smpp34_errno, smpp34_strerror);
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
 
        write_len = local_buffer_len;
 
        if ( mod_smpp_gateway_get_next_sequence(gateway, &(msg->req.sequence_number)) ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to fetch next gateway sequence number\n"); 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to fetch next gateway sequence number\n");
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
 
@@ -547,7 +547,7 @@ switch_status_t mod_smpp_gateway_send_message(mod_smpp_gateway_t *gateway, switc
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
 
-    if ( write_len != local_buffer_len ){ 
+    if ( write_len != local_buffer_len ){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Did not send all of message to gateway");
                switch_goto_status(SWITCH_STATUS_GENERR, done);
        }
index 6c168b5b831fb413014da64cbf734906a292f9be..a7407102bca62da9c4690076fc72fbaf0e034cd9 100644 (file)
@@ -36,7 +36,7 @@
 switch_status_t mod_smpp_message_encode_body(char *body, int length, unsigned char *bin, uint8_t *enc_length)
 {
        int i = 0;
-       
+
        for ( i = 0; i < length; i++ ) {
                bin[i*2] = body[i] / 16;
                bin[i*2 + 1] = body[i] % 16;
@@ -46,13 +46,13 @@ switch_status_t mod_smpp_message_encode_body(char *body, int length, unsigned ch
        return SWITCH_STATUS_SUCCESS;
 }
 
-/* 
+/*
    Scratch notes taken during development/interop:
 
        char *message = "5361792048656c6c6f20746f204d79204c6974746c6520467269656e64";
        ''.join('%02x' % ord(c) for c in  u'Скажите привет моему маленькому другу'.encode('utf16'))
 
-       Variable length UTF-16 russian text: 
+       Variable length UTF-16 russian text:
 
        char *message = "fffe21043a043004360438044204350420003f044004380432043504420420003c043e0435043c04430420003c0430043b0435043d044c043a043e043c044304200034044004430433044304";
        char *mesg_txt = "This is a test SMS message from FreeSWITCH over SMPP";
@@ -62,7 +62,7 @@ switch_status_t mod_smpp_message_create(mod_smpp_gateway_t *gateway, switch_even
 {
        mod_smpp_message_t *msg = calloc(1, sizeof(mod_smpp_message_t));
        char *body = switch_event_get_body(event);
-                                                                          
+
        assert(*message == NULL);
 
        if ( !body ) {
@@ -87,7 +87,7 @@ switch_status_t mod_smpp_message_create(mod_smpp_gateway_t *gateway, switch_even
     msg->req.sm_default_msg_id       = 0;
     msg->req.data_coding             = 0;
     msg->req.source_addr_ton         = 1;
-    msg->req.source_addr_npi         = 1;      
+    msg->req.source_addr_npi         = 1;
     msg->req.dest_addr_ton           = 1;
        msg->req.dest_addr_npi           = 1;
     msg->req.esm_class               = 1; /* 0 => default, 1 => datagram, 2 => forward(transaction), 3 => store and forward
@@ -104,7 +104,7 @@ switch_status_t mod_smpp_message_create(mod_smpp_gateway_t *gateway, switch_even
        snprintf((char *)msg->req.short_message, sizeof(msg->req.short_message), "%s", body);
        msg->req.sm_length = strlen(body);
 
-       if ( 0 && mod_smpp_message_encode_body(body, strlen(body), 
+       if ( 0 && mod_smpp_message_encode_body(body, strlen(body),
                                                                                         (unsigned char *) &(msg->req.short_message), &(msg->req.sm_length)) != SWITCH_STATUS_SUCCESS ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to encode message body\n");
                goto err;
@@ -124,7 +124,7 @@ switch_status_t mod_smpp_message_decode(mod_smpp_gateway_t *gateway, deliver_sm_
        char *str = NULL;
 
        if (switch_event_create(&evt, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new event\n"); 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new event\n");
        }
 
        switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "endpoint", "mod_smpp");
@@ -173,7 +173,7 @@ switch_status_t mod_smpp_message_decode(mod_smpp_gateway_t *gateway, deliver_sm_
 switch_status_t mod_smpp_message_destroy(mod_smpp_message_t **msg)
 {
        if ( msg ) {
-               switch_safe_free(*msg);         
+               switch_safe_free(*msg);
        }
 
        return SWITCH_STATUS_SUCCESS;
index e0dbe7cabaf76f13a6db8020d2c7868cf10baa25..9ec29281526dc63bfb47e2a309ee5053e12a23e5 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -26,7 +26,7 @@
  * Contributor(s):
  * Daniel Swarbrick <daniel.swarbrick@gmail.com>
  * Stefan Knoblich <s.knoblich@axsentis.de>
- * 
+ *
  * mod_snmp.c -- SNMP AgentX Subagent Module
  *
  */
index 4b76b9d046b5c410de2cb2ab03fd3110dde828d4..dd29939e6aa6e152fe9bde5c8dd7d5ca6ad03965 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -26,7 +26,7 @@
  * Contributor(s):
  * Daniel Swarbrick <daniel.swarbrick@gmail.com>
  * Stefan Knoblich <s.knoblich@axsentis.de>
- * 
+ *
  * mod_snmp.c -- SNMP AgentX Subagent Module
  *
  */
index fe564cbf4692da42bb80a20e19fc4d57744b0cc0..0cd3ea372840ba65de45cd4b79bfe207e20aeaa7 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -26,7 +26,7 @@
  * Contributor(s):
  * Daniel Swarbrick <daniel.swarbrick@gmail.com>
  * Stefan Knoblich <s.knoblich@axsentis.de>
- * 
+ *
  * subagent.h -- SNMP Agent Definitions
  *
  */
index accbb8d4609f01d52dbaf7eb2dfa0e703ffa1019..6428421994366ca804164994ae23d42aeeb148cd 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Cesar Cepeda <cesar@auronix.com>
  * Emmanuel Schmidbauer <e.schmidbauer@gmail.com>
@@ -159,7 +159,7 @@ switch_status_t list_streams_full(const char *line, const char *cursor, switch_c
        const void *vvar;
        switch_console_callback_match_t *my_matches = NULL;
        switch_status_t status = SWITCH_STATUS_FALSE;
-       
+
        switch_mutex_lock(globals.mutex);
        for (hi = switch_core_hash_first(globals.source_hash); hi; hi = switch_core_hash_next(&hi)) {
                switch_core_hash_this(hi, &vvar, NULL, &val);
@@ -172,12 +172,12 @@ switch_status_t list_streams_full(const char *line, const char *cursor, switch_c
                switch_console_push_match(&my_matches, (const char *) vvar);
        }
        switch_mutex_unlock(globals.mutex);
-       
+
        if (my_matches) {
                *matches = my_matches;
                status = SWITCH_STATUS_SUCCESS;
        }
-       
+
        return status;
 }
 
@@ -269,7 +269,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
 
        while (RUNNING && !source->stopped && source->ready) {
                const char *fname;
-               
+
                if (source->dir_handle) {
                        switch_dir_close(source->dir_handle);
                        source->dir_handle = NULL;
@@ -373,7 +373,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
 
                        if ((p = strrchr(tmp_buf, '/'))) {
                                *p++ = '\0';
-                               switch_snprintf(png_buf, sizeof(png_buf), "%s/art/%s.png", tmp_buf, p);                         
+                               switch_snprintf(png_buf, sizeof(png_buf), "%s/art/%s.png", tmp_buf, p);
                                if (switch_file_exists(png_buf, temp_pool) == SWITCH_STATUS_SUCCESS) {
                                        source->cover_art = switch_img_read_png(png_buf, SWITCH_IMG_FMT_I420);
                                }
@@ -382,24 +382,24 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                        source->serno++;
                        switch_safe_free(source->banner_txt);
                        title = artist = NULL;
-                       
+
                        switch_core_file_get_string(&fh, SWITCH_AUDIO_COL_STR_ARTIST, &artist);
                        switch_core_file_get_string(&fh, SWITCH_AUDIO_COL_STR_TITLE, &title);
 
                        if (!title && !artist) {
                                char *e, *p, *args[3];
                                int argc;
-                                       
+
                                switch_set_string(tmp_space, path_buf);
                                p = tmp_space;
-                                       
+
                                while((e = strchr(p, '/'))) {
                                        *e = '\0';
                                        p = e+1;
                                }
 
                                argc = switch_split(p, '-', args);
-                                       
+
                                if (argc > 0) {
                                        while(*args[0] == ' ') {
                                                args[0]++;
@@ -408,7 +408,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                        while(end_of(args[0]) == ' ') {
                                                end_of(args[0]) = '\0';
                                        }
-                                       
+
                                        artist = args[0];
 
                                        if (argc > 1) {
@@ -430,17 +430,17 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                        artist = NULL;
                                }
                        }
-                       
+
                        if (title && (source->cover_art || switch_core_file_has_video(&fh, SWITCH_TRUE))) {
                                const char *format = "#cccccc:#333333:FreeSans.ttf:3%:";
-                               
+
                                if (artist) {
                                        source->banner_txt = switch_mprintf("%s%s (%s)", format, title, artist);
                                } else {
                                        source->banner_txt = switch_mprintf("%s%s", format, title);
                                }
                        }
-                       
+
 
                        while (RUNNING && !source->stopped) {
                                int is_open;
@@ -448,13 +448,13 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
 
                                switch_core_timer_next(&source->timer);
                                olen = source->samples;
-                               
+
                                if (source->chime_total) {
 
                                        if (source->chime_counter > 0) {
                                                source->chime_counter -= (int32_t)source->samples;
                                        }
-                                       
+
                                        if (!switch_test_flag((&source->chime_fh), SWITCH_FILE_OPEN) && source->chime_counter <= 0) {
                                                char *val;
 
@@ -497,19 +497,19 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                        source->hup = 0;
                                        if (is_open) {
                                                is_open = 0;
-                                               
+
                                                switch_core_file_close(use_fh);
                                                flush_video_queue(source->video_q);
                                                switch_buffer_zero(audio_buffer);
                                                if (use_fh == &source->chime_fh) {
                                                        source->chime_counter = source->rate * source->chime_freq;
                                                        switch_core_file_close(&fh);
-                                                       use_fh = &fh;                                                   
+                                                       use_fh = &fh;
                                                }
                                                goto retry;
                                        }
                                }
-                               
+
                                if (is_open) {
                                        int svr = 0;
 
@@ -548,7 +548,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                                switch_core_file_read(&fh, source->abuf, &olen);
                                                olen = source->samples;
                                        }
-                                       
+
                                        switch_assert(source->abuflen >= olen * 2 * source->channels);
 
                                        if (switch_core_file_read(use_fh, source->abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) {
@@ -573,7 +573,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                                                goto retry;
                                                        }
                                                }
-                                               
+
                                                if (source->total) {
 
                                                        if (source->energy_avg && source->agc) {
@@ -602,17 +602,17 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                        void *pop;
                                        uint32_t bused = 0;
                                        local_stream_context_t *cp = NULL;
-                               
+
                                        switch_assert(source->abuflen <= source->prebuf);
                                        used = switch_buffer_read(audio_buffer, dist_buf, source->abuflen);
-                                       
+
                                        switch_mutex_lock(source->mutex);
                                        for (cp = source->context_list; cp && RUNNING; cp = cp->next) {
 
                                                if (!cp->ready) {
                                                        continue;
                                                }
-                                               
+
                                                switch_mutex_lock(cp->audio_mutex);
 
                                                if (switch_test_flag(cp->handle, SWITCH_FILE_OPEN)) {
@@ -625,7 +625,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                                bused = (uint32_t)switch_buffer_inuse(cp->audio_buffer);
 
                                                if (bused > source->samples * 768) {
-                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Flushing Stream Handle Buffer [%s() %s:%d] size: %u samples: %ld\n", 
+                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Flushing Stream Handle Buffer [%s() %s:%d] size: %u samples: %ld\n",
                                                                                          cp->func, cp->file, cp->line, bused, (long)source->samples);
                                                        switch_buffer_zero(cp->audio_buffer);
                                                } else {
@@ -635,7 +635,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                        }
                                        switch_mutex_unlock(source->mutex);
 
-                                               
+
                                        while (switch_queue_trypop(source->video_q, &pop) == SWITCH_STATUS_SUCCESS) {
                                                switch_image_t *img;
                                                switch_image_t *imgcp = NULL;
@@ -681,7 +681,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                                                                        }
                                                                                }
                                                                        }
-                                                               }                                               
+                                                               }
                                                                switch_img_free(&img);
                                                        }
                                                }
@@ -782,7 +782,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
        }
 
        switch_safe_free(source->banner_txt);
-       
+
        if (switch_test_flag((&fh), SWITCH_FILE_OPEN)) {
                switch_core_file_close(&fh);
        }
@@ -875,7 +875,7 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
        //}
 
        pool = handle->memory_pool;
-       
+
        if ((context = switch_core_alloc(pool, sizeof(*context))) == 0) {
                abort();
        }
@@ -902,7 +902,7 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
                goto end;
        }
 
-       if (!switch_core_has_video() || 
+       if (!switch_core_has_video() ||
                (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) && !source->has_video && !source->blank_img && !source->cover_art && !source->banner_txt)) {
                switch_clear_flag_locked(handle, SWITCH_FILE_FLAG_VIDEO);
        }
@@ -949,21 +949,21 @@ static switch_status_t local_stream_file_close(switch_file_handle_t *handle)
                                last->next = cp->next;
                        } else {
                                source->context_list = cp->next;
-                       }                       
+                       }
                        break;
                }
                last = cp;
        }
 
        switch_mutex_lock(context->audio_mutex);
-       
+
        if (source->has_video) {
                flush_video_queue(context->video_q);
                switch_queue_trypush(context->video_q, NULL);
                switch_queue_interrupt_all(context->video_q);
                flush_video_queue(context->video_q);
        }
-                                                       
+
        source->total--;
 
        switch_img_free(&context->banner_img);
@@ -1004,7 +1004,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
 
                        if (src_img) {
                                switch_image_t *img = NULL;
-                       
+
                                if (context->sent_png && --context->sent_png > 0) {
                                        return SWITCH_STATUS_BREAK;
                                }
@@ -1042,7 +1042,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
        if (!(context->ready && context->source->ready)) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        while (!(flags & SVR_BLOCK) && switch_queue_size(context->video_q) < buf_qsize) {
                return SWITCH_STATUS_BREAK;
        }
@@ -1078,7 +1078,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
                switch_img_fill(frame->img, 0, 0, frame->img->d_w, frame->img->d_h, &bgcolor);
                context->pop_count--;
        }
-       
+
        now = switch_micro_time_now();
 
        if (context->banner_img) {
@@ -1093,7 +1093,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
                context->serno = context->source->serno;
                context->pop_count = 5;
        }
-       
+
        if (context->source->banner_txt) {
                if ((!context->banner_timeout || context->banner_timeout >= now)) {
                        if (context->newres) {
@@ -1116,12 +1116,12 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
                switch_img_overlay(frame->img, context->banner_img, 0, frame->img->d_h - context->banner_img->d_h, context->source->text_opacity);
        }
 
-       if (frame->img && context->source->logo_img && 
+       if (frame->img && context->source->logo_img &&
                (context->source->logo_always || context->banner_img) && frame->img->d_w >= context->source->logo_img->d_w) {
                int x = 0, y = 0;
-               
+
                switch_img_find_position(context->source->logo_pos,
-                                                                frame->img->d_w, frame->img->d_h, 
+                                                                frame->img->d_w, frame->img->d_h,
                                                                 context->source->logo_img->d_w, context->source->logo_img->d_h,
                                                                 &x, &y);
 
@@ -1145,7 +1145,7 @@ static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void
                *len = 0;
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if (context->source->has_video)  {
                if (!switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
                        switch_set_flag_locked(handle, SWITCH_FILE_FLAG_VIDEO);
@@ -1163,7 +1163,7 @@ static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void
                *len = bytes / 2 / context->source->channels;
        } else {
                size_t blank;
-               
+
                switch_assert(handle->samplerate <= 48000);
                switch_assert(handle->real_channels <= 2);
 
@@ -1443,7 +1443,7 @@ SWITCH_STANDARD_API(local_stream_function)
                                stream->write_function(stream, "+OK stream: %s", local_stream_name);
                        }
                }
-               
+
        } else if (!strcasecmp(argv[0], "show")) {
                switch_hash_index_t *hi;
                const void *var;
@@ -1500,12 +1500,12 @@ SWITCH_STANDARD_API(local_stream_function)
                        }
                }
        }
-       
+
        goto done;
-       
+
  usage:
        stream->write_function(stream, "-USAGE: %s\n", LOCAL_STREAM_SYNTAX);
-       
+
   done:
 
        switch_safe_free(mycmd);
@@ -1526,7 +1526,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_local_stream_load)
        if (!launch_streams(NULL)) {
                return SWITCH_STATUS_GENERR;
        }
-       
+
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
        file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
        file_interface->interface_name = modname;
index d2db2b1b5289b2a4fb67b906625909283dcb6610..1ea69c404b524a19ee555680b5b747e8357ff812 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index da4a326d43c2b98d169ed58331d4f03d3643e10e..67ea090495656438663d00b5ee4a8bf4ebc3d00b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -67,7 +67,7 @@ static switch_status_t png_file_open(switch_file_handle_t *handle, const char *p
                return SWITCH_STATUS_GENERR;
        }
        ext++;
-       
+
        if ((context = (png_file_context_t *)switch_core_alloc(handle->memory_pool, sizeof(png_file_context_t))) == 0) {
                return SWITCH_STATUS_MEMERR;
        }
@@ -190,7 +190,7 @@ static switch_status_t png_file_read(switch_file_handle_t *handle, void *data, s
                status = SWITCH_STATUS_FALSE;
                switch_goto_status(status, end);
        }
-       
+
        memset(data, 0, *len * 2 * handle->channels);
 
  end:
@@ -295,7 +295,7 @@ static switch_bool_t write_png_bug_callback(switch_media_bug_t *bug, void *user_
                                switch_img_write_png(frame->img, data->path);
                                return SWITCH_FALSE;
                        }
-                       
+
                        if (!data->write_img) {
                                switch_img_copy(frame->img, &data->write_img);
                        }
@@ -352,7 +352,7 @@ SWITCH_STANDARD_API(uuid_write_png_function)
                stream->write_function(stream, "-USAGE: <uuid> <path> [concat | split <other_path>]\n");
                goto end;
        }
-       
+
        uuid = argv[0];
 
        if (!(session_ = switch_core_session_locate(uuid))) {
@@ -448,7 +448,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_png_load)
        SWITCH_ADD_API(api_interface, "uuid_write_png", "grab an image from a call",uuid_write_png_function, "");
 
        switch_console_set_complete("add uuid_write_png ::console::list_uuid");
-       
+
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
index 07e0e41ce7693dd1f1553b6d6e15e91af4aed125..2cb38d24ccbc1d0d1edade57f315567db973494d 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_shell_stream.c -- Local Streaming Audio
@@ -176,7 +176,7 @@ static switch_status_t shell_stream_file_close(switch_file_handle_t *handle)
        if (context->thread) {
                switch_thread_join(&st, context->thread);
        }
-       
+
        if (context->audio_buffer) {
                switch_buffer_destroy(&context->audio_buffer);
        }
index 66cfa1368281b07810db97e250b4ad472e01b42c..b736042abbae7a154201dddbc0cce6289558ee18 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Rupa Schomaker <rupa@rupa.com>
  * John Wehle <john@feith.com>
@@ -478,7 +478,7 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd,
        switch_mutex_lock(context->audio_mutex);
        context->curlfd = curlfd;
        switch_mutex_unlock(context->audio_mutex);
-       
+
        return 0;
 }
 
@@ -752,16 +752,16 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
 
                }
                context->channels = handle->channels;
-               
+
                if (globals.brate) {
                        lame_set_brate(context->gfp, globals.brate);
                } else {
                        lame_set_brate(context->gfp, 16 * (handle->samplerate / 8000) * handle->channels);
                }
-               
+
                lame_set_num_channels(context->gfp, handle->channels);
                lame_set_in_samplerate(context->gfp, handle->samplerate);
-               
+
                if (globals.resample) {
                        lame_set_out_samplerate(context->gfp, globals.resample);
                } else {
@@ -880,7 +880,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
 
                } else {
                        const char *mask = "wb+";
-                       
+
                        if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) {
                                mask = "ab+";
                        }
@@ -979,7 +979,7 @@ static switch_status_t shout_file_read(switch_file_handle_t *handle, void *data,
                if (newbytes < bytes) {
                        bytes = newbytes;
                }
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Padding mp3 stream with %ds of empty audio. (%s)\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Padding mp3 stream with %ds of empty audio. (%s)\n",
                                                  context->buffer_seconds, context->stream_url);
 
                memset(data, 255, bytes);
index 6c714af11e6c453f0baab7cd355f3deea1736d5e..974fa895309f9c51c7a12d3dc61162dbc3bfbab1 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -225,7 +225,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
                handle->pos = sf_seek(context->handle, frames, SEEK_END);
        } else if (switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) {
                handle->pos = sf_seek(context->handle, frames, SEEK_SET);
-       } else {                
+       } else {
                sf_command(context->handle, SFC_FILE_TRUNCATE, &frames, sizeof(frames));
        }
 
@@ -279,7 +279,7 @@ static switch_status_t sndfile_file_seek(switch_file_handle_t *handle, unsigned
        sndfile_context *context = handle->private_info;
        sf_count_t count;
        switch_status_t r = SWITCH_STATUS_SUCCESS;
-       
+
        if (!handle->seekable) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n");
                return SWITCH_STATUS_NOTIMPL;
@@ -289,10 +289,10 @@ static switch_status_t sndfile_file_seek(switch_file_handle_t *handle, unsigned
                r = SWITCH_STATUS_BREAK;
                count = sf_seek(context->handle, -1, SEEK_END);
        }
-       
+
        *cur_sample = (unsigned int) count;
-       handle->pos = *cur_sample;      
-       
+       handle->pos = *cur_sample;
+
        return r;
 }
 
index 90d1fec0cf1f1931af56cdc844b7928b15355551..3e8a2a87bec6001eec8722c16f71bdcf5e9b9a85 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -56,7 +56,7 @@ static switch_status_t silence_stream_file_open(switch_file_handle_t *handle, co
        }
 
        sh = switch_core_alloc(handle->memory_pool, sizeof(*sh));
-       
+
        if (ms > 0) {
                sh->samples = (handle->samplerate / 1000) * ms;
        } else {
@@ -151,7 +151,7 @@ static switch_status_t tone_stream_file_open(switch_file_handle_t *handle, const
        if (handle->params) {
                if ((tmp = switch_event_get_header(handle->params, "loops"))) {
                        loops = atoi(tmp);
-                       switch_buffer_set_loops(audio_buffer, loops);           
+                       switch_buffer_set_loops(audio_buffer, loops);
                }
        }
 
index 3cd8a2cebb58292373f812527c176fa3de301cf5..21abee61ed44986c9c8701f1ad669841d325a0a5 100644 (file)
@@ -41,7 +41,7 @@
  * To playback a video file
  * play_video /tmp/test.mp4
  *
- * Notes: 
+ * Notes:
  *
  * Audio Requires at least libvlc version 1.2
  * Video Requires at least libvlc 2.0.2
@@ -182,7 +182,7 @@ void log_cb(void *data, int level, const libvlc_log_t *ctx, const char *fmt, va_
        ret = switch_vasprintf(&ldata, fmt, args);
 
        if (ret == -1) return;
-       
+
        if (end_of(ldata) == '\n') {
                switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, fslevel, "VLC: %s", ldata);
        } else {
@@ -191,7 +191,7 @@ void log_cb(void *data, int level, const libvlc_log_t *ctx, const char *fmt, va_
 
        switch_safe_free(ldata);
 }
-       
+
 
 
 void yuyv_to_i420(uint8_t *pixels, void *out_buffer, int src_width, int src_height)
@@ -254,7 +254,7 @@ static libvlc_media_t *get_list_media(vlc_video_context_t *vcontext)
        libvlc_media_list_t *ml = libvlc_media_subitems(vcontext->m);
        if (ml) {
                int i, count = libvlc_media_list_count(ml);
-               
+
                for (i = 0; i < count; i++) {
                        libvlc_media_t *media = libvlc_media_list_item_at_index(ml, i);
                        if (media) return media;
@@ -426,7 +426,7 @@ static void vlc_video_unlock_callback(void *data, void *id, void *const *p_pixel
        switch_assert(context->img);
 
        yuyv_to_i420(*p_pixels, context->img->img_data, context->width, context->height);
-       
+
 
        switch_mutex_unlock(context->video_mutex);
 }
@@ -440,7 +440,7 @@ static void vlc_video_channel_unlock_callback(void *data, void *id, void *const
        if (context->channel && !switch_channel_test_flag(context->channel, CF_VIDEO)) return;
 
        if (!context->img) context->img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, context->width, context->height, 0); switch_assert(context->img);
-       
+
        yuyv_to_i420(*p_pixels, context->img->img_data, context->width, context->height);
 
        switch_mutex_unlock(context->video_mutex);
@@ -541,13 +541,13 @@ static int vlc_imem_get_callback(void *data, const char *cookie, int64_t *dts, i
        vlc_file_context_t *context = (vlc_file_context_t *) data;
        //int samples = 0;
        int bytes = 0, bread = 0, blen = 0;
-       
+
        if (context->playing == 0) return -1;
 
        switch_mutex_lock(context->audio_mutex);
 
        blen = switch_buffer_inuse(context->audio_buffer);
-       
+
        if (!(bytes = blen)) {
                *size = 0;
                *output = NULL;
@@ -566,7 +566,7 @@ static int vlc_imem_get_callback(void *data, const char *cookie, int64_t *dts, i
        bread = switch_buffer_read(context->audio_buffer, *output, bytes);
 
        switch_mutex_unlock(context->audio_mutex);
-       
+
        *size = (size_t) bread;
 
        return 0;
@@ -578,7 +578,7 @@ void vlc_imem_release_callback(void *data, const char *cookie, size_t size, void
        //free(unknown);
 }
 
-static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image_t *img) 
+static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image_t *img)
 {
        switch_memory_pool_t *pool;
        char *imem_main, *imem_slave;
@@ -623,7 +623,7 @@ static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image
        switch_mutex_init(&vcontext->video_mutex, SWITCH_MUTEX_NESTED, vcontext->pool);
        switch_thread_cond_create(&vcontext->cond, vcontext->pool);
        switch_thread_cond_create(&acontext->cond, acontext->pool);
-       
+
        switch_core_timer_init(&vcontext->timer, "soft", 1, 1000, vcontext->pool);
        vcontext->timer.start -= 60000000;
        switch_core_timer_sync(&vcontext->timer);
@@ -655,25 +655,25 @@ static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image
                                                                                         "samplerate=%d:"
                                                                                         "channels=%d:"
                                                                                         "id=1:"
-                                                                                        "caching=0", 
+                                                                                        "caching=0",
                                                                                         vcontext->samplerate, vcontext->channels);
-       
+
        vcontext->m = libvlc_media_new_location(acontext->vlc_handle, imem_main);
-       
-       libvlc_media_add_option_flag( vcontext->m, imem_slave, libvlc_media_option_trusted );                                                                       
+
+       libvlc_media_add_option_flag( vcontext->m, imem_slave, libvlc_media_option_trusted );
 
        if (vcontext->m == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC error opening %s for writing\n", acontext->path);
                return SWITCH_STATUS_FALSE;
        }
-       
+
        vcontext->mp = libvlc_media_player_new_from_media(vcontext->m);
 
        vcontext->samples = 0;
        vcontext->pts = 0;
-       
+
        acontext->vcontext = vcontext;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -719,7 +719,7 @@ static switch_status_t vlc_file_av_open(switch_file_handle_t *handle, const char
 
        vcontext->playing = 0;
        vcontext->err = 0;
-       
+
        vcontext->mp = libvlc_media_player_new_from_media(vcontext->m);
 
        if (!handle->samplerate) {
@@ -741,7 +741,7 @@ static switch_status_t vlc_file_av_open(switch_file_handle_t *handle, const char
        vcontext->channels = handle->channels;
 
        libvlc_audio_set_format(vcontext->mp, "S16N", vcontext->samplerate, handle->channels);
-               
+
        m_event_manager = libvlc_media_event_manager(vcontext->m);
        libvlc_event_attach(m_event_manager, libvlc_MediaStateChanged, vlc_media_av_state_callback, (void *) acontext);
 
@@ -806,8 +806,8 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p
                        if (handle->mm.fps > 0.0f) {
                                handle->mm.keyint = (int) 2.0f * handle->mm.fps;
                        }
-                       
-                       path = switch_core_sprintf(context->pool, 
+
+                       path = switch_core_sprintf(context->pool,
                                                                           "#transcode{"
                                                                            "venc=x264{keyint=%d},"
                                                                            "vcodec=h264,"
@@ -821,7 +821,7 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p
                                                                            "access=avio,"
                                                                            "mux=flv,"
                                                                            "dst=rtmp://%s"
-                                                                          "}", 
+                                                                          "}",
                                                                           handle->mm.keyint, handle->mm.ab, handle->mm.vb, handle->mm.channels, handle->mm.samplerate, path);
 
                }
@@ -829,7 +829,7 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p
 
        context->path = switch_core_strdup(context->pool, path);
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC attempt to open %s %s %s %s\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC attempt to open %s %s %s %s\n",
                                          context->path, switch_test_flag(handle, SWITCH_FILE_FLAG_READ) ? "read" : "",
                                          switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE) ? "write" : "",
                                          switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) ? "video" : ""
@@ -893,13 +893,13 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p
                context->channels = handle->channels;
 
                libvlc_audio_set_format(context->mp, "S16N", context->samplerate, handle->channels);
-               
+
                m_event_manager = libvlc_media_event_manager(context->m);
                libvlc_event_attach(m_event_manager, libvlc_MediaStateChanged, vlc_media_state_callback, (void *) context);
 
                mp_event_manager = libvlc_media_player_event_manager(context->mp);
                libvlc_event_attach(mp_event_manager, libvlc_MediaPlayerEncounteredError, vlc_mediaplayer_error_callback, (void *) context);
-               
+
                libvlc_audio_set_callbacks(context->mp, vlc_auto_play_callback, NULL,NULL,NULL,NULL, (void *) context);
 
                libvlc_media_player_play(context->mp);
@@ -910,10 +910,10 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p
                        switch_core_sprintf(context->pool, "--sout=%s", path)
                };
                int opts_count = 2;
-                       
+
                if ( !handle->samplerate)
                        handle->samplerate = 16000;
-               
+
                context->samplerate = handle->samplerate;
                context->channels = handle->channels;
 
@@ -944,14 +944,14 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p
        }
 
        if (!is_stream && switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
-               if (switch_file_open(&fd, realpath, SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE | SWITCH_FOPEN_TRUNCATE, 
+               if (switch_file_open(&fd, realpath, SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE | SWITCH_FOPEN_TRUNCATE,
                                                         SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) == SWITCH_STATUS_SUCCESS) {
                        switch_file_close(fd);
                } else {
                        return SWITCH_STATUS_GENERR;
                }
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -979,19 +979,19 @@ static switch_status_t vlc_file_av_read(switch_file_handle_t *handle, void *data
        }
 
        status = libvlc_media_get_state(vcontext->m);
-       
+
        if (status == libvlc_Error) {
                vcontext->err = acontext->err = 1;
                return SWITCH_STATUS_GENERR;
        }
-       
+
 
        while (!vcontext->err && vcontext->playing == 0) {
                libvlc_media_t *newmedia;
 
-               switch_mutex_lock(acontext->cond_mutex); 
-               switch_thread_cond_wait(acontext->cond, acontext->cond_mutex);          
-               switch_mutex_unlock(acontext->cond_mutex); 
+               switch_mutex_lock(acontext->cond_mutex);
+               switch_thread_cond_wait(acontext->cond, acontext->cond_mutex);
+               switch_mutex_unlock(acontext->cond_mutex);
 
                //switch_yield(50000);
 
@@ -1000,16 +1000,16 @@ static switch_status_t vlc_file_av_read(switch_file_handle_t *handle, void *data
                if (status == 6) {
                        int done = 1;
                        newmedia = get_list_media(vcontext);
-                       
+
                        if (newmedia) {
                                libvlc_event_manager_t *m_event_manager;
-                               
+
                                libvlc_media_player_set_media(vcontext->mp, newmedia);
                                libvlc_media_release(vcontext->m);
                                vcontext->m = newmedia;
-                               
+
                                m_event_manager = libvlc_media_event_manager(vcontext->m);
-                               libvlc_event_attach(m_event_manager, libvlc_MediaStateChanged, vlc_media_av_state_callback, (void *) acontext);                         
+                               libvlc_event_attach(m_event_manager, libvlc_MediaStateChanged, vlc_media_av_state_callback, (void *) acontext);
 
                                if (libvlc_media_player_play(vcontext->mp) != -1) {
                                        done = 0;
@@ -1040,7 +1040,7 @@ static switch_status_t vlc_file_av_read(switch_file_handle_t *handle, void *data
        switch_mutex_lock(vcontext->audio_mutex);
        read = switch_buffer_read(vcontext->audio_buffer, data, bytes);
        switch_mutex_unlock(vcontext->audio_mutex);
-       
+
        status = libvlc_media_get_state(vcontext->m);
 
        if (!read && (status == libvlc_Stopped || status == libvlc_Ended || status == libvlc_Error)) {
@@ -1078,27 +1078,27 @@ static switch_status_t vlc_file_read(switch_file_handle_t *handle, void *data, s
        }
 
        status = libvlc_media_get_state(context->m);
-       
+
        if (status == libvlc_Error) {
                return SWITCH_STATUS_GENERR;
        }
 
-       switch_mutex_lock(context->cond_mutex); 
+       switch_mutex_lock(context->cond_mutex);
        while (context->playing == 0 && status != libvlc_Ended && status != libvlc_Error) {
-               switch_thread_cond_wait(context->cond, context->cond_mutex);    
+               switch_thread_cond_wait(context->cond, context->cond_mutex);
                status = libvlc_media_get_state(context->m);
        }
-       switch_mutex_lock(context->cond_mutex); 
+       switch_mutex_lock(context->cond_mutex);
 
        if (context->err == 1) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC error\n");
                return SWITCH_STATUS_FALSE;
        }
 
-       switch_mutex_lock(context->audio_mutex); 
+       switch_mutex_lock(context->audio_mutex);
        read = switch_buffer_read(context->audio_buffer, data, bytes);
        switch_mutex_unlock(context->audio_mutex);
-       
+
        status = libvlc_media_get_state(context->m);
 
        if (!read && (status == libvlc_Stopped || status == libvlc_Ended || status == libvlc_Error)) {
@@ -1131,7 +1131,7 @@ static switch_status_t vlc_file_read_video(switch_file_handle_t *handle, switch_
        if (vcontext->err) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if ((flags & SVR_CHECK)) {
                return SWITCH_STATUS_BREAK;
        }
@@ -1146,7 +1146,7 @@ static switch_status_t vlc_file_read_video(switch_file_handle_t *handle, switch_
        if (vcontext->err) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if ((flags & SVR_BLOCK)) {
                status = switch_queue_pop(vcontext->video_queue, &pop);
        } else {
@@ -1196,7 +1196,7 @@ static switch_status_t vlc_file_write_video(switch_file_handle_t *handle, switch
        if (frame->img) {
                switch_image_t *img_copy = NULL;
                vlc_frame_data_t *fdata = NULL;
-               
+
                switch_img_copy(frame->img, &img_copy);
                switch_zmalloc(fdata, sizeof(*fdata));
 
@@ -1226,7 +1226,7 @@ static switch_status_t vlc_file_av_write(switch_file_handle_t *handle, void *dat
 
        if (!vcontext) {
                return SWITCH_STATUS_SUCCESS;
-       }       
+       }
 
        if (!vcontext->vid_ready) {
                return SWITCH_STATUS_SUCCESS;
@@ -1249,7 +1249,7 @@ static switch_status_t vlc_file_av_write(switch_file_handle_t *handle, void *dat
 
 
        if (!vcontext->playing) {
-               vcontext->playing = 1;          
+               vcontext->playing = 1;
                libvlc_media_player_play(vcontext->mp);
        }
 
@@ -1268,10 +1268,10 @@ static switch_status_t vlc_file_write(switch_file_handle_t *handle, void *data,
        switch_mutex_lock(context->audio_mutex);
        context->samples += *len;
        switch_buffer_write(context->audio_buffer, data, bytes);
-       switch_mutex_unlock(context->audio_mutex);      
+       switch_mutex_unlock(context->audio_mutex);
 
        if (!context->playing) {
-               context->playing = 1;           
+               context->playing = 1;
                libvlc_media_player_play(context->mp);
        }
 
@@ -1288,13 +1288,13 @@ static switch_status_t vlc_file_av_close(switch_file_handle_t *handle)
                        return SWITCH_STATUS_FALSE;
                }
        }
-       
+
        vcontext->ending = 1;
 
        if (vcontext && vcontext->video_queue) {
                switch_queue_push(vcontext->video_queue, NULL);
        }
-       
+
        if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE) && switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
 
                if (vcontext->cond && switch_mutex_trylock(vcontext->cond_mutex) == SWITCH_STATUS_SUCCESS) {
@@ -1309,7 +1309,7 @@ static switch_status_t vlc_file_av_close(switch_file_handle_t *handle)
 
                while((vcontext->audio_buffer && switch_buffer_inuse(vcontext->audio_buffer)) || switch_queue_size(vcontext->video_queue)) {
                        libvlc_state_t status = libvlc_media_get_state(vcontext->m);
-                       
+
                        if (status == libvlc_Ended || status == libvlc_Error || status == libvlc_Stopped ) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "VLC done. status = %d\n", status);
                                break;
@@ -1346,9 +1346,9 @@ static switch_status_t vlc_file_command(switch_file_handle_t *handle, switch_fil
 
        switch(command) {
        case SCFC_FLUSH_AUDIO:
-               switch_mutex_lock(context->audio_mutex);                
+               switch_mutex_lock(context->audio_mutex);
                switch_buffer_zero(context->audio_buffer);
-               switch_mutex_unlock(context->audio_mutex);              
+               switch_mutex_unlock(context->audio_mutex);
                break;
        default:
                break;
@@ -1366,7 +1366,7 @@ static switch_status_t vlc_file_close(switch_file_handle_t *handle)
        if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
                return vlc_file_av_close(handle);
        }
-       
+
        context->playing = 0;
 
        libvlc_media_player_stop(context->mp);
@@ -1378,7 +1378,7 @@ static switch_status_t vlc_file_close(switch_file_handle_t *handle)
        switch_mutex_unlock(context->audio_mutex);
 
        if (context->m) libvlc_media_release(context->m);
-       
+
        if (context->vlc_handle) libvlc_release(context->vlc_handle);
 
        return SWITCH_STATUS_SUCCESS;
@@ -1590,7 +1590,7 @@ SWITCH_STANDARD_APP(play_video_function)
 
        if( context->mp ) libvlc_media_player_stop(context->mp);
        if( context->m ) libvlc_media_release(context->m);
-       
+
        context->playing = 0;
 
        switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "OK");
@@ -1623,30 +1623,30 @@ int  vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t *
        int r = 0;
 
        if (!context->ending) {
-               switch_mutex_lock(context->cond_mutex); 
+               switch_mutex_lock(context->cond_mutex);
                //while (!switch_queue_size(context->video_queue)) {
                //      switch_yield(20000);
                //}
 
                //if (!switch_queue_size(context->video_queue)) {
-               //      switch_thread_cond_wait(context->cond, context->cond_mutex);    
+               //      switch_thread_cond_wait(context->cond, context->cond_mutex);
                //}
-               switch_mutex_unlock(context->cond_mutex); 
+               switch_mutex_unlock(context->cond_mutex);
        }
-       
+
        if (*cookie == 'v') {
                switch_image_t *img = NULL;
                vlc_frame_data_t *fdata = NULL;
                void *pop;
-               
+
                if (switch_queue_trypop(context->video_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
                        img = (switch_image_t *) pop;
                } else {
                        goto nada;
                }
-               
+
                fdata = (vlc_frame_data_t *) img->user_priv;
-               
+
                *dts = *pts = fdata->pts;
 
                *size = img->d_w * img->d_h * 2;
@@ -1657,7 +1657,7 @@ int  vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t *
                        context->video_frame_buffer_len = *size;
                        context->video_frame_buffer = switch_core_alloc(context->pool, context->video_frame_buffer_len);
                }
-               
+
                *output = context->video_frame_buffer;
                switch_img_to_raw(img, *output, 0, SWITCH_IMG_FMT_YUY2);
                switch_img_free(&img);
@@ -1667,12 +1667,12 @@ int  vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t *
        switch_mutex_lock(context->audio_mutex);
        if (context->sync_offset < 0 && !context->sync_ready) {
                uint32_t need = (context->samplerate / 1000) * abs(context->sync_offset / 1000) * context->channels * 2;
-               
+
                if (context->audio_frame_buffer_len < need) {
                        context->audio_frame_buffer_len = need;
                        context->audio_frame_buffer = switch_core_alloc(context->pool, context->audio_frame_buffer_len);
                }
-       
+
                memset(context->audio_frame_buffer, 0, need);
                *pts = *dts = context->pts;
                *size = need;
@@ -1682,7 +1682,7 @@ int  vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t *
                switch_mutex_unlock(context->audio_mutex);
                return 0;
        }
-       
+
        if ((blen = switch_buffer_inuse(context->audio_buffer))) {
                uint32_t read_bytes = 0;
                int64_t lpts;
@@ -1751,7 +1751,7 @@ int  vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t *
 
 void vlc_write_video_imem_release_callback(void *data, const char *cookie, size_t size, void *unknown)
 {
-       
+
 }
 
 static switch_status_t video_read_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
@@ -1768,7 +1768,7 @@ static switch_status_t video_read_callback(switch_core_session_t *session, switc
                switch_core_timer_sync(&context->timer);
                fdata->pts = context->timer.samplecount;
                switch_mutex_unlock(context->audio_mutex);
-               
+
                img_copy->user_priv = (void *) fdata;
                switch_queue_push(context->video_queue, img_copy);
 
@@ -1847,7 +1847,7 @@ SWITCH_STANDARD_APP(capture_video_function)
 
        switch_core_timer_init(&context->timer, "soft", 1, 1000, context->pool);
 
-       switch_channel_set_flag(channel, CF_VIDEO_DECODED_READ);        
+       switch_channel_set_flag(channel, CF_VIDEO_DECODED_READ);
        switch_core_media_get_vid_params(session, &vid_params);
        switch_channel_set_flag(channel, CF_VIDEO_ECHO);
        switch_core_session_raw_read(session);
@@ -1878,19 +1878,19 @@ SWITCH_STANDARD_APP(capture_video_function)
                                                                                         "samplerate=%d:"
                                                                                         "channels=%d:"
                                                                                         "id=1:"
-                                                                                        "caching=0", 
+                                                                                        "caching=0",
                                                                                         context->samplerate, context->channels);
-       
+
        context->m = libvlc_media_new_location(vlc_handle, imem_main);
-       
-       libvlc_media_add_option_flag( context->m, imem_slave, libvlc_media_option_trusted );                                                                       
+
+       libvlc_media_add_option_flag( context->m, imem_slave, libvlc_media_option_trusted );
 
        if ( context->m == NULL ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC error opening %s for writing\n", data);
                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                return ;
        }
-       
+
        context->mp = libvlc_media_player_new_from_media(context->m);
 
        context->samples = 0;
@@ -1904,7 +1904,7 @@ SWITCH_STANDARD_APP(capture_video_function)
 
 
        switch_channel_audio_sync(channel);
-       
+
        if (offset) {
                context->sync_offset = offset * 1000;
        }
@@ -1916,7 +1916,7 @@ SWITCH_STANDARD_APP(capture_video_function)
                if (!SWITCH_READ_ACCEPTABLE(status)) {
                        break;
                }
-               
+
                if (switch_test_flag(read_frame, SFF_CNG)) {
                        audio_data = audio_data_buf;
                        audio_datalen = read_impl.decoded_bytes_per_packet;
@@ -1956,18 +1956,18 @@ SWITCH_STANDARD_APP(capture_video_function)
                                break;
                        }
                }
-               
+
                vlc_status = libvlc_media_get_state(context->m);
 
                if (vlc_status == libvlc_Ended || vlc_status == libvlc_Error || vlc_status == libvlc_Stopped ) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "VLC done. status = %d\n", vlc_status);
                        break;
-               }               
+               }
        }
 
        switch_core_session_set_video_read_callback(session, NULL, NULL);
        context->ending = 1;
-       
+
        if (switch_mutex_trylock(context->cond_mutex) == SWITCH_STATUS_SUCCESS) {
                switch_thread_cond_signal(context->cond);
                switch_mutex_unlock(context->cond_mutex);
@@ -2089,7 +2089,7 @@ static switch_status_t setup_tech_pvt(switch_core_session_t *osession, switch_co
 
        tech_pvt->audio_datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
        tech_pvt->audio_data = switch_core_session_alloc(session, tech_pvt->audio_datalen);
-       
+
        if (osession) {
                switch_core_session_get_read_impl(osession, &tech_pvt->read_impl);
        } else {
@@ -2102,7 +2102,7 @@ static switch_status_t setup_tech_pvt(switch_core_session_t *osession, switch_co
                if (val) tmp = atoi(val);
                if (tmp == 0) tmp = 20;
                tech_pvt->read_impl.microseconds_per_packet = tmp * 1000;
-               
+
                tech_pvt->read_impl.iananame = "L16";
 
                tmp = 0;
@@ -2204,7 +2204,7 @@ static switch_status_t setup_tech_pvt(switch_core_session_t *osession, switch_co
        libvlc_audio_set_format(context->mp, "S16N", tech_pvt->read_impl.actual_samples_per_second, tech_pvt->read_impl.number_of_channels);
        libvlc_audio_set_callbacks(context->mp, vlc_play_audio_callback, NULL,NULL,NULL,NULL, (void *) context);
 
-       
+
        libvlc_video_set_format_callbacks(context->mp, video_format_setup_callback, video_format_clean_callback);
        libvlc_video_set_callbacks(context->mp, vlc_video_lock_callback, vlc_video_channel_unlock_callback, vlc_video_display_callback, context);
 
@@ -2280,7 +2280,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
                void *pop;
 
                while (switch_queue_trypop(tech_pvt->context->video_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
-                       switch_image_t *img = (switch_image_t *) pop;                   
+                       switch_image_t *img = (switch_image_t *) pop;
                        switch_img_free(&img);
                }
        }
@@ -2503,7 +2503,7 @@ static switch_status_t vlc_read_video_frame(switch_core_session_t *session, swit
        switch_channel_t *channel;
        vlc_private_t *tech_pvt;
        void *pop;
-       
+
        channel = switch_core_session_get_channel(session);
        switch_assert(channel != NULL);
 
@@ -2511,12 +2511,12 @@ static switch_status_t vlc_read_video_frame(switch_core_session_t *session, swit
        switch_assert(tech_pvt != NULL);
 
        switch_assert(tech_pvt->context);
-       
+
        switch_img_free(&tech_pvt->read_video_frame.img);
 
        if (tech_pvt->context->video_queue) {
                while(switch_queue_size(tech_pvt->context->video_queue) > 1) {
-                       if (switch_queue_trypop(tech_pvt->context->video_queue, &pop) == SWITCH_STATUS_SUCCESS) { 
+                       if (switch_queue_trypop(tech_pvt->context->video_queue, &pop) == SWITCH_STATUS_SUCCESS) {
                                switch_image_t *img = (switch_image_t *) pop;
                                switch_img_free(&img);
                        } else {
@@ -2524,9 +2524,9 @@ static switch_status_t vlc_read_video_frame(switch_core_session_t *session, swit
                        }
                }
                if (switch_queue_pop(tech_pvt->context->video_queue, &pop) == SWITCH_STATUS_SUCCESS) {
-                       switch_image_t *img = (switch_image_t *) pop;                   
+                       switch_image_t *img = (switch_image_t *) pop;
                        if (!img) return SWITCH_STATUS_FALSE;
-               
+
                        tech_pvt->read_video_frame.img = img;
                        *frame = &tech_pvt->read_video_frame;
                        switch_set_flag(*frame, SFF_RAW_RTP);
@@ -2612,7 +2612,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_vlc_load)
 
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       
+
        vlc_file_supported_formats[argc++] = "vlc";
        vlc_file_supported_formats[argc++] = "mp4"; /* maybe add config for this mod to enable or disable these */
        vlc_file_supported_formats[argc++] = "mov";
index da804eac24e07ccfa254bb67c7ccb701a24af86f..e22072e84162f2259d92a7ea9f48011154495e52 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -309,7 +309,7 @@ static switch_status_t webm_file_write(switch_file_handle_t *handle, void *data,
                                                                buf, &size, &encoded_rate, NULL);
        }
 
-       
+
        if (size > 0) {
                // timecode still need to figure out for sync
 
@@ -391,7 +391,7 @@ static switch_status_t do_write_video(switch_file_handle_t *handle, switch_frame
 
        // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%02x %02x %02x | len:%d m:%d st:%d i:%d\n", hdr[0], hdr[1], hdr[2], datalen, frame->m, start_bit, is_iframe);
 
-       
+
 
        if (!context->video) {
                context->video_track_id = context->segment->AddVideoTrack(frame->img->d_w, frame->img->d_h, 0);
@@ -411,7 +411,7 @@ static switch_status_t do_write_video(switch_file_handle_t *handle, switch_frame
                const void *data;
                int duration = 0;
 
-               
+
                switch_buffer_peek_zerocopy(context->buf, &data);
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VID samplecount: %u\n", context->timer.samplecount);
 
@@ -430,7 +430,7 @@ static switch_status_t do_write_video(switch_file_handle_t *handle, switch_frame
        }
 
 end:
-       
+
 
        return status;
 }
index 90926ef53599973ecdfb27ce7df1b3c1ef8a5237..1ef1bf3bc1b3355ed2ae080f428f2c7b52085f1a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_basic_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_basic_runtime);
 SWITCH_MODULE_LOAD_FUNCTION(mod_basic_load);
 
-/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) 
+/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
  * Defines a switch_loadable_module_function_table_t and a static const char[] modname
  */
 SWITCH_MODULE_DEFINITION(mod_basic, mod_basic_load, mod_basic_shutdown, NULL);
@@ -58,7 +58,7 @@ static switch_status_t do_config(switch_bool_t reload)
 static void _on_error(mb_interpreter_t* s, mb_error_e e, char* m, int p, unsigned short row, unsigned short col, int abort_code) {
        mb_unrefvar(s);
        if(SE_NO_ERR != e) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
                                                  "Error:\n    [POS] %d, [ROW] %d, [COL] %d,\n    [CODE] %d, [MESSAGE] %s, [ABORT CODE] %d\n", p, row, col, e, m, abort_code);
        }
 }
@@ -71,7 +71,7 @@ typedef struct fs_data {
 } fs_data_t;
 
 
-static int fun_execute(mb_interpreter_t* s, void** l) 
+static int fun_execute(mb_interpreter_t* s, void** l)
 {
        int result = MB_FUNC_OK;
        fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
@@ -104,10 +104,10 @@ static int fun_execute(mb_interpreter_t* s, void** l)
  end:
 
        return result;
-}            
+}
 
 
-static int fun_setvar(mb_interpreter_t* s, void** l) 
+static int fun_setvar(mb_interpreter_t* s, void** l)
 {
        int result = MB_FUNC_OK;
        fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
@@ -139,9 +139,9 @@ static int fun_setvar(mb_interpreter_t* s, void** l)
  end:
 
        return result;
-}            
+}
 
-static int fun_getarg(mb_interpreter_t* s, void** l) 
+static int fun_getarg(mb_interpreter_t* s, void** l)
 {
        int result = MB_FUNC_OK;
        fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
@@ -171,7 +171,7 @@ static int fun_getarg(mb_interpreter_t* s, void** l)
        return result;
 }
 
-static int fun_getvar(mb_interpreter_t* s, void** l) 
+static int fun_getvar(mb_interpreter_t* s, void** l)
 {
        int result = MB_FUNC_OK;
        fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
@@ -188,7 +188,7 @@ static int fun_getvar(mb_interpreter_t* s, void** l)
        if (var.type == MB_DT_STRING && fsdata->session) {
                switch_channel_t *channel = switch_core_session_get_channel(fsdata->session);
                const char *value = switch_channel_get_variable(channel, var.value.string);
-               
+
                mb_push_string(s, l, strdup(value));
 
        } else {
@@ -201,9 +201,9 @@ static int fun_getvar(mb_interpreter_t* s, void** l)
  end:
 
        return result;
-}            
+}
 
-static int fun_api(mb_interpreter_t* s, void** l) 
+static int fun_api(mb_interpreter_t* s, void** l)
 {
        int result = MB_FUNC_OK;
        fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
@@ -238,10 +238,10 @@ static int fun_api(mb_interpreter_t* s, void** l)
  end:
 
        return result;
-}            
+}
 
 
-static int fun_log(mb_interpreter_t* s, void** l) 
+static int fun_log(mb_interpreter_t* s, void** l)
 {
        int result = MB_FUNC_OK;
        fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
@@ -262,7 +262,7 @@ static int fun_log(mb_interpreter_t* s, void** l)
 
        if (level.type == MB_DT_STRING && data.type == MB_DT_STRING) {
                switch_log_level_t fslevel = SWITCH_LOG_DEBUG;
-               
+
                fslevel = switch_log_str2level(level.value.string);
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fsdata->session), fslevel, "%s\n", data.value.string);
        } else {
@@ -274,25 +274,25 @@ static int fun_log(mb_interpreter_t* s, void** l)
  end:
 
        return result;
-}            
+}
 
 
-static int bprint(const char *fmt, ...) 
+static int bprint(const char *fmt, ...)
 {
        char *data = NULL;
        va_list ap;
        int ret = 0;
-       
+
        va_start(ap, fmt);
        ret = switch_vasprintf(&data, fmt, ap);
        va_end(ap);
-       
+
        if (data) {
                switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "%s\n", data);
        }
 
-       switch_safe_free(data); 
-       
+       switch_safe_free(data);
+
        return ret;
 
 }
@@ -329,7 +329,7 @@ SWITCH_STANDARD_APP(basic_function)
        }
 
        mb_open(&bi);
-       mb_set_error_handler(bi, _on_error); 
+       mb_set_error_handler(bi, _on_error);
        mb_set_printer(bi, bprint);
        fsdata.session = session;
        mb_set_user_data(bi, (void *) &fsdata);
@@ -340,7 +340,7 @@ SWITCH_STANDARD_APP(basic_function)
        mb_register_func(bi, "FS_SETVAR", fun_setvar);
        mb_register_func(bi, "FS_API", fun_api);
        mb_register_func(bi, "FS_LOG", fun_log);
-       
+
        if (mb_load_file(bi, file) == MB_FUNC_OK) {
                mb_run(bi);
        } else {
@@ -358,7 +358,7 @@ SWITCH_STANDARD_API(basic_api_function)
 {
 
        basic_function(session, cmd);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index 0ce58587c4d3694468feb4659662877a6c1573de..91e87de02bc5716fb3918d05e8bc661a3c5ced03 100644 (file)
@@ -233,7 +233,7 @@ MBAPI int mb_gets(char* buf, int s);
 
 MBAPI void mb_set_user_data(mb_interpreter_t* s, void *ptr);
 MBAPI void *mb_get_user_data(mb_interpreter_t* s);
-              
+
 #ifdef MB_COMPACT_MODE
 #      pragma pack()
 #endif /* MB_COMPACT_MODE */
index 7068720eb583ff06f546bd2992b59a78a3e88eb5..3290d49c57ce2be105f4c19253e4ae04401cadfa 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2007, Damjan Jovanovic <d a m j a n d o t j o v a t g m a i l d o t c o m>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Damjan Jovanovic <d a m j a n d o t j o v a t g m a i l d o t c o m>
  *
  *
@@ -299,7 +299,7 @@ static switch_status_t create_java_vm(JavaVMOption *options, int optionCount, vm
        char *derr = NULL;
 
        pJNI_CreateJavaVM = (jint (*)(JavaVM **, void **, void *))switch_dso_func_sym(javaVMHandle, "JNI_CreateJavaVM", &derr);
-               
+
     if (!derr)
     {
         JNIEnv *env;
index cc5705f90c163273dee65487c062e758503c8663..43d00865cff675f1c5e4d6fafe296f0a02e3112d 100644 (file)
@@ -29,7 +29,7 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup);
 
 void Session::destroy(const char *err)
 {
-       
+
        if (!allocated) {
                return;
        }
@@ -157,7 +157,7 @@ void Session::do_hangup_hook()
                docall(L, arg_count, 1, 1, 0);
 
                const char *err = lua_tostring(L, -1);
-               
+
                switch_channel_set_variable(channel, "lua_hangup_hook_return_val", err);
 
                if (!zstr(err)) {
@@ -200,7 +200,7 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup)
                                coresession = (Session *) vs;
                        }
                }
-               
+
                if (!(coresession && coresession->hook_state)) {
                        return SWITCH_STATUS_FALSE;
                }
@@ -356,15 +356,15 @@ Dbh::Dbh(char *dsn, char *user, char *pass)
        dbh = NULL;
        err = NULL;
        char *tmp = NULL;
-       
+
        if (!zstr(user) || !zstr(pass)) {
-               tmp = switch_mprintf("%s%s%s%s%s", dsn, 
+               tmp = switch_mprintf("%s%s%s%s%s", dsn,
                                                         zstr(user) ? "" : ":",
                                                         zstr(user) ? "" : user,
                                                         zstr(pass) ? "" : ":",
                                                         zstr(pass) ? "" : pass
                                                         );
-               
+
                dsn = tmp;
        }
 
@@ -375,7 +375,7 @@ Dbh::Dbh(char *dsn, char *user, char *pass)
        }
 
        switch_safe_free(tmp);
-       
+
 }
 
 Dbh::~Dbh()
@@ -449,11 +449,11 @@ int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv)
 
   ret = lua_tonumber(lua_fun->L, -1);
   lua_pop(lua_fun->L, 1);
-  
+
   if (ret != 0) {
          return 1;
   }
-  
+
   return 0; /* 0 to continue with next row */
 }
 
index 535e988ae02a0070c7e2267dac103d460b5623a1..af001682c4d9e48a80afe8fd5edbcbe95a3e4212 100644 (file)
@@ -1053,7 +1053,7 @@ static lu_mem singlestep (lua_State *L) {
         g->gcstate = GCSatomic;  /* finish mark phase */
         g->GCestimate = g->GCmemtrav;  /* save what was counted */;
         work = atomic(L);  /* add what was traversed by 'atomic' */
-        g->GCestimate += work;  /* estimate of total memory traversed */ 
+        g->GCestimate += work;  /* estimate of total memory traversed */
         sw = entersweep(L);
         return work + sw * GCSWEEPCOST;
       }
index 8eb68c5a2de6059e3e7dac521e641d35d16b68a1..b28d16f71536e582abde4222fb2b56f700e2c7d4 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_lua.c -- Lua
@@ -102,7 +102,7 @@ int docall(lua_State * L, int narg, int nresults, int perror, int fatal)
                if (!zstr(err)) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
                }
-               
+
                // pass error up to top
                if (fatal) {
                        lua_error(L);
@@ -143,7 +143,7 @@ static int lua_parse_and_execute(lua_State * L, char *input_code, switch_core_se
        }
 
        while(input_code && (*input_code == ' ' || *input_code == '\n' || *input_code == '\r')) input_code++;
-       
+
        if (*input_code == '~') {
                char *buff = input_code + 1;
                error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0, 1);        //lua_pcall(L, 0, 0, 0);
@@ -274,12 +274,12 @@ static switch_xml_t lua_fetch(const char *section,
 
                lua_getglobal(L, "XML_STRING");
                str = lua_tostring(L, -1);
-               
+
                if (str) {
                        if (zstr(str)) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
-                       } else if (!(xml = switch_xml_parse_str_dynamic((char *)str, SWITCH_TRUE))) { 
-                               /* const char -> char conversion was OK because switch_xml_parse_str_dynamic makes a duplicate of str 
+                       } else if (!(xml = switch_xml_parse_str_dynamic((char *)str, SWITCH_TRUE))) {
+                               /* const char -> char conversion was OK because switch_xml_parse_str_dynamic makes a duplicate of str
                                   and saves this duplcate as root->m which is freed when switch_xml_free is issued
                                */
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
@@ -308,7 +308,7 @@ static switch_status_t do_config(void)
        switch_xml_t cfg, xml, settings, param, hook;
        switch_stream_handle_t path_stream = {0};
        switch_stream_handle_t cpath_stream = {0};
-       
+
     if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
                return SWITCH_STATUS_TERM;
@@ -423,7 +423,7 @@ static switch_status_t do_config(void)
        }
 
        switch_safe_free(path_stream.data);
-    
+
        switch_xml_free(xml);
 
        return SWITCH_STATUS_SUCCESS;
@@ -689,7 +689,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
 
        SWITCH_ADD_API(api_interface, "luarun", "run a script", luarun_api_function, "<script>");
        SWITCH_ADD_API(api_interface, "lua", "run a script as an api function", lua_api_function, "<script>");
-       SWITCH_ADD_APP(app_interface, "lua", "Launch LUA ivr", "Run a lua ivr on a channel", lua_function, "<script>", 
+       SWITCH_ADD_APP(app_interface, "lua", "Launch LUA ivr", "Run a lua ivr on a channel", lua_function, "<script>",
                                   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC | SAF_SUPPORT_TEXT_ONLY);
        SWITCH_ADD_DIALPLAN(dp_interface, "LUA", lua_dialplan_hunt);
 
index 1b241ee253cc85c4d50e226799201d671daba373..46319aba3c3e2c95b1a6cd97b92432248c8e6559 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
  * Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Michael Giagnocavo <mgg@packetrino.com>
  * Jeff Lenk <jlenk@frontiernet.net> - Modified class to support Dotnet
- * 
+ *
  * freeswitch_managed.cpp -- Managed CoreSession subclasses
  *
- */  
+ */
 
 #include <switch.h>
 #include <switch_cpp.h>
 #pragma unmanaged
 #endif
 
-ManagedSession::ManagedSession():CoreSession() 
+ManagedSession::ManagedSession():CoreSession()
 {
 
-} 
+}
 
-ManagedSession::ManagedSession(char *uuid):CoreSession(uuid) 
+ManagedSession::ManagedSession(char *uuid):CoreSession(uuid)
 {
 
-} 
+}
 
-ManagedSession::ManagedSession(switch_core_session_t *session):CoreSession(session) 
+ManagedSession::ManagedSession(switch_core_session_t *session):CoreSession(session)
 {
 
-} 
+}
 
-bool ManagedSession::begin_allow_threads() 
+bool ManagedSession::begin_allow_threads()
 {
        return true;
 }
 
-bool ManagedSession::end_allow_threads() 
+bool ManagedSession::end_allow_threads()
 {
        return true;
 }
 
-ManagedSession::~ManagedSession() 
+ManagedSession::~ManagedSession()
 {
        ATTACH_THREADS
-       // Do auto-hangup ourselves because CoreSession can't call check_hangup_hook 
+       // Do auto-hangup ourselves because CoreSession can't call check_hangup_hook
        // after ManagedSession destruction (cause at point it's pure virtual)
        if (session) {
                if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
@@ -78,7 +78,7 @@ ManagedSession::~ManagedSession()
        }
 }
 
-void ManagedSession::check_hangup_hook() 
+void ManagedSession::check_hangup_hook()
 {
        ATTACH_THREADS
        if (!hangupDelegate) {
@@ -88,7 +88,7 @@ void ManagedSession::check_hangup_hook()
        hangupDelegate();
 }
 
-switch_status_t ManagedSession::run_dtmf_callback(void *input, switch_input_type_t itype) 
+switch_status_t ManagedSession::run_dtmf_callback(void *input, switch_input_type_t itype)
 {
        ATTACH_THREADS
        if (!dtmfDelegate) {
@@ -98,7 +98,7 @@ switch_status_t ManagedSession::run_dtmf_callback(void *input, switch_input_type
        char *result = dtmfDelegate(input, itype);
        switch_status_t status = process_callback_result(result);
 
-       RESULT_FREE(result); 
+       RESULT_FREE(result);
 
        return status;
 }
index df66f0b3bc871722b262526fe596e1ef4404989e..aac135d629cdeaf4581ed7f7870028e1f3cd2a2e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
  * Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Michael Giagnocavo <mgg@packetrino.com>
  * Jeff Lenk <jlenk@frontiernet.net> - Modified class to support Dotnet
  * 
index 3ad7c519d6757ec76169ff4265a4506ff9a07907..17356f7fa8128a4d870ee4b991e4f7148ba54365 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
  * Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Michael Giagnocavo <mgg@giagnocavo.net>
  * David Brazier <David.Brazier@360crm.co.uk>
- * Jeff Lenk <jlenk@frontiernet.net> 
+ * Jeff Lenk <jlenk@frontiernet.net>
  * Artur Kraev <ravenox@gmail.com>
  *
  * mod_mono.cpp -- FreeSWITCH mod_mono main class
  *
- * Most of mod_mono is implmented in the mod_mono_managed Loader class. 
+ * Most of mod_mono is implmented in the mod_mono_managed Loader class.
  * The native code just handles getting the Mono runtime up and down
  * and passing pointers into managed code.
- */  
+ */
 
 #include <switch.h>
-#include "freeswitch_managed.h" 
+#include "freeswitch_managed.h"
 
 #ifdef _MANAGED
 #include <mscoree.h>
@@ -47,7 +47,7 @@ using namespace System::Runtime::InteropServices;
 #define MOD_MANAGED_VERSION "Mono Version"
 #endif
 
-SWITCH_BEGIN_EXTERN_C 
+SWITCH_BEGIN_EXTERN_C
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load);
 SWITCH_MODULE_DEFINITION_EX(mod_managed, mod_managed_load, NULL, NULL, SMODF_GLOBAL_SYMBOLS);
@@ -94,7 +94,7 @@ SWITCH_MOD_DECLARE_NONSTD(void) InitManagedDelegates(runFunction run, executeFun
 // Sets up delegates (and anything else needed) on the ManagedSession object
 // Called from ManagedSession.Initialize Managed -> this is Unmanaged code so all pointers are marshalled and prevented from GC
 // Exported method.
-SWITCH_MOD_DECLARE_NONSTD(void) InitManagedSession(ManagedSession *session, inputFunction dtmfDelegate, hangupFunction hangupDelegate) 
+SWITCH_MOD_DECLARE_NONSTD(void) InitManagedSession(ManagedSession *session, inputFunction dtmfDelegate, hangupFunction hangupDelegate)
 {
        switch_assert(session);
        if (!session) {
@@ -106,15 +106,15 @@ SWITCH_MOD_DECLARE_NONSTD(void) InitManagedSession(ManagedSession *session, inpu
        session->hangupDelegate = hangupDelegate;
 }
 
-#ifndef _MANAGED       
+#ifndef _MANAGED
 
 #ifdef WIN32
 #include <shlobj.h>
-#endif 
+#endif
 
-switch_status_t setMonoDirs() 
+switch_status_t setMonoDirs()
 {
-#ifdef WIN32   
+#ifdef WIN32
        // Win32 Mono installs can't figure out their own path
        // Guys in #mono say we should just deploy all the libs we need
        // We'll first check for Program Files\Mono to allow people to use the symlink dir for a specific version.
@@ -171,7 +171,7 @@ switch_status_t setMonoDirs()
                FindClose(hFind);
        }
 
-       /* Got it */ 
+       /* Got it */
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Using Mono paths '%s' and '%s'.\n", libPath, etcPath);
        mono_set_dirs(libPath, etcPath);
        return SWITCH_STATUS_SUCCESS;
@@ -180,19 +180,19 @@ switch_status_t setMonoDirs()
        // On other platforms, it should just work if it hasn't been relocated
        mono_set_dirs(NULL, NULL);
        return SWITCH_STATUS_SUCCESS;
-#endif 
+#endif
 }
 
-switch_status_t loadRuntime() 
+switch_status_t loadRuntime()
 {
-       /* Find and load mod_mono_managed.exe */ 
+       /* Find and load mod_mono_managed.exe */
        char filename[256];
 
        if (setMonoDirs() != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_FALSE;
        }
 
-#ifndef WIN32  
+#ifndef WIN32
        // So linux can find the .so
        char xmlConfig[300];
        switch_snprintf(xmlConfig, 300, "<configuration><dllmap dll=\"mod_managed\" target=\"%s%smod_managed.so\"/></configuration>", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR);
@@ -218,7 +218,7 @@ switch_status_t loadRuntime()
        MonoAssemblyName *name = mono_assembly_name_new (MOD_MANAGED_ASM_NAME);
        //Note also that it can't be allocated on the stack anymore and you'll need to create and destroy it with the following API:
        //mono_assembly_name_free (name);
-       
+
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Calling mono_assembly_loaded.\n");
 
        if (!(managed_globals.mod_mono_asm = mono_assembly_loaded(name))) {
@@ -234,7 +234,7 @@ switch_status_t loadRuntime()
        return SWITCH_STATUS_SUCCESS;
 }
 
-MonoMethod * getMethod(const char *name, MonoClass * klass) 
+MonoMethod * getMethod(const char *name, MonoClass * klass)
 {
        MonoMethodDesc * desc;
        MonoMethod * method;
@@ -250,9 +250,9 @@ MonoMethod * getMethod(const char *name, MonoClass * klass)
        return method;
 }
 
-switch_status_t findLoader() 
+switch_status_t findLoader()
 {
-       /* Find loader class and methods */ 
+       /* Find loader class and methods */
        MonoClass * loaderClass;
        MonoImage * img = mono_assembly_get_image(managed_globals.mod_mono_asm);
 
@@ -276,9 +276,9 @@ switch_status_t findLoader()
 
 #ifdef _MANAGED
 
-switch_status_t loadRuntime() 
+switch_status_t loadRuntime()
 {
-       /* Find and load mod_dotnet_managed.dll */ 
+       /* Find and load mod_dotnet_managed.dll */
        char filename[256];
        switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MANAGED_DLL);
 
@@ -295,7 +295,7 @@ switch_status_t loadRuntime()
        return SWITCH_STATUS_SUCCESS;
 }
 
-switch_status_t findLoader() 
+switch_status_t findLoader()
 {
        try {
                FreeSwitchManaged::loadMethod = FreeSwitchManaged::mod_dotnet_managed->GetType(MOD_MANAGED_IMAGE_NAME "." MOD_MANAGED_CLASS_NAME)->GetMethod("Load");
@@ -310,20 +310,20 @@ switch_status_t findLoader()
 }
 #endif
 
-SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load) 
+SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
 {
        int success;
-       /* connect my internal structure to the blank pointer passed to me */ 
+       /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Loading mod_managed (Common Language Infrastructure), " MOD_MANAGED_VERSION "\n");
 
        managed_globals.pool = pool;
-       
-       if (loadRuntime() != SWITCH_STATUS_SUCCESS) {                   
+
+       if (loadRuntime() != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_FALSE;
        }
-       
-       if (findLoader() != SWITCH_STATUS_SUCCESS) {            
+
+       if (findLoader() != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_FALSE;
        }
 #ifdef _MANAGED
@@ -342,7 +342,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
        /* Not sure if this is necesary on the loading thread */ 
        mono_thread_attach(managed_globals.domain);
 
-       /* Run loader */ 
+       /* Run loader */
        MonoObject * exception = NULL;
        MonoObject * objResult = mono_runtime_invoke(managed_globals.loadMethod, NULL, NULL, &exception);
        if (exception) {
@@ -354,12 +354,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
 #endif
        if (success) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Load completed successfully.\n");
-       } else {                
+       } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load did not return true.\n");
                return SWITCH_STATUS_FALSE;
        }
-       
-       /* We're good to register */ 
+
+       /* We're good to register */
        switch_api_interface_t *api_interface;
        switch_application_interface_t *app_interface;
 
@@ -374,10 +374,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
 #ifdef _MANAGED
 #pragma unmanaged
 #endif
-SWITCH_STANDARD_API(managedrun_api_function) 
+SWITCH_STANDARD_API(managedrun_api_function)
 {
        if (zstr(cmd)) {
-               stream->write_function(stream, "-ERR no args specified!\n");    
+               stream->write_function(stream, "-ERR no args specified!\n");
                return SWITCH_STATUS_SUCCESS;
        }
 #ifndef _MANAGED
@@ -385,7 +385,7 @@ SWITCH_STANDARD_API(managedrun_api_function)
 #endif
        if (executeBackgroundDelegate(cmd)) {
                stream->write_function(stream, "+OK\n");
-       } else {        
+       } else {
                stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module or exception?).\n");
        }
 #ifndef _MANAGED
@@ -394,17 +394,17 @@ SWITCH_STANDARD_API(managedrun_api_function)
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_STANDARD_API(managed_api_function) 
+SWITCH_STANDARD_API(managed_api_function)
 {
        if (zstr(cmd)) {
-               stream->write_function(stream, "-ERR no args specified!\n");    
+               stream->write_function(stream, "-ERR no args specified!\n");
                return SWITCH_STATUS_SUCCESS;
        }
 #ifndef _MANAGED
        mono_thread_attach(managed_globals.domain);
 #endif
        if (!(executeDelegate(cmd, stream, stream->param_event))) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd); 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd);
        }
 #ifndef _MANAGED
        mono_thread_detach(mono_thread_current());
@@ -412,7 +412,7 @@ SWITCH_STANDARD_API(managed_api_function)
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_STANDARD_APP(managed_app_function) 
+SWITCH_STANDARD_APP(managed_app_function)
 {
        if (zstr(data)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");
@@ -429,17 +429,17 @@ SWITCH_STANDARD_APP(managed_app_function)
 #endif
 }
 
-SWITCH_STANDARD_API(managedreload_api_function) 
+SWITCH_STANDARD_API(managedreload_api_function)
 {
        if (zstr(cmd)) {
-               stream->write_function(stream, "-ERR no args specified!\n");    
+               stream->write_function(stream, "-ERR no args specified!\n");
                return SWITCH_STATUS_SUCCESS;
        }
 #ifndef _MANAGED
        mono_thread_attach(managed_globals.domain);
 #endif
        if (!(reloadDelegate(cmd))) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd); 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd);
        }
 #ifndef _MANAGED
        mono_thread_detach(mono_thread_current());
index 84b206325f00ee05f7d5d2f84fb01f48f4da22c6..220a16054fd55487f356b7b794b8d99b4235dbd7 100644 (file)
@@ -47,7 +47,7 @@ static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);
 
 void Session::destroy(void)
 {
-       
+
        if (!allocated) {
                return;
        }
@@ -63,7 +63,7 @@ void Session::destroy(void)
        switch_safe_free(cb_function);
        switch_safe_free(cb_arg);
        switch_safe_free(hangup_func_str);
-       switch_safe_free(hangup_func_arg);      
+       switch_safe_free(hangup_func_arg);
 
        CoreSession::destroy();
 }
@@ -189,7 +189,7 @@ void Session::unsetInputCallback(void)
        switch_channel_set_private(channel, "CoreSession", NULL);
        args.input_callback = NULL;
        ap = NULL;
-       
+
 }
 
 void Session::setInputCallback(char *cbfunc, char *funcargs)
@@ -229,7 +229,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
                        HV *hash;
                        SV *this_sv;
                        char *code;
-                       
+
                        if (!(hash = get_hv("__dtmf", TRUE))) {
                                abort();
                        }
@@ -243,7 +243,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
                        this_sv = newSV(strlen(str) + 1);
                        sv_setpv(this_sv, str);
                        hv_store(hash, "duration", 8, this_sv, 0);
-                       
+
                        code = switch_mprintf("eval { $__RV = &%s($%s, 'dtmf', \\%%__dtmf, %s);};", cb_function, suuid, switch_str_nil(cb_arg));
                        Perl_eval_pv(my_perl, code, FALSE);
                        free(code);
@@ -272,7 +272,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
                        }
 
                        mod_perl_conjure_event(my_perl, event, var_name);
-                       code = switch_mprintf("eval {$__RV = &%s($%s, 'event', $%s, '%s');};$%s = undef;", 
+                       code = switch_mprintf("eval {$__RV = &%s($%s, 'event', $%s, '%s');};$%s = undef;",
                                                                  cb_function, suuid, var_name, switch_str_nil(cb_arg), var_name);
                        Perl_eval_pv(my_perl, code, FALSE);
                        free(code);
index dfd47dfeb8d548474cfdbe761e17d0d82a60cb1b..8df36d37f33c3dd8e2a2e83bdcd8b3044c72fbcd 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index 2fa58da6ade938e9d34e07c3b0bd327d56f67b4a..9094e987970b36208df2ef01ec0c5567b20472ff 100644 (file)
@@ -23,7 +23,7 @@ static switch_status_t python_hanguphook(switch_core_session_t *session_hungup);
 
 void Session::destroy(void)
 {
-       
+
        if (!allocated) {
                return;
        }
@@ -40,7 +40,7 @@ void Session::destroy(void)
                Py_DECREF(hangup_func);
         hangup_func = NULL;
     }
-       
+
        if (hangup_func_arg) {
                Py_DECREF(hangup_func_arg);
                hangup_func_arg = NULL;
@@ -124,7 +124,7 @@ bool Session::ready()
 
        /*! this is called every time ready is called as a workaround to
          make it threadsafe.  it sets a flag, and all the places where it
-         comes in and out of threadswap, check it.  so the end result is 
+         comes in and out of threadswap, check it.  so the end result is
          you still get the hangup hook executed pretty soon after you
          hangup.  */
        do_hangup_hook();
@@ -148,7 +148,7 @@ void Session::do_hangup_hook()
                mark++;
 
                if (hangup_func) {
-                       
+
                        if (!PyCallable_Check(hangup_func)) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
                                return;
@@ -157,7 +157,7 @@ void Session::do_hangup_hook()
                        if (!Self) {
                                mod_python_conjure_session(NULL, session);
                        }
-                       
+
                        if (hangup_func_arg) {
                                arglist = Py_BuildValue("(OsO)", Self, what, hangup_func_arg);
                        } else {
@@ -167,7 +167,7 @@ void Session::do_hangup_hook()
                        if (!(result = PyEval_CallObject(hangup_func, arglist))) {
                                PyErr_Print();
                        }
-                       
+
                        Py_XDECREF(arglist);
                        Py_XDECREF(hangup_func_arg);
                }
@@ -212,7 +212,7 @@ void Session::setHangupHook(PyObject *pyfunc, PyObject *arg)
                Py_XDECREF(hangup_func_arg);
                hangup_func_arg = NULL;
        }
-       
+
        hangup_func = pyfunc;
        hangup_func_arg = arg;
 
@@ -239,10 +239,10 @@ void Session::unsetInputCallback(void)
         Py_XDECREF(cb_arg);
         cb_arg = NULL;
     }
-       
+
        args.input_callback = NULL;
        ap = NULL;
-       
+
 }
 
 void Session::setInputCallback(PyObject *cbfunc, PyObject *funcargs)
@@ -295,7 +295,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if (itype == SWITCH_INPUT_TYPE_DTMF) {
                switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
                io = mod_python_conjure_DTMF(dtmf->digit, dtmf->duration);
@@ -311,7 +311,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
        if (!Self) {
                mod_python_conjure_session(NULL, session);
        }
-       
+
        if (cb_arg) {
                arglist = Py_BuildValue("(OsOO)", Self, what, io, cb_arg);
        } else {
index c9bd2724ec3be84c69db66714f33656f28ce7c22..9359c7c4f6ce29cc7ddbc961c959436d14b34d8c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Brian Fertig <brian.fertig@convergencetek.com>
  * Johny Kadarisman <jkr888@gmail.com>
  * Traun Leyden <tleyden@branchcut.com>
@@ -77,7 +77,7 @@ static switch_mutex_t *THREAD_POOL_LOCK = NULL;
 
 
 /**
-* This function is similiar to PyErr_Print. It uses the freeswitch print/log mechanism instead of the python sys.stderr 
+* This function is similiar to PyErr_Print. It uses the freeswitch print/log mechanism instead of the python sys.stderr
 */
 static void print_python_error(const char * script)
 {
@@ -91,7 +91,7 @@ static void print_python_error(const char * script)
        if (buffer == NULL ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough Memory to create the error buffer");
        }
-   
+
        /* just for security that we will always have a string terminater */
        memset(buffer, 0,  20 * 1024  * sizeof(char) );
 
@@ -113,7 +113,7 @@ static void print_python_error(const char * script)
 
        /*Print error message*/
        if (pyValue != NULL && (pyString=PyObject_Str(pyValue))!=NULL && (PyString_Check(pyString))) {
-               strcat(buffer, "\nMessage: ");    
+               strcat(buffer, "\nMessage: ");
                strcat(buffer, PyString_AsString(pyString));
        } else {
                strcat(buffer, "\nMessage: <unknown exception date> ");
@@ -279,7 +279,7 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi
                arg = Py_BuildValue("(s)", switch_str_nil(argv[1]));
        }
 
-       // invoke the handler 
+       // invoke the handler
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call python script \n");
        result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL);
        Py_DECREF(function);
@@ -291,7 +291,7 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi
                        *str = strdup((char *) PyString_AsString(result));
                }
        } else if (!PyErr_ExceptionMatches(PyExc_SystemExit)) {
-               // Print error, but ignore SystemExit 
+               // Print error, but ignore SystemExit
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n");
                print_python_error(script);
                PyErr_Clear();
@@ -602,7 +602,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown)
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt);
 
-       /* Give threads a few seconds to terminate. 
+       /* Give threads a few seconds to terminate.
           Not using switch_thread_join() since if threads refuse to die
           then freeswitch will hang */
        for (i = 0; i < 10 && thread_pool_head; i++) {
index 0885a78344945ab7036197c9b0d6da38a766b001..fe2ff65de3500a83c56bcca10295a18e325f9d91 100644 (file)
@@ -559,7 +559,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
                                                /* Add xml handler global variables */
 
                                                Handle<Array> XML_REQUEST = Array::New(isolate, 4);
-                                               
+
                                                XML_REQUEST->Set(String::NewFromUtf8(isolate, "key_name"), String::NewFromUtf8(isolate, js_safe_str(xml_handler->key_name)));
                                                XML_REQUEST->Set(String::NewFromUtf8(isolate, "key_value"), String::NewFromUtf8(isolate, js_safe_str(xml_handler->key_value)));
                                                XML_REQUEST->Set(String::NewFromUtf8(isolate, "section"), String::NewFromUtf8(isolate, js_safe_str(xml_handler->section)));
@@ -661,7 +661,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
                                                                }
 
                                                                if (xml_handler)
-                                                               {                                                                       
+                                                               {
                                                                        Local<Value> value = context->Global()->Get(String::NewFromUtf8(isolate, "XML_STRING"));
                                                                        String::Utf8Value str(value);
                                                                        if (strcmp(js_safe_str(*str), "undefined"))
@@ -698,7 +698,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
 #endif
        }
        //isolate->Exit();
-       
+
        if (res.length() == 0) {
                result = -1;
        } else {
@@ -741,16 +741,16 @@ static switch_xml_t v8_fetch(const char *section,
                        if (zstr(xml_handler.XML_STRING)) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
                        }
-                       else if (!(xml = switch_xml_parse_str_dynamic(xml_handler.XML_STRING, SWITCH_TRUE))) {                          
+                       else if (!(xml = switch_xml_parse_str_dynamic(xml_handler.XML_STRING, SWITCH_TRUE))) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
                        }
                }
 
                // Don't forget to free XML_STRING
                switch_safe_free(xml_handler.XML_STRING);
-               
+
        }
-       
+
        switch_safe_free(mycmd);
 
        return xml;
@@ -919,7 +919,7 @@ SWITCH_STANDARD_JSON_API(json_function)
        switch_stream_handle_t stream = { 0 };
 
        if ((data = cJSON_GetObjectItem(json, "data"))) {
-               path = cJSON_GetObjectItem(data, "path"); 
+               path = cJSON_GetObjectItem(data, "path");
        }
 
        if (!(path && data)) {
@@ -934,7 +934,7 @@ SWITCH_STANDARD_JSON_API(json_function)
        switch_safe_free(json_text);
 
        v8_parse_and_execute(session, (char *) path->valuestring, &stream, NULL, NULL);
-       
+
        *json_reply = cJSON_Parse((char *)stream.data);
 
  end:
@@ -946,7 +946,7 @@ SWITCH_STANDARD_JSON_API(json_function)
 
        switch_event_destroy(&stream.param_event);
        switch_safe_free(stream.data);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index 9bcb00c38ff01216c67b922fd8712c5e7b0ad7e7..b0b920df33e8d14ad499a36b56a5301644937998 100644 (file)
@@ -179,7 +179,7 @@ JS_COREDB_FUNCTION_IMPL(Exec)
 }
 
 /* Evaluate a prepared statement
-  stepSuccessCode expected success code from switch_core_db_step() 
+  stepSuccessCode expected success code from switch_core_db_step()
   return true if step return expected success code, false otherwise
 */
 void FSCoreDB::StepEx(const v8::FunctionCallbackInfo<Value>& info, int stepSuccessCode)
@@ -214,7 +214,7 @@ void FSCoreDB::StepEx(const v8::FunctionCallbackInfo<Value>& info, int stepSucce
        }
 }
 
-/* Evaluate a prepared statement, to be used with statements that return data 
+/* Evaluate a prepared statement, to be used with statements that return data
   return true while data is available, false when done or error
 */
 JS_COREDB_FUNCTION_IMPL(Next)
@@ -223,8 +223,8 @@ JS_COREDB_FUNCTION_IMPL(Next)
        StepEx(info, SWITCH_CORE_DB_ROW);
 }
 
-/* Evaluate a prepared statement, to be used with statements that return no data 
-  return true if statement has finished executing successfully, false otherwise 
+/* Evaluate a prepared statement, to be used with statements that return no data
+  return true if statement has finished executing successfully, false otherwise
 */
 JS_COREDB_FUNCTION_IMPL(Step)
 {
index 3c0184c4eed4446698b5e335f22b266a308b0c3d..60ad42f200d3fa1303f00d5a46052de890de03fd 100644 (file)
@@ -70,7 +70,7 @@ size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
 
        HandleScope handle_scope(obj->GetIsolate());
        Handle<Function> func;
-       
+
        if (!obj->_function.IsEmpty()) {
                func = Local<Function>::New(obj->GetIsolate(), obj->_function);
        }
index cea4dbb55219c953e1d431572644edb82379ed5b..605df59b89870ad8563474fa15f3645e4c97eb70 100644 (file)
@@ -227,10 +227,10 @@ JS_DBH_FUNCTION_IMPL(query)
 
        void *arg = NULL;
        switch_core_db_callback_func_t cb_func = NULL;
-       
+
        Handle<Function> func = Handle<Function>();
 
-       if (info.Length() > 1) 
+       if (info.Length() > 1)
            func = JSBase::GetFunctionFromArg(info.GetIsolate(), info[1]);
 
        if (!func.IsEmpty()) {
@@ -238,7 +238,7 @@ JS_DBH_FUNCTION_IMPL(query)
                cb_func = FSDBH::Callback;
                arg = this;
        }
-       
+
        if (dbh) {
                if (!func.IsEmpty()) {
                        if (switch_cache_db_execute_sql_callback(dbh, sql, cb_func, arg, &err) == SWITCH_STATUS_SUCCESS) {
index 77bc56a4d6f56433e7ef753cb5e576dfccbcf335..e3e24416c68c5a7580f83142a58dfa1052e4819f 100644 (file)
@@ -62,7 +62,7 @@ Handle<Object> FSDTMF::New(switch_dtmf_t *dtmf, const char *name, JSMain *js)
                        delete obj;
                }
        }
-       
+
        return Handle<Object>();
 }
 
index f72cf2bb97c3f41487849a91b015761f226a5c73..b56d4faaf558a220c95e9772f745145c8ebdd804 100644 (file)
@@ -207,7 +207,7 @@ void FSEventHandler::DoSubscribe(const v8::FunctionCallbackInfo<v8::Value>& info
                        }
                }
        }
-       
+
        info.GetReturnValue().Set(ret);
 }
 
@@ -257,7 +257,7 @@ JS_EVENTHANDLER_FUNCTION_IMPL(UnSubscribe)
                        }
                }
        }
-       
+
        info.GetReturnValue().Set(ret);
 }
 
index 38948c1843060f3db2d4c8b4535578b15f15d1df..5e3bd5d0921f9c41769726960bd1908cb9d150ec 100644 (file)
@@ -486,7 +486,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(Include)
                        }
                        switch_safe_free(path);
                }
-       
+
                info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Failed to include javascript file"));
        }
 }
@@ -582,7 +582,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(Email)
        JS_CHECK_SCRIPT_STATE();
        HandleScope handle_scope(info.GetIsolate());
        string to, from, headers, body, file, convert_cmd, convert_ext;
-       
+
        if (info.Length() > 0) {
                String::Utf8Value str(info[0]);
                to = js_safe_str(*str);
@@ -642,7 +642,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(Bridge)
        if (info.Length() > 1) {
                if (info[0]->IsObject()) {
                        obj_a = Handle<Object>::Cast(info[0]);
-                       
+
                        if (!(jss_a = JSBase::GetInstance<FSSession>(obj_a))) {
                                info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Cannot find session A"));
                                return;
index 80bc90ebd7b50ea80a0c1c1bf286f5e3694b8aad..5b34ebe36e891187efad940b17ef126e9d9fcd68 100644 (file)
@@ -316,7 +316,7 @@ JS_ODBC_FUNCTION_IMPL(GetData)
                        SQLCHAR name[1024] = "";
                        SQLCHAR *data = _colbuf;
                        SQLLEN pcbValue;
-                       
+
                        SQLDescribeCol(_stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
                        SQLGetData(_stmt, x, SQL_C_CHAR, _colbuf, _cblen, &pcbValue);
 
index bd1edd88b1ca203e38a6c060d5a123f248bd838d..f5f7c39cbd6d336ba6764a0c6e2f9bb2b8c65c24 100644 (file)
@@ -1778,7 +1778,7 @@ JS_SESSION_FUNCTION_IMPL(Bridge)
        if (info.Length() > 0) {
                if (info[0]->IsObject()) {
                        obj_b = Handle<Object>::Cast(info[0]);
-                       
+
                        if (!(jss_b = JSBase::GetInstance<FSSession>(obj_b))) {
                                info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Cannot find session B"));
                                return;
index 7d20e00c0c06ea771185489f9589ca4b2ecf14ba..1e4fd36057b6a0fe9fa77cbe69eaa18091e9d2f6 100644 (file)
@@ -39,12 +39,12 @@ FSXML::~FSXML(void)
 {
        if (!_rootObject) {
                /* This is the root object */
-                       
+
                /* Free the xml struct if it still exists */
                if (_xml) {
                        switch_xml_free(_xml);
                }
-               
+
                /* Free all sub-objects in the hash and destroy the hash */
                DestroyHash();
        } else if (_rootObject && _xml && _rootObject->_obj_hash) {
@@ -118,7 +118,7 @@ Handle<Value> FSXML::GetJSObjFromXMLObj(const switch_xml_t xml, const v8::Functi
        } else {
                rootObj = _rootObject;
        }
-               
+
        if (!rootObj) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find XML root node\n");
                return Handle<Value>();
@@ -140,9 +140,9 @@ Handle<Value> FSXML::GetJSObjFromXMLObj(const switch_xml_t xml, const v8::Functi
                        newObj->RegisterInstance(info.GetIsolate(), "", true);
                }
        }
-               
+
        if (newObj) {
-               return newObj->GetJavaScriptObject(); 
+               return newObj->GetJavaScriptObject();
        }
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new object - memory error?\n");
@@ -345,7 +345,7 @@ JS_XML_IMPL_STATIC(Remove)
        JS_CHECK_SCRIPT_STATE();
 
        FSXML *obj = JSBase::GetInstance<FSXML>(info);
-       
+
        if (obj) {
                switch_xml_remove(obj->_xml);
                if (!obj->_rootObject) {
index f06240da093666bf8b2e7d3edf12202e8348a193..9e21bb5e53d05a30718398608652d5066569f47d 100644 (file)
@@ -98,7 +98,7 @@ const string JSMain::LoadFileToString(const string& filename)
 JSMain::JSMain(void)
 {
        isolate = Isolate::New();
-       
+
        extenderClasses = new vector<const js_class_definition_t *>();
        extenderFunctions = new vector<js_function_t *>();
        extenderInstances = new vector<registered_instance_t*>();
@@ -178,7 +178,7 @@ const string JSMain::GetExceptionInfo(Isolate* isolate, TryCatch* try_catch)
                ostringstream ss;
 
                ss << filename_string << ":" << linenum << ": " << exception_string << "\r\n";
-               
+
                // Print line of source code.
                String::Utf8Value sourceline(message->GetSourceLine());
                const char *sourceline_string = js_safe_str(*sourceline);
@@ -223,7 +223,7 @@ void JSMain::Include(const v8::FunctionCallbackInfo<Value>& args)
                        return;
                }
        }
-       
+
        args.GetReturnValue().Set(Undefined(args.GetIsolate()));
 }
 
@@ -233,7 +233,7 @@ void JSMain::Log(const v8::FunctionCallbackInfo<Value>& args)
        String::Utf8Value str(args[0]);
 
        printf("%s\r\n", js_safe_str(*str));
-       
+
        args.GetReturnValue().Set(Undefined(args.GetIsolate()));
 }
 
@@ -340,7 +340,7 @@ const string JSMain::ExecuteString(const string& scriptData, const string& fileN
 #endif
        }
        //isolate->Exit();
-       
+
        if (resultIsError) {
                *resultIsError = isError;
        }
index eee10ba4912c24f5f5209bc1d5a4cc1db7bf4935..4c824e7137f056afd39ed53c15681a7eee10f796 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
 
  *
index 6c2b82812a77a60d35d45edeaf72f871b2176ab3..6e9c4eea00f6ef54847cffdef679d78c3556fa4f 100644 (file)
@@ -2,8 +2,8 @@
   <!-- pick a file name, a function name or 'all' -->
   <!-- map as many as you need for specific debugging -->
   <mappings>
-    <!-- 
-      name can be a file name, function name or 'all' 
+    <!--
+      name can be a file name, function name or 'all'
       value is one or more of debug,info,notice,warning,err,crit,alert,all
       See examples below
 
       Example: the following turns on debugging for error and critical levels only
       <map name="all" value="err,crit"/>
 
-      NOTE: using map name="all" will override any other settings!  If you 
+      NOTE: using map name="all" will override any other settings!  If you
             want a more specific set of console messages then you will need
             to specify which files and/or functions you want to have debug
-            messages.  One option is to turn on just the more critical 
-            messages with map name="all", then specify the other types of 
+            messages.  One option is to turn on just the more critical
+            messages with map name="all", then specify the other types of
             console messages you want to see for various files and functions.
 
       Example: turn on ERROR, CRIT, ALERT for all modules, then specify other
         <map name="mod_sndfile.c" value="warning,info,debug"/>
      -->
     <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
-    
+
     <!--
       You can use or modify this sample set of mappings.  It turns on higher
       level messages for all modules and then specifies extra lower level
       messages for freetdm, Sofia, and switch core messages.
-      
+
     <map name="all"                         value="warning,err,crit,alert"/>
     <map name="zap_analog.c"                value="all"/>
     <map name="zap_io.c"                    value="all"/>
@@ -44,8 +44,8 @@
     <map name="zap_zt.c"                    value="all"/>
     <map name="mod_freetdm"                 value="all"/>
     <map name="sofia.c"                     value="notice"/>
-    <map name="switch_core_state_machine.c" value="all"/>      
-    
+    <map name="switch_core_state_machine.c" value="all"/>
+
     -->
   </mappings>
   <settings>
index a01d1c9b7d3680f46d32f7b9f0c9248f726a0868..c968600dec9f573946616b960715512fa0d2ffe5 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -47,10 +47,10 @@ static WORD
 #else
 static const char *
 #endif
-       
-       
-       
+
+
+
+
        COLORS[] =
        { SWITCH_SEQ_DEFAULT_COLOR, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN, SWITCH_SEQ_FGREEN,
 SWITCH_SEQ_FYELLOW };
index e27157a68940bd2f43e18d8cf4d1eb1219da9d84..fef005f56bdcff261c9a2ba57d8443d23011aca7 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * mod_graylog2 for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2014-2015, Grasshopper
  *
@@ -179,9 +179,9 @@ static char *to_gelf(const switch_log_node_t *node, switch_log_level_t log_level
 
        gelf_text = cJSON_PrintUnformatted(gelf);
        cJSON_Delete(gelf);
-       
+
        switch_safe_free(parsed_full_message);
-       
+
        return gelf_text;
 }
 
@@ -343,13 +343,13 @@ static switch_status_t do_config(void)
                        }
 
                        if (zstr(value)) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring empty value for param \"%s\"\n", name); 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring empty value for param \"%s\"\n", name);
                                continue;
                        }
 
                        if (!strcmp(name, "server-host")) {
                                globals.server_host = switch_core_strdup(globals.pool, value);
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value); 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
                        } else if (!strcasecmp(name, "server-port")) {
                                int port = -1;
                                if (switch_is_number(value)) {
@@ -357,21 +357,21 @@ static switch_status_t do_config(void)
                                }
                                if (port > 0 && port <= 65535) {
                                        globals.server_port = port;
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value); 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
                                } else {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid port: \"%s\"\n", value); 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid port: \"%s\"\n", value);
                                }
                        } else if (!strcasecmp(name, "loglevel")) {
                                switch_log_level_t log_level = switch_log_str2level(value);
                                if (log_level == SWITCH_LOG_INVALID) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring invalid log level: \"%s\"\n", value);
                                } else {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value); 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
                                        globals.log_level = log_level;
                                }
                        } else if (!strcasecmp(name, "send-uncompressed-header")) {
                                globals.send_uncompressed_header = switch_true(value);
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value); 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unknown param: \"%s\"\n", name);
                        }
index 546db4abafa359f006c30fad9fb447a36fad16f0..776ddd78022c557dd7b5d63bd31991dc8ea96e2f 100644 (file)
@@ -17,8 +17,8 @@
         <param name="uuid" value="true" />
       </settings>
       <mappings>
-       <!-- 
-            name can be a file name, function name or 'all' 
+       <!--
+            name can be a file name, function name or 'all'
             value is one or more of debug,info,notice,warning,err,crit,alert,all
             Please see comments in console.conf.xml for more information
        -->
index 0eba7466c4d8848aa7d0428d84af691986dbfdd4..e74aee444b3bbfbc4fa268fae485136927480126 100644 (file)
@@ -168,7 +168,7 @@ static switch_status_t mod_logfile_rotate(logfile_profile_t *profile)
                }
 
                sprintf((char *) to_filename, "%s.%i", profile->logfile, i);
-                       
+
                if (switch_file_exists(to_filename, pool) == SWITCH_STATUS_SUCCESS) {
                        if ((status = switch_file_remove(to_filename, pool)) != SWITCH_STATUS_SUCCESS) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error removing log %s [%s]\n", to_filename, strerror(errno));
@@ -296,15 +296,15 @@ static switch_status_t process_node(const switch_log_node_t *node, switch_log_le
                                char *dup = strdup(node->data);
                                char *lines[100];
                                int argc, i;
-                               
+
                                argc = switch_split(dup, '\n', lines);
                                for (i = 0; i < argc; i++) {
                                        switch_snprintf(buf, sizeof(buf), "%s %s\n", node->userdata, lines[i]);
-                                       mod_logfile_raw_write(profile, buf);    
+                                       mod_logfile_raw_write(profile, buf);
                                }
-                               
+
                                free(dup);
-                               
+
                        } else {
                                mod_logfile_raw_write(profile, node->data);
                        }
index 5f5fd04cc60911d761cbee287e4fb4815dae8e3f..335294673c8a817a6d60b0143aa4303df213ebcf 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2010, James Martelletti <james@nerdc0re.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Tamas Cseke <tamas.cseke@vcc.live>
  *
  * mod_raven.c -- Raven Logging
@@ -69,7 +69,7 @@ static switch_loadable_module_interface_t raven_module_interface = {
        /*.directory_interface */ NULL
 };
 
-static switch_status_t encode(const char *raw, int raw_len, char **encoded_out) 
+static switch_status_t encode(const char *raw, int raw_len, char **encoded_out)
 {
     z_stream stream;
     unsigned char *encoded = NULL, *compressed = NULL;
@@ -84,7 +84,7 @@ static switch_status_t encode(const char *raw, int raw_len, char **encoded_out)
                return SWITCH_STATUS_FALSE;
     }
 
-    stream.next_in = (unsigned char *)raw;    
+    stream.next_in = (unsigned char *)raw;
     stream.avail_in = raw_len;
 
     do {
@@ -94,7 +94,7 @@ static switch_status_t encode(const char *raw, int raw_len, char **encoded_out)
 
                stream.avail_out = compressed_size - compressed_len;
                stream.next_out = compressed + compressed_len;
-               
+
                ret = deflate(&stream, Z_FINISH);
                assert(ret != Z_STREAM_ERROR);
                compressed_len = compressed_size - stream.avail_out;
@@ -155,7 +155,7 @@ static switch_status_t raven_capture(const char *userdata, const char *message,
                                                                                   " sentry_client=%s,"
                                                                                   " sentry_timestamp=%d,"
                                                                                   " sentry_key=%s,"
-                                                                                  " sentry_secret=%s", 
+                                                                                  " sentry_secret=%s",
                                                                                   RAVEN_VERSION, RAVEN_UA,
                                                                                   timestamp, globals.key, globals.secret);
 
@@ -167,7 +167,7 @@ static switch_status_t raven_capture(const char *userdata, const char *message,
         switch_curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, strlen(encoded_body));
 
                switch_curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, RAVEN_UA);
-       
+
                list = switch_curl_slist_append(list, auth_header);
                list = switch_curl_slist_append(list, "Content-Type: application/octet-stream");
                switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, list);
@@ -204,7 +204,7 @@ static switch_status_t mod_raven_logger(const switch_log_node_t *node, switch_lo
 
        if (level != SWITCH_LOG_CONSOLE && !zstr(node->data)) {
                const char * raven_level;
-               
+
                switch (level) {
                case SWITCH_LOG_DEBUG:
                        raven_level = "debug";
@@ -230,7 +230,7 @@ static switch_status_t mod_raven_logger(const switch_log_node_t *node, switch_lo
 
                status = raven_capture(node->userdata, node->data, raven_level, node->file, node->func, node->line);
        }
-       
+
        return status;
 }
 
@@ -245,7 +245,7 @@ static switch_status_t load_config(void)
        if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
                return SWITCH_STATUS_FALSE;
-       } 
+       }
 
        if ((settings = switch_xml_child(cfg, "settings"))) {
                for (param = switch_xml_child(settings, "param"); param; param = param->next) {
index 08d2c0af48647d10b6e780c4915333f150beccc2..6f9f3b844887f7058bfd4cf693bea9d241a01b29 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2010, James Martelletti <james@nerdc0re.com>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * James Martelletti <james@nerdc0re.com>
  *
  *
index 09ba7f77e34aff7c82b9cdf86af5ae43a43ac3a7..55f65c3241da58c1ec84f47e51327ed3cf41c9f4 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * Daniel Swarbrick <daniel.swarbrick@gmail.com>
@@ -102,14 +102,14 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
                                        say_file("digits/1_n.wav");
                                } else {
                                        say_file("digits/%d.wav", c);
-                               } 
+                               }
                                say_file("currency/and.wav");
                        }
                        if (method == SSM_COUNTED) {
                                if ( gender == SSG_MASCULINE ) {
-                                       say_file("digits/h-%d0_m.wav", b);                              
+                                       say_file("digits/h-%d0_m.wav", b);
                                } else if  ( gender == SSG_NEUTER ) {
-                                       say_file("digits/h-%d0_n.wav", b);                              
+                                       say_file("digits/h-%d0_n.wav", b);
                                } else {
                                        say_file("digits/h-%d0.wav", b);
                                }
@@ -119,9 +119,9 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
                } else {
                        if (method == SSM_COUNTED) {
                                if ( gender == SSG_MASCULINE ) {
-                                       say_file("digits/h-%d%d_m.wav", b,c);                           
+                                       say_file("digits/h-%d%d_m.wav", b,c);
                                } else if  ( gender == SSG_NEUTER ) {
-                                       say_file("digits/h-%d%d_n.wav", b,c);                           
+                                       say_file("digits/h-%d%d_n.wav", b,c);
                                } else {
                                        say_file("digits/h-%d%d.wav", b,c);
                                }
@@ -135,16 +135,16 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
        if (c) {
                if (method == SSM_COUNTED) {
                        if ( gender == SSG_MASCULINE ) {
-                               say_file("digits/h-%d_m.wav", c);                               
+                               say_file("digits/h-%d_m.wav", c);
                        } else if  ( gender == SSG_NEUTER ) {
-                               say_file("digits/h-%d_n.wav", c);                               
+                               say_file("digits/h-%d_n.wav", c);
                        } else {
                                say_file("digits/h-%d.wav", c);
                        }
                } else {
                        /*"one" used as an article is feminine or masculine in german, e.g. voicemail-message is feminine
                        only applies to the likes of 1, 101, 1001 etc.*/
-                       if ( b == 0  && c == 1 && gender == SSG_FEMININE ) {        
+                       if ( b == 0  && c == 1 && gender == SSG_FEMININE ) {
                                say_file("digits/1_f.wav");
                        } else if ( b == 0 && c == 1 && what ) {
                                say_file("digits/1_n.wav");
@@ -393,7 +393,7 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay,
        if (say_dow) {
                say_file("time/day-%d.wav", tm.tm_wday);
        }
-    
+
     if (say_month) {
         say_file("time/mon-%d.wav", tm.tm_mon);
     }
@@ -426,7 +426,7 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay,
             }
 
             say_file("time/oclock.wav");
+
             if (tm.tm_min < 10) {
                 say_file("digits/0.wav");
                 say_num(tm.tm_min, SSM_PRONOUNCED);
@@ -470,7 +470,7 @@ static switch_status_t de_say_money(switch_core_session_t *session, char *tosay,
                dollars++;
        }
 
+
        /* Say dollar amount */
        if (atoi(dollars) == 1) {
                say_file("digits/1_n.wav");
index e3c9bdd6526a36307b56bb1e65245010fc48501b..63a9388c369491650837d73c43eafd2408a23a44 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  *
@@ -140,7 +140,7 @@ static switch_status_t en_say_general_count(switch_say_file_handle_t *sh, char *
                                in -= places[(uint32_t) x] * num;
                        }
                }
-               
+
 
                switch (say_args->method) {
                case SSM_PRONOUNCED_YEAR:
@@ -190,7 +190,7 @@ static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, sw
        uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
        const char *tz = NULL;
 
-       tz = switch_say_file_handle_get_variable(sh, "timezone");               
+       tz = switch_say_file_handle_get_variable(sh, "timezone");
 
        
        if (say_args->type == SST_TIME_MEASUREMENT) {
@@ -319,8 +319,8 @@ static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, sw
        case SST_SHORT_DATE_TIME:
                say_time = 1;
                //Time is in the future
-               if ((tm.tm_year > tm_now.tm_year) || 
-                   (tm.tm_year == tm_now.tm_year && tm.tm_mon > tm_now.tm_mon) || 
+               if ((tm.tm_year > tm_now.tm_year) ||
+                   (tm.tm_year == tm_now.tm_year && tm.tm_mon > tm_now.tm_mon) ||
                    (tm.tm_year == tm_now.tm_year && tm.tm_mon == tm_now.tm_mon && tm.tm_mday > tm_now.tm_mday))
                {
                        say_date = 1;
@@ -504,11 +504,11 @@ static switch_status_t en_say_money(switch_say_file_handle_t *sh, char *tosay, s
 static switch_status_t say_ip(switch_say_file_handle_t *sh,
                                                          char *tosay,
                                                          switch_say_args_t *say_args)
-       
+
 {
        char *a, *b, *c, *d;
        switch_status_t status = SWITCH_STATUS_FALSE;
-       
+
        if (!(a = strdup(tosay))) {
                abort();
        }
@@ -540,7 +540,7 @@ static switch_status_t say_ip(switch_say_file_handle_t *sh,
        say_num(sh, atoi(d), say_args->method);
 
  end:
-       
+
        free(a);
 
        return status;
@@ -636,14 +636,14 @@ static switch_status_t run_callback(switch_new_say_callback_t say_cb, char *tosa
        switch_say_file_handle_t *sh;
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_event_t *var_event = NULL;
-       
+
        if (session) {
                switch_channel_t *channel = switch_core_session_get_channel(session);
                switch_channel_get_variables(channel, &var_event);
        }
 
        switch_say_file_handle_create(&sh, say_args->ext, &var_event);
-       
+
        status = say_cb(sh, tosay, say_args);
 
        if ((*rstr = switch_say_file_handle_detach_path(sh))) {
@@ -671,7 +671,7 @@ static switch_status_t en_say(switch_core_session_t *session, char *tosay, switc
                if (session && string) {
                        status = switch_ivr_play_file(session, NULL, string, args);
                }
-               
+
                switch_safe_free(string);
        }
 
@@ -709,7 +709,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load)
        say_interface->interface_name = "en";
        say_interface->say_function = en_say;
        say_interface->say_string_function = en_say_string;
-       
+
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
index f648a72956f2537e6d438945e87cdbbafb519eb6..1232d190dc60334220f5ba0075f86142bc3475c0 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * François Delawarde <fdelawarde@wirelessmundi.com>
index f2dcb9cdb9f1e8aae7001ba6ac18dbb14d73cd39..390d69d6bccab52dd254821b1561f7215acf6bfe 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * François Delawarde <fdelawarde@wirelessmundi.com>
@@ -174,7 +174,7 @@ static switch_status_t es_say_general_count(switch_say_file_handle_t *sh, char *
                                in -= places[(uint32_t) x] * num;
                        }
                }
-               
+
 
                switch (say_args->method) {
                case SSM_PRONOUNCED_YEAR:
@@ -224,7 +224,7 @@ static switch_status_t es_say_time(switch_say_file_handle_t *sh, char *tosay, sw
        uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
        const char *tz = NULL;
 
-       tz = switch_say_file_handle_get_variable(sh, "timezone");               
+       tz = switch_say_file_handle_get_variable(sh, "timezone");
 
        if (say_args->type == SST_TIME_MEASUREMENT) {
                int64_t hours = 0;
@@ -341,8 +341,8 @@ static switch_status_t es_say_time(switch_say_file_handle_t *sh, char *tosay, sw
        case SST_SHORT_DATE_TIME:
                say_time = 1;
                //Time is in the future
-               if ((tm.tm_year > tm_now.tm_year) || 
-                   (tm.tm_year == tm_now.tm_year && tm.tm_mon > tm_now.tm_mon) || 
+               if ((tm.tm_year > tm_now.tm_year) ||
+                   (tm.tm_year == tm_now.tm_year && tm.tm_mon > tm_now.tm_mon) ||
                    (tm.tm_year == tm_now.tm_year && tm.tm_mon == tm_now.tm_mon && tm.tm_mday > tm_now.tm_mday))
                {
                        say_date = 1;
@@ -496,11 +496,11 @@ static switch_status_t es_say_money(switch_say_file_handle_t *sh, char *tosay, s
 static switch_status_t say_ip(switch_say_file_handle_t *sh,
                                                          char *tosay,
                                                          switch_say_args_t *say_args)
-       
+
 {
        char *a, *b, *c, *d;
        switch_status_t status = SWITCH_STATUS_FALSE;
-       
+
        if (!(a = strdup(tosay))) {
                abort();
        }
@@ -532,7 +532,7 @@ static switch_status_t say_ip(switch_say_file_handle_t *sh,
        say_num(sh, atoi(d), say_args->method);
 
  end:
-       
+
        free(a);
 
        return status;
@@ -628,14 +628,14 @@ static switch_status_t run_callback(switch_new_say_callback_t say_cb, char *tosa
        switch_say_file_handle_t *sh;
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_event_t *var_event = NULL;
-       
+
        if (session) {
                switch_channel_t *channel = switch_core_session_get_channel(session);
                switch_channel_get_variables(channel, &var_event);
        }
 
        switch_say_file_handle_create(&sh, say_args->ext, &var_event);
-       
+
        status = say_cb(sh, tosay, say_args);
 
        if ((*rstr = switch_say_file_handle_detach_path(sh))) {
@@ -663,7 +663,7 @@ static switch_status_t es_say(switch_core_session_t *session, char *tosay, switc
                if (session && string) {
                        status = switch_ivr_play_file(session, NULL, string, args);
                }
-               
+
                switch_safe_free(string);
        }
 
@@ -701,7 +701,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_say_es_ar_load)
        say_interface->interface_name = "es_ar";
        say_interface->say_function = es_say;
        say_interface->say_string_function = es_say_string;
-       
+
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
index 24716fd2e6812eec9cb622f44bf52a389991c7a3..536d4f10d319e8d86a4a509a34c7c0d833ea2aa0 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Mahdi Moradi <m.moradi@sepanta.net>
  * Babak Yakhchali <b.yakhchali@sepanta.net>
@@ -582,13 +582,13 @@ void gregorian_to_jalali(int *j_y, int *j_m, int *j_d,
    int jy, jm, jd;
    long g_day_no, j_day_no;
    int j_np;
+
    int i;
 
    gy = g_y-1600;
    gm = g_m-1;
    gd = g_d-1;
+
    g_day_no = 365*gy+(gy+3)/4-(gy+99)/100+(gy+399)/400;
    for (i=0;i<gm;++i)
       g_day_no += g_days_in_month[i];
@@ -596,20 +596,20 @@ void gregorian_to_jalali(int *j_y, int *j_m, int *j_d,
       /* leap and after Feb */
       ++g_day_no;
    g_day_no += gd;
+
    j_day_no = g_day_no-79;
+
    j_np = j_day_no / 12053;
    j_day_no %= 12053;
+
    jy = 979+33*j_np+4*(j_day_no/1461);
    j_day_no %= 1461;
+
    if (j_day_no >= 366) {
       jy += (j_day_no-1)/365;
       j_day_no = (j_day_no-1)%365;
    }
+
    for (i = 0; i < 11 && j_day_no >= j_days_in_month[i]; ++i) {
       j_day_no -= j_days_in_month[i];
    }
@@ -651,7 +651,7 @@ void jalali_to_gregorian(int *g_y, int *g_m, int *g_d,
       g_day_no--;
       gy += 100*(g_day_no/36524); /* 36524 = 365*100 + 100/4 - 100/100 */
       g_day_no = g_day_no % 36524;
-      
+
       if (g_day_no >= 365)
          g_day_no++;
       else
index e795f674c9fabf7721910812c8aa3b57c9946dbc..f4bbbd5680015f62c44a43e98e669b664a4bff8d 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * Marc O. Chouinard <mochouinard@moctel.com>
@@ -85,7 +85,7 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
        int ftdNumber = 0;
        int itd = (b * 10) + c;
 
-       /* Force full 2 digit playback */ 
+       /* Force full 2 digit playback */
        if (itd <= 19)
                ftdNumber = 1;
        switch (itd) {
@@ -120,7 +120,7 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
                int fVal = c;
                if (ftdNumber == 1)
                        fVal = itd;
-                       
+
                if (method == SSM_COUNTED) {
                        say_file("digits/h-%d.wav", fVal);
                } else {
index e7506b3a0ca4a976e04e06c7377bf1e436942ecf..27f9f2d70f3ef0598606a3a48350873944c2bf35 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2011-2012, Shahar Hadas
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -40,7 +40,7 @@
  * the Initial Developers. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * mod_say_he.c -- Say for Hebrew
  *
  */
@@ -80,7 +80,7 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
 
        /* Check for special cases of thousands */
        if (range == PGR_THOUSANDS && a == 0) {
-               /* Check for special cases of 1000, 2000 ... 8000, 9000 */      
+               /* Check for special cases of 1000, 2000 ... 8000, 9000 */
                if (b == 0 && c != 0) {
                        switch_say_file(sh, "digits/%d000", c);
                        return SWITCH_STATUS_SUCCESS;
@@ -90,16 +90,16 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
                if (b == 1 && c == 0) {
                        switch_say_file(sh, "digits/10000");
                        return SWITCH_STATUS_SUCCESS;
-               }               
+               }
        }
-       
+
        /* Check for special case of million */
        if (range == PGR_MILLIONS && a == 0 && b == 0 && c == 1) {
                switch_say_file(sh, "digits/million");
-               return SWITCH_STATUS_SUCCESS;           
+               return SWITCH_STATUS_SUCCESS;
        }
 
-       /* Check for Hebrew SSM_COUNTED special case. Anything above 10 needs to said differently */            
+       /* Check for Hebrew SSM_COUNTED special case. Anything above 10 needs to said differently */
        if (method == SSM_COUNTED && range == PGR_HUNDREDS && total <= 10) {
                if (b) {
                        switch_say_file(sh, "digits/h-10%s", gender == SSG_MASCULINE ? "_m" : "");
@@ -111,7 +111,7 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
 
        /* In Hebrew, hundreds can be said as "<number> hundreds", but the more correct
         * form of pronunciation required it to be recorded separately.
-        * Note that hundreds are always pronounced in SSG_FEMININE form in hebrew, and were recorded as such. 
+        * Note that hundreds are always pronounced in SSG_FEMININE form in hebrew, and were recorded as such.
         */
        if (a) {
                switch_say_file(sh, "digits/%d00", a);
@@ -129,26 +129,26 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
                                        case 5:
                                                switch_say_file(sh, "digits/va");
                                                break;
-                                               
+
                                        case 2:
                                        case 3:
                                        case 8:
-                                       case 9:                                 
+                                       case 9:
                                                switch_say_file(sh, "digits/uu");
-                                               break;                                  
+                                               break;
 
                                        case 1:
                                        case 4:
                                        case 6:
-                                       case 7:                                 
+                                       case 7:
                                                switch_say_file(sh, "digits/ve");
-                                               break;                  
-                                       
+                                               break;
+
                                        default:
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "play_group unkonwn digit (%d) Error! (SSG_MASCULINE)\n", c);
-                                               break;                  
-                                       }                                       
-                               }                               
+                                               break;
+                                       }
+                               }
                                switch_say_file(sh, "digits/%d%d_m", b, c);
                        } else {
                                if ((range == PGR_MILLIONS && a) || (range != PGR_MILLIONS && total > 9)){ /* Check if need to say "and" */
@@ -157,23 +157,23 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
                                        case 3:
                                        case 7:
                                        case 8:
-                                       case 9:                                 
+                                       case 9:
                                                switch_say_file(sh, "digits/uu");
-                                               break;                                  
-                                       
+                                               break;
+
                                        case 0:
                                        case 1:
                                        case 4:
                                        case 5:
-                                       case 6:                                                                                                                 
+                                       case 6:
                                                switch_say_file(sh, "digits/ve");
-                                               break;                  
+                                               break;
 
                                        default:
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "play_group unkonwn digit (%d) Error! (SSG_FEMININE)\n", c);
-                                               break;                                                                  
-                                       }                               
-                               }                                                               
+                                               break;
+                                       }
+                               }
                                switch_say_file(sh, "digits/%d%d", b, c);
                        }
                        c = 0;  /* Skip the pronunciation on the c value */
@@ -187,26 +187,26 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
                                case 5:
                                        switch_say_file(sh, "digits/va");
                                        break;
-                                                                                       
+
                                case 2:
-                               case 3:                                 
-                               case 8:                                 
+                               case 3:
+                               case 8:
                                        switch_say_file(sh, "digits/uu");
                                        break;
-                                                                               
+
                                case 1:
                                case 4:
                                case 6:
                                case 7:
-                               case 9:                                                                                                                                                         
+                               case 9:
                                        switch_say_file(sh, "digits/ve");
                                        break;
-                                                                                                                       
+
                                default:
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "play_group unkonwn digit (%d) Error! (SSG_MASCULINE)\n", c);
-                                       break;                  
-                               }                                       
-                       }                               
+                                       break;
+                               }
+                       }
                        switch_say_file(sh, "digits/%d_m", c);
                } else {
                        if ((range == PGR_MILLIONS && (b || a)) || (range != PGR_MILLIONS && total > 9)){ /* Check if need to say "and" */
@@ -215,24 +215,24 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
                                case 8:
                                        switch_say_file(sh, "digits/uu");
                                        break;
-                                                                                                                       
+
                                case 1:
-                               case 3:                         
+                               case 3:
                                case 4:
                                case 5:
                                case 6:
                                case 7:
-                               case 9:                                                                                                                                                                                                 
+                               case 9:
                                        switch_say_file(sh, "digits/ve");
                                        break;
-                                                                                                               
+
                                default:
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "play_group unkonwn digit (%d) Error! (SSG_FEMININE)\n", c);
-                                       break;                                                                  
-                               }                               
-                       }                                                               
+                                       break;
+                               }
+                       }
                        switch_say_file(sh, "digits/%d", c);
-               }                                                                                                        
+               }
        }
 
        if (what && (a || b || c)) {
@@ -290,7 +290,7 @@ static switch_status_t he_say_general_count(switch_say_file_handle_t *sh, char *
                switch (say_args->method) {
                case SSM_COUNTED:
                        /* TODO add 'ha' (the)? */
-               case SSM_PRONOUNCED:            
+               case SSM_PRONOUNCED:
                        if ((status = play_group(SSM_PRONOUNCED, say_args->gender, inCopy, PGR_MILLIONS, places[8], places[7], places[6], "digits/million", sh)) != SWITCH_STATUS_SUCCESS) {
                                return status;
                        }
@@ -319,7 +319,7 @@ static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, sw
        uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
        const char *tz = NULL;
 
-       tz = switch_say_file_handle_get_variable(sh, "timezone");               
+       tz = switch_say_file_handle_get_variable(sh, "timezone");
 
        if (say_args->type == SST_TIME_MEASUREMENT) {
                int64_t hours = 0;
@@ -363,7 +363,7 @@ static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, sw
 
                say_args->gender = SSG_FEMININE;
 
-               if (hours) {                                            
+               if (hours) {
                        switch_say_file(sh, "time/hour");
                        say_num(sh, hours, SSM_PRONOUNCED);
                } else {
@@ -384,7 +384,7 @@ static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, sw
                        switch_say_file(sh, "time/minutes");
                }
 
-               if (seconds) {                  
+               if (seconds) {
                        if (seconds == 1) {
                                switch_say_file(sh, "time/second");
                                say_num(sh, seconds, SSM_PRONOUNCED);
@@ -410,7 +410,7 @@ static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, sw
 
        if (tz) {
                int check = atoi(tz);
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz);              
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz);
                if (check) {
                        switch_time_exp_tz(&tm, target, check);
                        switch_time_exp_tz(&tm_now, target_now, check);
@@ -482,7 +482,7 @@ static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, sw
        if (say_day) {
                say_args->gender = SSG_MASCULINE;
                say_num(sh, tm.tm_mday, SSM_PRONOUNCED);
-       }       
+       }
        if (say_month) {
                switch_say_file(sh, "time/at");
                switch_say_file(sh, "time/mon-%d", tm.tm_mon);
@@ -515,7 +515,7 @@ static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, sw
                say_args->gender = SSG_FEMININE;
                say_num(sh, hour, SSM_PRONOUNCED);
 
-               if (tm.tm_min) {                
+               if (tm.tm_min) {
                        switch (tm.tm_min) {
                        case 2:
                        case 8:
@@ -527,14 +527,14 @@ static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, sw
                        case 30:
                                switch_say_file(sh, "digits/uu");
                                break;
-                                                                       
+
                        case 50:
                                switch_say_file(sh, "digits/va");
                                break;
-                                                                                                                                       
+
                        default:
                                switch_say_file(sh, "digits/ve");
-                               break;                                                                  
+                               break;
                        }
 
                        if (tm.tm_min == 1) {
@@ -542,10 +542,10 @@ static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, sw
                                switch_say_file(sh, "digits/1");
                        } else {
                                say_num(sh, tm.tm_min, SSM_PRONOUNCED);
-                               switch_say_file(sh, "time/minutes");                            
-                       }                                                       
+                               switch_say_file(sh, "time/minutes");
+                       }
                }
-               
+
                switch_say_file(sh, "time/%s", pm ? "p-m" : "a-m");
        }
 
@@ -554,7 +554,7 @@ static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, sw
 
 
 static switch_status_t he_say_money(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args)
-{      
+{
        char sbuf[16] = "";                     /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
        char *currency = NULL;
        char *cents = NULL;
@@ -566,7 +566,7 @@ static switch_status_t he_say_money(switch_say_file_handle_t *sh, char *tosay, s
        }
 
        currency = sbuf;
-       
+
        if ((cents = strchr(sbuf, '.'))) {
                *cents++ = '\0';
                if (strlen(cents) > 2) {
@@ -585,31 +585,31 @@ static switch_status_t he_say_money(switch_say_file_handle_t *sh, char *tosay, s
                ++currency;
        }
 
-       /* Say shekel amount (Israel currency) */       
+       /* Say shekel amount (Israel currency) */
        switch (atoi(currency)) {
        case 1:
                switch_say_file(sh, "currency/shekel");
                switch_say_file(sh, "digits/1_m");
                break;
-               
+
        case 2:
                /* In the case of 2, because currency, we need a special case of 2 pronunciation */
-               switch_say_file(sh, "digits/shney");            
+               switch_say_file(sh, "digits/shney");
                switch_say_file(sh, "currency/shkalim");
                break;
-               
+
        default:
                say_args->gender = SSG_MASCULINE;
                he_say_general_count(sh, currency, say_args);
                switch_say_file(sh, "currency/shkalim");
-               break;          
+               break;
        }
 
-       if (cents) {            
+       if (cents) {
                /* We need to use the value twice, so speed it up by atoi only once */
                icents = atoi(cents);
-               
-               /* Say "and" */ 
+
+               /* Say "and" */
                switch (icents) {
                case 2:
                case 8:
@@ -621,40 +621,40 @@ static switch_status_t he_say_money(switch_say_file_handle_t *sh, char *tosay, s
                case 30:
                case 80:
                        switch_say_file(sh, "digits/uu");
-                       break;  
-                                                       
+                       break;
+
                case 50:
                        switch_say_file(sh, "digits/va");
                        break;
-                                                                                                               
+
                default:
                        switch_say_file(sh, "digits/ve");
-                       break;                                                                  
-               }       
-       
+                       break;
+               }
+
                /* Say agorot (Israel currency equivalent for "cents") */
                switch (icents) {
                case 0:
                        switch_say_file(sh, "digits/0");
                        switch_say_file(sh, "currency/agorot");
                        break;
-                                       
+
                case 1:
                        switch_say_file(sh, "currency/agora");
                        switch_say_file(sh, "digits/1");
                        break;
-                       
+
                case 2:
                        /* In the case of 2, because currency, we need a special case of 2 pronunciation */
-                       switch_say_file(sh, "digits/shtey");            
+                       switch_say_file(sh, "digits/shtey");
                        switch_say_file(sh, "currency/agorot");
                        break;
-                       
+
                default:
                        say_args->gender = SSG_FEMININE;
                        he_say_general_count(sh, cents, say_args);
                        switch_say_file(sh, "currency/agorot");
-                       break;          
+                       break;
                }
        }
 
@@ -664,11 +664,11 @@ static switch_status_t he_say_money(switch_say_file_handle_t *sh, char *tosay, s
 static switch_status_t say_ip(switch_say_file_handle_t *sh,
                                                          char *tosay,
                                                          switch_say_args_t *say_args)
-       
+
 {
        char *a, *b, *c, *d;
        switch_status_t status = SWITCH_STATUS_FALSE;
-       
+
        if (!(a = strdup(tosay))) {
                abort();
        }
@@ -700,7 +700,7 @@ static switch_status_t say_ip(switch_say_file_handle_t *sh,
        say_num(sh, atoi(d), say_args->method);
 
  end:
-       
+
        free(a);
 
        return status;
@@ -772,14 +772,14 @@ static switch_status_t run_callback(switch_new_say_callback_t say_cb, char *tosa
        switch_say_file_handle_t *sh;
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_event_t *var_event = NULL;
-       
+
        if (session) {
                switch_channel_t *channel = switch_core_session_get_channel(session);
                switch_channel_get_variables(channel, &var_event);
        }
 
        switch_say_file_handle_create(&sh, say_args->ext, &var_event);
-       
+
        status = say_cb(sh, tosay, say_args);
 
        if ((*rstr = switch_say_file_handle_detach_path(sh))) {
@@ -808,7 +808,7 @@ static switch_status_t he_say(switch_core_session_t *session, char *tosay, switc
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "** he_say [%s]\n", string);
                        status = switch_ivr_play_file(session, NULL, string, args);
                }
-               
+
                switch_safe_free(string);
        }
 
index b620eda86035325ca6726396f0dd785daddb330c..5f5b9a99a44bf3b5645b0898da064f1fa0807671 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
- * Tihomir Culjaga <tculjaga@gmail.com> 
+ * Tihomir Culjaga <tculjaga@gmail.com>
  *
  * mod_say_hr.c -- Say for Croatian
  *
@@ -225,13 +225,13 @@ static switch_status_t hr_say_count(switch_core_session_t *session, char* gen,
        char tisucu[64] = "";
        char tgen[8] = "";
        char mgen[8] = "";
-       
-       
+
+
        int number;
        switch_status_t status;
 
        strcpy(tgen, gen);
-       
+
        if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
                return SWITCH_STATUS_GENERR;
@@ -256,8 +256,8 @@ static switch_status_t hr_say_count(switch_core_session_t *session, char* gen,
                                        strcpy(milion, "digits/milijun.wav");
                                else
                                        strcpy(milion, "digits/milijuna.wav");
-                               
-                               if (places[4] == 1)     
+
+                               if (places[4] == 1)
                                {
                                        strcpy(tisucu, "digits/thousands-a.wav");
                                }
@@ -269,7 +269,7 @@ static switch_status_t hr_say_count(switch_core_session_t *session, char* gen,
                                                        strcpy(tisucu, "digits/thousands-a.wav");
                                                        strcpy(tgen, "a");
                                                        break;
-                                                       
+
                                                case 5:
                                                case 6:
                                                case 7:
@@ -277,12 +277,12 @@ static switch_status_t hr_say_count(switch_core_session_t *session, char* gen,
                                                case 9:
                                                        strcpy(tisucu, "digits/thousands-a.wav");
                                                        break;
-                                                       
+
                                                case 2:
                                                        strcpy(tgen, "je");
                                                        strcpy(tisucu, "digits/thousands-e.wav");
                                                        break;
-                                                       
+
                                                case 3:
                                                case 4:
                                                        strcpy(tisucu, "digits/thousands-e.wav");
@@ -297,7 +297,7 @@ static switch_status_t hr_say_count(switch_core_session_t *session, char* gen,
                                                        strcpy(tisucu, "digits/thousands-a.wav");
                                                        strcpy(tgen, "a");
                                                        break;
-                                                       
+
                                                case 5:
                                                case 6:
                                                case 7:
@@ -305,12 +305,12 @@ static switch_status_t hr_say_count(switch_core_session_t *session, char* gen,
                                                case 9:
                                                        strcpy(tisucu, "digits/thousands-a.wav");
                                                        break;
-                                                       
+
                                                case 2:
                                                        strcpy(tisucu, "digits/thousands-e.wav");
                                                        strcpy(tgen, "je");
                                                        break;
-                                                       
+
                                                case 3:
                                                case 4:
                                                        strcpy(tisucu, "digits/thousands-e.wav");
@@ -318,7 +318,7 @@ static switch_status_t hr_say_count(switch_core_session_t *session, char* gen,
                                        }
                                }
 
-                               
+
                                if ((status =
                                         play_group(SSM_PRONOUNCED, mgen, places[8], places[7], places[6], milion, number, session, args)) != SWITCH_STATUS_SUCCESS) {
                                        return status;
@@ -462,7 +462,7 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
        uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
        switch_channel_t *channel = switch_core_session_get_channel(session);
        const char *tz = switch_channel_get_variable(channel, "timezone");
-       
+
        int sat_desetinka = 0;
        int sat_jedinica = 0;
        int minuta_desetinka = 0;
@@ -510,14 +510,14 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                }
 
                sat_jedinica = hours % 10;
-               
+
                if (hours > 10)
                        sat_desetinka = (int) (hours / 10);
-       
-               if (hours) 
+
+               if (hours)
                {
                        say_num(hours, SSM_PRONOUNCED, "");
-                       
+
                        if (sat_desetinka == 0 && sat_jedinica == 0)
                        {
                                nop;
@@ -533,13 +533,13 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                        case 1:
                                                say_file("time/sat.wav");
                                                break;
-                                               
+
                                        case 2:
                                        case 3:
                                        case 4:
                                                say_file("time/sata.wav");
                                                break;
-                                               
+
                                        case 0:
                                        case 5:
                                        case 6:
@@ -550,17 +550,17 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                break;
                                }
                        }
-               } 
+               }
 
                minuta_jedinica = minutes % 10;
-               
+
                if (minutes > 10)
                        minuta_desetinka = (int) (minutes / 10);
-                       
-               if (minutes) 
+
+               if (minutes)
                {
-                       
-                       
+
+
                        if (minuta_desetinka == 1)
                        {
                                say_num(minutes, SSM_PRONOUNCED, "");
@@ -574,18 +574,18 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                say_num(minutes, SSM_PRONOUNCED, "je");
                                                say_file("time/minute.wav");
                                                break;
-                                               
+
                                        case 3:
                                        case 4:
                                                say_num(minutes, SSM_PRONOUNCED, "");
                                                say_file("time/minute.wav");
                                                break;
-                                       
+
                                        case 1:
                                                        say_num(minutes, SSM_PRONOUNCED, "a");
                                                        say_file("time/minuta.wav");
                                                break;
-                                               
+
                                        case 0:
                                        case 5:
                                        case 6:
@@ -597,14 +597,14 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                break;
                                }
                        }
-               } 
+               }
 
                sekunda_jedinica = seconds % 10;
-               
+
                if (seconds > 10)
                        sekunda_desetinka = (int) (seconds / 10);
-                       
-               if (seconds) 
+
+               if (seconds)
                {
                        if (sekunda_desetinka == 1)
                        {
@@ -619,18 +619,18 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                say_num(seconds, SSM_PRONOUNCED, "a");
                                                say_file("time/sekunda.wav");
                                                break;
-                                               
+
                                        case 2:
                                                say_num(seconds, SSM_PRONOUNCED, "je");
                                                say_file("time/sekunde.wav");
                                                break;
-                                               
+
                                        case 3:
                                        case 4:
                                                say_num(seconds, SSM_PRONOUNCED, "");
                                                say_file("time/sekunde.wav");
                                                break;
-                                               
+
                                        case 0:
                                        case 5:
                                        case 6:
@@ -649,18 +649,18 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                say_num(seconds, SSM_PRONOUNCED, "a");
                                                say_file("time/sekunda.wav");
                                                break;
-                                               
+
                                        case 2:
                                                say_num(seconds, SSM_PRONOUNCED, "je");
                                                say_file("time/sekunde.wav");
                                                break;
-                                               
+
                                        case 3:
                                        case 4:
                                                say_num(seconds, SSM_PRONOUNCED, "");
                                                say_file("time/sekunde.wav");
                                                break;
-                                               
+
                                        case 0:
                                        case 5:
                                        case 6:
@@ -672,7 +672,7 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                break;
                                }
                        }
-               } 
+               }
 
                return SWITCH_STATUS_SUCCESS;
        }
@@ -758,15 +758,15 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
        if (say_day) {
                say_num(tm.tm_mday, SSM_COUNTED, "");
        }
-       
+
        if (say_month) {
                say_file("time/mon-%d.wav", tm.tm_mon);
        }
-       
+
        if (say_year) {
                int y = tm.tm_year + 1900;
                int tis = 0;
-               
+
                //say_num(tm.tm_year + 1900, SSM_PRONOUNCED, "");
                //1 - 99 => h-1a.wav - h-99a.wav
                if (y >= 1 && y <= 99)
@@ -795,7 +795,7 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                        say_file("digits/thousand-u.wav");
                        if (0 != (int) ((y - 1000) - ((y - 1000) % 100)))
                                say_file("digits/h-%da.wav", (int) ((y - 1000) - ((y - 1000) % 100)));
-                               
+
                        say_file("digits/h-%da.wav", (int) y % 100);
                }
                //2000  => 2je.wav + thousand-ta.wav
@@ -811,7 +811,7 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                        say_file("digits/thousands-e.wav");
                        if (0 != (int) ((y - 2000) - ((y - 2000) % 100)))
                                say_file("digits/h-%da.wav", (int) ((y - 2000) - ((y - 2000) % 100)));
-                               
+
                        say_file("digits/h-%da.wav", (int) y % 100);
                }
                // 3000 => [3-9].wav + thousand-ta.wav
@@ -828,25 +828,25 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                        tis = y  - (y % 1000);
                        if (0 != (int) ((y - tis) - ((y - tis) % 100)))
                                say_file("digits/h-%da.wav",  (int) ((y - tis) - ((y - tis) % 100)));
-                               
+
                        say_file("digits/h-%da.wav", (int) y % 100);
                }
-               
+
                //say_num(tm.tm_year + 1900, SSM_COUNTED, "a");
        }
 
-       
-       if (say_time) 
+
+       if (say_time)
        {
                say_num(tm.tm_hour, SSM_PRONOUNCED, "");
-               
+
                sat_jedinica = tm.tm_hour % 10;
-               
+
                if (tm.tm_hour >= 10)
                        sat_desetinka = (int) (tm.tm_hour / 10);
-                       
-       
-               if (tm.tm_hour) 
+
+
+               if (tm.tm_hour)
                {
                        if (sat_desetinka == 0 && sat_jedinica == 0)
                        {
@@ -863,13 +863,13 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                        case 1:
                                                say_file("time/sat.wav");
                                                break;
-                                               
+
                                        case 2:
                                        case 3:
                                        case 4:
                                                say_file("time/sata.wav");
                                                break;
-                                               
+
                                        case 0:
                                        case 5:
                                        case 6:
@@ -878,17 +878,17 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                        case 9:
                                                say_file("time/sati.wav");
                                                break;
-                                       
+
                                }
                        }
-               } 
-               
+               }
+
                minuta_jedinica = tm.tm_min % 10;
-               
+
                if (tm.tm_min >= 10)
                        minuta_desetinka = (int) (tm.tm_min / 10);
-                       
-               if (tm.tm_min) 
+
+               if (tm.tm_min)
                {
                        if (minuta_desetinka == 1)
                        {
@@ -903,18 +903,18 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                say_num(tm.tm_min, SSM_PRONOUNCED, "je");
                                                say_file("time/minute.wav");
                                                break;
-                                               
+
                                        case 3:
                                        case 4:
                                                say_num(tm.tm_min, SSM_PRONOUNCED, "");
                                                say_file("time/minute.wav");
                                                break;
-                                       
+
                                        case 1:
                                                say_num(tm.tm_min, SSM_PRONOUNCED, "a");
                                                say_file("time/minuta.wav");
                                                break;
-                                               
+
                                        case 0:
                                        case 5:
                                        case 6:
@@ -926,14 +926,14 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                break;
                                }
                        }
-               } 
-               
+               }
+
                sekunda_jedinica = tm.tm_sec % 10;
-               
+
                if (tm.tm_sec >= 10)
                        sekunda_desetinka = (int) (tm.tm_sec / 10);
-                       
-               if (tm.tm_sec) 
+
+               if (tm.tm_sec)
                {
                        if (sekunda_desetinka == 1)
                        {
@@ -948,18 +948,18 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                say_num(tm.tm_sec, SSM_PRONOUNCED, "a");
                                                say_file("time/sekunda.wav");
                                                break;
-                                               
+
                                        case 2:
                                                say_num(tm.tm_sec, SSM_PRONOUNCED, "je");
                                                say_file("time/sekunde.wav");
                                                break;
-                                               
+
                                        case 3:
                                        case 4:
                                                say_num(tm.tm_sec, SSM_PRONOUNCED, "");
                                                say_file("time/sekunde.wav");
                                                break;
-                                               
+
                                        case 0:
                                        case 5:
                                        case 6:
@@ -978,18 +978,18 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                say_num(tm.tm_sec, SSM_PRONOUNCED, "a");
                                                say_file("time/sekunda.wav");
                                                break;
-                                               
+
                                        case 2:
                                                say_num(tm.tm_sec, SSM_PRONOUNCED, "je");
                                                say_file("time/sekunde.wav");
                                                break;
-                                               
+
                                        case 3:
                                        case 4:
                                                say_num(tm.tm_sec, SSM_PRONOUNCED, "");
                                                say_file("time/sekunde.wav");
                                                break;
-                                               
+
                                        case 0:
                                        case 5:
                                        case 6:
@@ -1001,7 +1001,7 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay,
                                                break;
                                }
                        }
-               } 
+               }
        }
 
        return SWITCH_STATUS_SUCCESS;
@@ -1013,35 +1013,35 @@ static switch_status_t hr_say_money(switch_core_session_t *session, char *tosay,
        char sbuf[16] = "";
        char *kuna = NULL;
        char *lipa = NULL;
-       
+
        int zadnja_kuna = 0;
        int predzadnja_kuna = 0;
        int zadnja_lipa = 0;
        int predzadnja_lipa = 0;
 
-       if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) 
+       if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)))
        {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
                return SWITCH_STATUS_GENERR;
        }
 
        kuna = sbuf;
-       
-       if ((lipa = strchr(sbuf, '.'))) 
+
+       if ((lipa = strchr(sbuf, '.')))
        {
                *lipa++ = '\0';
-               if (strlen(lipa) > 2) 
+               if (strlen(lipa) > 2)
                {
                        lipa[2] = '\0';
                }
        }
 
-       if (sbuf[0] == '+') 
+       if (sbuf[0] == '+')
        {
                kuna++;
        }
 
-       if (sbuf[0] == '-') 
+       if (sbuf[0] == '-')
        {
                say_file("currency/negative.wav");
                kuna++;
@@ -1049,11 +1049,11 @@ static switch_status_t hr_say_money(switch_core_session_t *session, char *tosay,
 
        if (kuna != NULL && strlen(kuna) > 0)
                zadnja_kuna = (int) ((char) *(kuna + strlen(kuna) - 1) - '0');
-               
+
        if (kuna != NULL && strlen(kuna) > 1)
                predzadnja_kuna = (int) ((char) *(kuna + strlen(kuna) - 2) - '0');
-               
-               
+
+
        if (predzadnja_kuna == 1)
        {
                hr_say_count(session, "", kuna, say_args, args);
@@ -1068,7 +1068,7 @@ static switch_status_t hr_say_money(switch_core_session_t *session, char *tosay,
                                say_file("currency/kuna.wav");
                                break;
 
-                       case 0:                         
+                       case 0:
                        case 5:
                        case 6:
                        case 7:
@@ -1077,12 +1077,12 @@ static switch_status_t hr_say_money(switch_core_session_t *session, char *tosay,
                                hr_say_count(session, "", kuna, say_args, args);
                                say_file("currency/kuna.wav");
                                break;
-                               
+
                        case 2:
                                hr_say_count(session, "je", kuna, say_args, args);
                                say_file("currency/kune.wav");
                                break;
-                               
+
                        case 3:
                        case 4:
                                hr_say_count(session, "", kuna, say_args, args);
@@ -1090,26 +1090,26 @@ static switch_status_t hr_say_money(switch_core_session_t *session, char *tosay,
                                break;
                }
        }
-       
+
        if (lipa)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lipa:%s \n", lipa);
        else
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lipa: NULL \n");
-       
+
        if (lipa)
        {
                /* Say "and" */
                say_file("currency/and.wav");
-       
+
                if (lipa != NULL && strlen(lipa) > 0)
                        zadnja_lipa = (int) ((char) *(lipa + strlen(lipa) - 1) - '0');
-               
+
                if (lipa != NULL && strlen(lipa) > 1)
                        predzadnja_lipa = (int) ((char) *(lipa + strlen(lipa) - 2) - '0');
-               
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "zadnja_lipa:%d \n", zadnja_lipa);       
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "predzadnja_lipa:%d \n", predzadnja_lipa);       
-                       
+
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "zadnja_lipa:%d \n", zadnja_lipa);
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "predzadnja_lipa:%d \n", predzadnja_lipa);
+
                if (predzadnja_lipa == 1)
                {
                        hr_say_count(session, "", lipa, say_args, args);
@@ -1124,7 +1124,7 @@ static switch_status_t hr_say_money(switch_core_session_t *session, char *tosay,
                                        say_file("currency/lipa.wav");
                                        break;
 
-                               case 0:                                 
+                               case 0:
                                case 5:
                                case 6:
                                case 7:
@@ -1133,12 +1133,12 @@ static switch_status_t hr_say_money(switch_core_session_t *session, char *tosay,
                                        hr_say_count(session, "", lipa, say_args, args);
                                        say_file("currency/lipa.wav");
                                        break;
-                                       
+
                                case 2:
                                        hr_say_count(session, "je", lipa, say_args, args);
                                        say_file("currency/lipa.wav");
                                        break;
-                                       
+
                                case 3:
                                case 4:
                                        hr_say_count(session, "", lipa, say_args, args);
index 6a830c6a98ae5f4f52618f6a3b0e59517844aa5a..c35be1bc5993e02ed25aa3426dd754d1f119ffab 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  *
@@ -231,7 +231,7 @@ static switch_status_t hu_say_time(switch_core_session_t *session, char *tosay,
                if (hours) {
                        say_num(hours, SSM_PRONOUNCED);
                        say_file("time/hour.wav");
-               } 
+               }
                if (minutes) {
                        say_num(minutes, SSM_PRONOUNCED);
                        say_file("time/minute.wav");
index ae2782203d2ba3e582107399429e54d5b99abdc1..c94ea7990a7ac09579c6806781115a97a8487abb 100644 (file)
@@ -2,23 +2,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -37,7 +37,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  *
index f52b741830f24a5d70920075109b3612c8f087ef..90b55bb38a4c04d430d2987ecb875af4e35fc67f 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * Leo Noordergraaf <leo.noordergraaf@deanconnect.nl>
index f066f9d861891d3e51d3f496981dd5a384d41ba4..68546f9410ea64484178fb5de077f9429a592dfa 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * Mariusz Czułada <manieq.net@gmail.com>
@@ -473,11 +473,11 @@ static switch_status_t pl_say_money(switch_say_file_handle_t *sh, char *tosay, s
 static switch_status_t pl_say_ip(switch_say_file_handle_t *sh,
                                                          char *tosay,
                                                          switch_say_args_t *say_args)
-       
+
 {
        char *a, *b, *c, *d;
        switch_status_t status = SWITCH_STATUS_FALSE;
-       
+
        if (!(a = strdup(tosay))) {
                abort();
        }
@@ -509,7 +509,7 @@ static switch_status_t pl_say_ip(switch_say_file_handle_t *sh,
        say_num(sh, atoi(d), say_args->method, SSG_MASCULINE);
 
  end:
-       
+
        free(a);
 
        return status;
@@ -580,14 +580,14 @@ static switch_status_t run_callback(switch_new_say_callback_t say_cb, char *tosa
        switch_say_file_handle_t *sh;
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_event_t *var_event = NULL;
-       
+
        if (session) {
                switch_channel_t *channel = switch_core_session_get_channel(session);
                switch_channel_get_variables(channel, &var_event);
        }
 
        switch_say_file_handle_create(&sh, say_args->ext, &var_event);
-       
+
        status = say_cb(sh, tosay, say_args);
 
        if ((*rstr = switch_say_file_handle_detach_path(sh))) {
@@ -615,7 +615,7 @@ static switch_status_t pl_say(switch_core_session_t *session, char *tosay, switc
                if (session && string) {
                        status = switch_ivr_play_file(session, NULL, string, args);
                }
-               
+
                switch_safe_free(string);
        }
 
@@ -654,7 +654,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_say_pl_load)
        say_interface->interface_name = "pl";
        say_interface->say_function = pl_say;
        say_interface->say_string_function = pl_say_string;
-       
+
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
index a0b9d5b8634f6c1fa99d0b4d1458481191e64d32..651c6fff21c387f057ffb8c3ce7a1ad62c251b46 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * António Silva <asilva@wirelessmundi.com>
@@ -409,7 +409,7 @@ static switch_status_t pt_say_time(switch_core_session_t *session, char *tosay,
                if (tm.tm_min) {
                        say_file("currency/and.wav");
                        say_num(tm.tm_min, SSM_PRONOUNCED);
-               } else { 
+               } else {
                        say_file("time/oclock.wav");
                }
 
index ad88d0d146bfdb2f4b15868a3cb6221ce3d7dd01..b4759442721f35a04435f2b82fae065575fd0779 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * Boris Buklov (BBV) <buklov@mail.ru>
@@ -174,7 +174,7 @@ static switch_status_t ru_say_count(switch_say_file_handle_t *sh, char *tosay, s
                        }
                }
 
-               //миллионы      
+               //миллионы
                if (places[8] || places[7] || places[6]) {
                        if ((in_ % 1000000 > 0) && (matrix[cases][gender].all != 1)) {  // если поле миллионов  есть цифры поизнести как числительое именительного падежа
                                if ((status = play_group(male, nominativus, places[8], places[7], places[6], million, sh)) != SWITCH_STATUS_SUCCESS) {
@@ -188,7 +188,7 @@ static switch_status_t ru_say_count(switch_say_file_handle_t *sh, char *tosay, s
                                }
                        }
                }
-               //тысячи      
+               //тысячи
                if (places[5] || places[4] || places[3]) {
                        if ((in_ % 1000 > 0) && (matrix[cases][gender].all != 1)) {     // если поле миллионов  есть цифры поизнести как числительое именительного падежа
                                if ((status = play_group(male, nominativus, places[5], places[4], places[3], thousand, sh)) != SWITCH_STATUS_SUCCESS) {
@@ -313,8 +313,8 @@ static switch_status_t ru_say_money(switch_say_file_handle_t *sh, char *tosay, s
        else {
            switch_say_file(sh, "currency/%s",matrix_currency[say_opt->currency].first[5]);
        }
-           
-           
+
+
        /* Say kopecks */
        ru_say_count(sh, kopecks, matrix_currency[say_opt->currency].second_gender,matrix_currency[say_opt->currency].second_cases);
 
@@ -348,7 +348,7 @@ static switch_status_t ru_say_time(switch_say_file_handle_t *sh, char *tosay, sw
        switch_time_exp_t tm, tm_now;
        uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
        const char *tz = NULL;
-       tz = switch_say_file_handle_get_variable(sh, "timezone");    
+       tz = switch_say_file_handle_get_variable(sh, "timezone");
 
        //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s  type=%d method=%d\n", tosay, say_args->type, say_args->method);
 
@@ -603,7 +603,7 @@ static switch_new_say_callback_ru_t choose_callback(switch_say_args_t *say_args)
        case SST_ITEMS:
        case SST_PERSONS:
        case SST_MESSAGES:
-       
+
                say_cb = ru_say_general_count;
                break;
        case SST_TIME_MEASUREMENT:
@@ -640,7 +640,7 @@ static switch_new_say_callback_ru_t choose_callback(switch_say_args_t *say_args)
 }
 
 
-                                                                                                
+
 
 
 static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *tosay, switch_say_args_t *say_args, switch_core_session_t *session, char **rstr)
@@ -665,7 +665,7 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t
                 //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!!  %s  %s   %s !\n",gender, cases,currency);
                 if (cases) {
                    //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!!  %s!\n", cases);
-                
+
                    if ((strcmp(cases,"nominativus")==0) || (strcmp(cases,"именительный")==0)) {
                        say_opt.cases=(cases_t)0;
                    }
@@ -690,7 +690,7 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t
                }
                 if (gender) {
                    //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!!  %s!\n", gender);
-                
+
                    if ((strcmp(gender,"male")==0) || (strcmp(gender,"мужской")==0)) {
                        say_opt.gender=(say_gender_t)0;
                    }
@@ -715,15 +715,15 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t
                    if ((strcmp(gender,"plural_h")==0) || (strcmp(gender,"множественное_порядковый")==0)) {
                        say_opt.gender=(say_gender_t)7;
                    }
-            
+
                }
                 if (currency) {
                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!!  %s!\n", currency);
-                
+
                    if ((strcmp(currency,"ruble")==0) || (strcmp(currency,"рубль")==0)) {
                        say_opt.currency=(currency_t)0;
 //                     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "rul!!!  \n");
-                       
+
                    }
                    if ((strcmp(currency,"dollar")==0) || (strcmp(currency,"доллар")==0)) {
 //                     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "dollar!!!  !\n");
@@ -731,7 +731,7 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t
                    }
                }
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!!  %s!   say_opt.gender=%d   say_opt.cases=%d\n", tosay,say_opt.gender,say_opt.cases);
-                                                                                
+
        }
         switch_say_file_handle_create(&sh, say_args->ext, &var_event);
 //запуск ru_ip,ru_say_money ...
@@ -754,9 +754,9 @@ static switch_status_t ru_say(switch_core_session_t *session, char *tosay, switc
         switch_new_say_callback_ru_t say_cb = NULL;
         char *string = NULL;
         switch_status_t status;
-        
+
         status = SWITCH_STATUS_FALSE;
-        
+
         say_cb = choose_callback(say_args);
 
         if (say_cb) {
index 92ed89a1fba83405340bf89997ba6671f88e160b..e8ee02a356ad26de2c0bd460c30514b1d7a422b8 100644 (file)
@@ -12,7 +12,7 @@
 //http://ru.wiktionary.org/wiki/%D0%BE%D0%B4%D0%B8%D0%BD
 //http://ru.wiktionary.org/wiki/%D0%BF%D0%B5%D1%80%D0%B2%D1%8B%D0%B9
 
-                                                                                                                                                                                                                    
+
 
 typedef enum {
        million,
@@ -58,7 +58,7 @@ typedef enum {
 typedef struct {
        say_gender_t gender;
        cases_t    cases;
-       currency_t currency;        
+       currency_t currency;
 } say_opt_t;
 
 
@@ -75,7 +75,7 @@ struct say_cur_t {
        char *second[6];
        say_gender_t second_gender;
        cases_t second_cases;
-       
+
 };
 
 // описываем как произносить валяюты от 0 до 5 дальше идёт номер рода и падежа (с нуля)
@@ -94,7 +94,7 @@ struct say_cur_t {
 
 typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt);
 
-//именительный 
+//именительный
 //именительный количественный/числительное
 
 //мужской род родительный падеж
@@ -235,7 +235,7 @@ typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_
 
 
 
-//дательный    Кого? Что? 
+//дательный    Кого? Что?
 //количественный/числительное
 //мужской
 #define m_20 {\
@@ -301,7 +301,7 @@ typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_
 
 
 
-//Винительный  Кого? animate - одушевлённый 
+//Винительный  Кого? animate - одушевлённый
 //количественный/числительное
 //мужской
 #define m_30 {\
@@ -367,7 +367,7 @@ typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_
 
 
 
-//Винительный  Что?  inanimate - неодушевлённый 
+//Винительный  Что?  inanimate - неодушевлённый
 //количественный/числительное
 //мужской
 #define m_40 {\
@@ -433,7 +433,7 @@ typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_
 
 
 
-//Творительный Кем? Чем? 
+//Творительный Кем? Чем?
 //количественный/числительное
 //мужской
 #define m_50 {\
@@ -499,7 +499,7 @@ typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_
 
 
 
-//Предложный   О ком? О чём? 
+//Предложный   О ком? О чём?
 //количественный/числительное
 //мужской
 #define m_60 {\
@@ -565,7 +565,7 @@ typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_
 
 
 
-//именительный 
+//именительный
 //именительный количественный/числительное
 //мужской
 #define m_60 {\
index ebbe6875d4a6cd859557c4ed8979ef4cba47d956..b3fd2dcfebd61a2cb4bece859a7b8b209bb1ba66 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael B. Murdock <mike@mmurdock.org>
  * Daniel Swarbrick <daniel.swarbrick@gmail.com>
@@ -71,7 +71,7 @@ SWITCH_MODULE_DEFINITION(mod_say_sv, mod_say_sv_load, NULL, NULL);
 
 static switch_status_t play_group(switch_say_method_t method, switch_say_gender_t gender, int a, int b, int c, char *what, switch_say_file_handle_t *sh)
 {
-       /*swedish makes the distiction between utrum for "one" (en) and neutrum for "one" (ett), e.g. voicemail-message is neutrum but recording is utrum. 
+       /*swedish makes the distiction between utrum for "one" (en) and neutrum for "one" (ett), e.g. voicemail-message is neutrum but recording is utrum.
        This only applies to the likes of 1, 101, 1001 etc.
        files referenced below:
                SSM_COUNTED=r-%d
@@ -309,7 +309,7 @@ static switch_status_t sv_say_time(switch_say_file_handle_t *sh, char *tosay, sw
                        if (minutes == 0) {
                                switch_say_file(sh, "time/midnatt");
                        } else {
-                               switch_say_file(sh, "digits/0"); 
+                               switch_say_file(sh, "digits/0");
                                switch_say_file(sh, "time/timmar");
                        }
                }
index a78251a0249df634719ae34c81e7e79bf4c35a3a..18c40078dabcfa23d0dcb73f18615f271d96e46e 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * PeteDao <petekay@gmail.com>
  * Steve Underwood 0.0.1 <steveu@coppice.org>
  * Dome Charoenyost <dome@tel.co.th>
- * 
+ *
  *
  * mod_say_th.c -- Say for Thai
  *
index f84932dd5c90ccd55afc2b65c57c0185d2c4e8c4..590bea6927104a30de990f68fca37207258f365f 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2007-2014, Anthony Minessale II
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * PeteDao <petekay@gmail.com>
  * Steve Underwood 0.0.1 <steveu@coppice.org>
index 23e1a7e35b094456b60f7ab61edf04ffa42aabe8..75be01133d4c57b358d9762fca58c84e7d6922d9 100644 (file)
@@ -87,7 +87,7 @@ static struct {
        interval_timer_t interval_timers[MAX_INTERVAL + 1][TIMERS_PER_INTERVAL];
        /** Maps IDs to timers */
        interval_timer_t *active_interval_timers[MAX_ACTIVE_TIMERS];
-       /** Next timer to assign for a particular interval */ 
+       /** Next timer to assign for a particular interval */
        int next_interval_timer_num[MAX_INTERVAL + 1];
        /** Synchronizes access to timer creation / deletion */
        switch_mutex_t *interval_timers_mutex;
@@ -243,7 +243,7 @@ static switch_status_t interval_timer_stop(interval_timer_t *it)
  * Timer module interface: start a new timer
  * @param timer the timer
  * @return SWITCH_STATUS_SUCCESS if successful otherwise SWITCH_STATUS_GENERR
- */ 
+ */
 static switch_status_t mod_posix_timer_init(switch_timer_t *timer)
 {
        interval_timer_t *it;
@@ -405,7 +405,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_posix_timer_load)
                sigaddset(&sigmask, SIG);
                sigprocmask(SIG_BLOCK, &sigmask, NULL);
 
-               /* set up signal handler */     
+               /* set up signal handler */
                memset(&sa, 0, sizeof(sa));
                sa.sa_flags = SA_SIGINFO | SA_RESTART;
                sa.sa_sigaction = timer_signal_handler;
index 9dfff6c778b1c6125281243c841f89dd64503f17..29967f157664bc59d8b35a887a5db1bcbfb4d461 100644 (file)
@@ -28,7 +28,7 @@ int shutdown;
 
 
 /**
- * Return a random sample from a normal distrubtion centered at mean with 
+ * Return a random sample from a normal distrubtion centered at mean with
  * the specified standard deviation.
  *
  * THIS FUNCTION IS NOT REENTRANT!!!
@@ -72,7 +72,7 @@ static int sample(int *weights, int num_weights)
        return 0;
 }
 
-/* 
+/*
  * Calculate x - y
  * @return 0 if x is before y, the difference otherwise.
  */
@@ -91,7 +91,7 @@ double timespec_subtract(struct timespec *x, struct timespec *y)
                y->tv_nsec += 1000000000 * nsec;
                y->tv_sec -= nsec;
        }
-     
+
        /* Return 0 if result is negative. */
        if(x->tv_sec < y->tv_sec) {
                return 0.0f;
@@ -152,7 +152,7 @@ static void test_create_destroy()
        int interval_counts[4] = { 0, 0, 0, 0 };
        int toggle[2] = { 75, 100 };
        int timer_count = 0;
-       
+
        int i = 0;
        printf("test_create_destroy()\n");
        for(i = 0; i < 100000000; i++) {
@@ -257,7 +257,7 @@ void *session_thread(void *arg)
        /* stop the timer */
        timer_if->timer_destroy(&timer);
 
-       if (!shutdown) {        
+       if (!shutdown) {
                check_result(d);
        }
 
@@ -281,7 +281,7 @@ done:
                free(d);
                return NULL;
        }
-       
+
        /* return result */
        return d;
 }
@@ -345,7 +345,7 @@ static void test_timer_session(int *interval, int *interval_weights, int num_int
        int i = 0;
        struct timespec start, now, period;
        double elapsed = 0.0f;
-       
+
        printf("test_timer_session(%d, %f, %d, %d, %f, %f)\n", interval[0], test_duration, cps, max_sessions, duration_mean, duration_std_dev);
 
 
index 7305b8b237e94e85063da6802b70b714e26f0553..83a6b0003c94f5ebedcbc328146e609f7b6a024b 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef SWITCH_H
-#define SWITCH_H 
+#define SWITCH_H
 
 #include <pthread.h>
 #include <time.h>
index ac9b1f94d30fdfebe55c3b32f8c1a89cfcc89562..fa7841242e94cc6585687aaa4fff95b705f744ed 100644 (file)
@@ -22,7 +22,7 @@
     <!-- optional: if not present we do log the b leg -->
     <!-- true or false if we should create a cdr for the b leg of a call-->
     <param name="log-b-leg" value="false"/>
-    
+
     <!-- optional: if not present, all filenames are the uuid of the call -->
     <!-- true or false if a leg files are prefixed "a_" -->
     <param name="prefix-a-leg" value="true"/>
     <!-- encode the post data may be 'true' for url encoding, 'false' for no encoding, 'base64' for base64 encoding or 'textxml' for text/xml -->
     <param name="encode" value="true"/>
 
-    <!-- optional: set to true to disable Expect: 100-continue lighttpd requires this setting --> 
-    <!--<param name="disable-100-continue" value="true"/>--> 
-    
+    <!-- optional: set to true to disable Expect: 100-continue lighttpd requires this setting -->
+    <!--<param name="disable-100-continue" value="true"/>-->
+
     <!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->
     <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
     <!-- <param name="err-log-dir" value="/tmp"/> -->
 
     <!-- which auhtentification scheme to use. Supported values are: basic, digest, NTLM, GSS-NEGOTIATE or "any" for automatic detection -->
-    <!--<param name="auth-scheme" value="basic"/>--> 
+    <!--<param name="auth-scheme" value="basic"/>-->
 
     <!-- optional: this will enable the CA root certificate check by libcurl to
          verify that the certificate was issued by a major Certificate Authority.
index 1d14051036df91ed70a01121136cdbb22e197e06..563724d51757b03e7222c39be721b7549d87e773 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Brian West <brian@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Justin Cassidy <xachenant@hotmail.com>
@@ -79,7 +79,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_cdr_shutdown);
 SWITCH_MODULE_DEFINITION(mod_xml_cdr, mod_xml_cdr_load, mod_xml_cdr_shutdown, NULL);
 
-/* this function would have access to the HTML returned by the webserver, we don't need it 
+/* this function would have access to the HTML returned by the webserver, we don't need it
  * and the default curl activity is to print to stdout, something not as desirable
  * so we have a dummy function here
  */
@@ -347,7 +347,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                if (globals.ssl_cacert_file) {
                        switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file);
                }
-               
+
                if (globals.cookie_file) {
                        switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, globals.cookie_file);
                        switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, globals.cookie_file);
@@ -622,7 +622,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
                                globals.cookie_file = switch_core_strdup(globals.pool, val);
                        }
                }
-               
+
                if (zstr(globals.base_err_log_dir)) {
                        if (!zstr(globals.base_log_dir)) {
                                globals.base_err_log_dir = switch_core_strdup(globals.pool, globals.base_log_dir);
@@ -630,7 +630,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
                                globals.base_err_log_dir = switch_core_sprintf(globals.pool, "%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
                        }
                }
-               
+
        }
 
        if (globals.retries && globals.delay == 0) {
index af0a87dd965c87461b27f21bd70b787b820c1c19..dab29a550f88a7b9b2dbc65fcbd900af34ca81fb 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Justin Cassidy <xachenant@hotmail.com>
index 2de9a72158fd30e713d12d2d5fc0b216871bea87..1d5cb16531350d115483b0c93d4ed9835fdfc606 100644 (file)
@@ -27,7 +27,7 @@
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Justin Cassidy <xachenant@hotmail.com>
  * John Skopis <john+fs@skopis.com>
- * 
+ *
  * mod_xml_ldap.c -- LDAP XML Gateway
  *
  */
@@ -125,7 +125,7 @@ struct xml_ldap_attribute {
         char *val;
         xml_ldap_attribute_t *next;
 };
-        
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_ldap_shutdown);
 SWITCH_MODULE_DEFINITION(mod_xml_ldap, mod_xml_ldap_load, mod_xml_ldap_shutdown, NULL);
@@ -145,7 +145,7 @@ SWITCH_STANDARD_API(xml_ldap_function)
 {
         return SWITCH_STATUS_FALSE;
 }
-  
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load)
 {
         switch_api_interface_t *xml_ldap_api_interface;
@@ -495,13 +495,13 @@ static switch_status_t trydir(switch_xml_t *pxml, int *xoff, LDAP * ld, char *di
                    "vm-skip-instructions", "vm-cc", "vm-disk-quota", "accountcode", "user_context",
                    "vm_mailbox", "callgroup", "effective_caller_id_number", "effective_caller_id_name",
                    "outbound_caller_id_number", "outbound_caller_id_name", "toll_allow", NULL };
+
         basedn = switch_mprintf(binding->basedn, dir_domain);
         filter = switch_mprintf(binding->filter, dir_exten);
+
                if (param_event) {
                        char *expanded = switch_event_expand_headers(param_event, filter);
-                       
+
                        if (expanded != filter) {
                                free(filter);
                                filter = expanded;
@@ -509,7 +509,7 @@ static switch_status_t trydir(switch_xml_t *pxml, int *xoff, LDAP * ld, char *di
                }
 
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "searching in basedn %s with filter %s\n", basedn, filter);
+
         if ((ldap_search_s(ld, basedn, LDAP_SCOPE_SUB, filter, NULL, 0, &msg) != LDAP_SUCCESS))
                 goto cleanup;
 
@@ -614,15 +614,15 @@ static switch_status_t trysearch(switch_xml_t *pxml, int *xoff, LDAP * ld, char
 
                                 val = ldap_get_values(ld, entry, key);
                                 switch_xml_set_attr_d(xml, key, val[0]);
+
                                 ldap_memfree(key);
                                 ldap_value_free(val);
                        }
                         ber_free(ber, 0);
+
                         dn = ldap_get_dn(ld, entry);
                         rec(&xml, &off, ld, dn);
+
                         *xoff = 1;
                }
 
@@ -661,7 +661,7 @@ void rec(switch_xml_t *pxml, int *xoff, LDAP * ld, char *dn)
                         ldap_value_free(val);
 
                         for (key = ldap_first_attribute(ld, entry, &ber); key != NULL; key = ldap_next_attribute(ld, entry, ber)) {
+
                                 if (!strncasecmp("fstag", key, 5) || !strncasecmp("objectclass", key, 10)) {
                                         ldap_memfree(key);
                                         continue;
@@ -713,7 +713,7 @@ static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, c
                                 switch (binding->bt) {
                                 case XML_LDAP_CONFIG:
                                         break;
+
                                 case XML_LDAP_DIRECTORY:
                                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "from cb got %s=%s\n", hi->name, hi->value);
                                         if (!strncmp(hi->name, "user", strlen(hi->name))) {
@@ -722,7 +722,7 @@ static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, c
                                                 dir_domain = strdup(hi->value);
                                         }
                                         break;
+
                                 case XML_LDAP_DIALPLAN:
                                 case XML_LDAP_PHRASE:
                                         break;
index 8b8ceae9cd6c782d69da363238b6b9260318a4de..2e17abbfdd17a4206912e7871a839e3c3ca3e663 100644 (file)
@@ -8,7 +8,7 @@
 
   <extension name="rejections">
     <condition field="${radius_auth_result}" expression="^2$">
-      <action application="hangup" data="CALL_REJECTED"/>      
+      <action application="hangup" data="CALL_REJECTED"/>
     </condition>
   </extension>
 
index 99033fe7464008ee983934b24136626ea3680c57..f35966145fbc6f4fbb729f3157902c6b03807dab 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * William King <william.king@quentustech.com>
  *
  * mod_xml_radius.c -- Radius authentication and authorization
@@ -75,31 +75,31 @@ switch_status_t mod_xml_radius_new_handle(rc_handle **new_handle, switch_xml_t x
                *new_handle = NULL;
                goto err;
        }
-       
+
        if (rc_add_config(*new_handle, "auth_order", "radius", "mod_radius_cdr.c", 0) != 0) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding auth_order\n");           
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding auth_order\n");
                goto err;
        }
-       
+
        if ((server = switch_xml_child(xml, "connection")) == NULL ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section in config file.\n");               
-               goto err;               
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section in config file.\n");
+               goto err;
        }
-       
+
        for (param = switch_xml_child(server, "param"); param; param = param->next) {
                char *var = (char *) switch_xml_attr_soft(param, "name");
                char *val = (char *) switch_xml_attr_soft(param, "value");
-               
+
                if ( GLOBAL_DEBUG ) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Attempting to add param '%s' with value '%s' \n", var, val);
                }
-               
+
                if (strncmp(var, "dictionary", 10) == 0) {
                        if ( rc_read_dictionary(*new_handle, val) != 0) {
                                goto err;
                        }
                } else if (rc_add_config(*new_handle, var, val, "mod_xml_radius", 0) != 0) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding param '%s' with value '%s' \n", var, val);                        
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding param '%s' with value '%s' \n", var, val);
                        goto err;
                }
        }
@@ -114,7 +114,7 @@ switch_status_t mod_xml_radius_new_handle(rc_handle **new_handle, switch_xml_t x
        return SWITCH_STATUS_GENERR;
 }
 
-switch_status_t do_config() 
+switch_status_t do_config()
 {
        char *conf = "xml_radius.conf";
        switch_xml_t xml, cfg, tmp, server, param;
@@ -155,7 +155,7 @@ switch_status_t do_config()
                                                seq = 1;
                                        }
                                }
-                               
+
                                if ( serv && timeout && deadtime && retries && dict && seq ) {
                                        globals.auth_invite_configs = tmp;
                                } else {
@@ -165,11 +165,11 @@ switch_status_t do_config()
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section for auth_invite\n");
                        goto err;
-               }               
+               }
        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'auth_invite' section in config file.\n");               
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'auth_invite' section in config file.\n");
        }
-       
+
        serv = timeout = deadtime = retries = dict = seq = 0;
        if ((tmp = switch_xml_dup(switch_xml_child(cfg, "auth_reg"))) != NULL ) {
                if ( (server = switch_xml_child(tmp, "connection")) != NULL) {
@@ -189,7 +189,7 @@ switch_status_t do_config()
                                                seq = 1;
                                        }
                                }
-                               
+
                                if ( serv && timeout && deadtime && retries && dict && seq ) {
                                        globals.auth_reg_configs = tmp;
                                } else {
@@ -199,9 +199,9 @@ switch_status_t do_config()
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section for auth_invite\n");
                        goto err;
-               }               
+               }
        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'auth_reg' section in config file.\n");          
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'auth_reg' section in config file.\n");
        }
 
        if ((tmp = switch_xml_child(cfg, "global")) != NULL ) {
@@ -242,7 +242,7 @@ switch_status_t do_config()
                                                seq = 1;
                                        }
                                }
-                               
+
                                if ( serv && timeout && deadtime && retries && dict && seq ) {
                                        globals.auth_app_configs = tmp;
                                } else {
@@ -252,11 +252,11 @@ switch_status_t do_config()
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section for auth_app\n");
                        goto err;
-               }               
+               }
        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'auth_app' section in config file.\n");          
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'auth_app' section in config file.\n");
        }
-       
+
        serv = timeout = deadtime = retries = dict = seq = 0;
        if (( tmp = switch_xml_dup(switch_xml_child(cfg, "acct_start"))) != NULL ) {
                if ( (server = switch_xml_child(tmp, "connection")) != NULL) {
@@ -276,7 +276,7 @@ switch_status_t do_config()
                                                seq = 1;
                                        }
                                }
-                               
+
                                if ( serv && timeout && deadtime && retries && dict && seq ) {
                                        globals.acct_start_configs = tmp;
                                } else {
@@ -286,11 +286,11 @@ switch_status_t do_config()
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section for acct_start\n");
                        goto err;
-               }               
+               }
        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'acct_start' section in config file.\n");                
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'acct_start' section in config file.\n");
        }
-       
+
        serv = timeout = deadtime = retries = dict = seq = 0;
        if (( tmp = switch_xml_dup(switch_xml_child(cfg, "acct_end"))) != NULL ) {
                if ( (server = switch_xml_child(tmp, "connection")) != NULL) {
@@ -310,7 +310,7 @@ switch_status_t do_config()
                                                seq = 1;
                                        }
                                }
-                               
+
                                if ( serv && timeout && deadtime && retries && dict && seq ) {
                                        globals.acct_end_configs = tmp;
                                } else {
@@ -320,43 +320,43 @@ switch_status_t do_config()
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section for acct_end\n");
                        goto err;
-               }               
+               }
        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'acct_end' section in config file.\n");          
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'acct_end' section in config file.\n");
        }
-       
+
        if ( xml ) {
                switch_xml_free(xml);
                xml = NULL;
        }
 
        return SWITCH_STATUS_SUCCESS;
-       
+
  err:
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Configuration error\n");
        if ( xml ) {
                switch_xml_free(xml);
                xml = NULL;
        }
-       
+
        return SWITCH_STATUS_GENERR;
 }
 
-switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch_event_t *params, rc_handle *handle, VALUE_PAIR **send, switch_xml_t fields) 
+switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch_event_t *params, rc_handle *handle, VALUE_PAIR **send, switch_xml_t fields)
 {
        switch_xml_t param;
        void *av_value = NULL;
-       
+
        if ( (param = switch_xml_child(fields, "param")) == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to locate a param under the fields section\n");
-               goto err;               
+               goto err;
        }
-       
+
        for (; param; param = param->next) {
                DICT_ATTR *attribute = NULL;
                DICT_VENDOR *vendor = NULL;
                int attr_num = 0, vend_num = 0;
-               
+
                char *var = (char *) switch_xml_attr(param, "name");
                char *vend = (char *) switch_xml_attr(param, "vendor");
                char *variable = (char *) switch_xml_attr(param, "variable");
@@ -368,55 +368,55 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                 char *regex = (char *) switch_xml_attr(param, "regex");
 
                attribute = rc_dict_findattr(handle, var);
-               
+
                if ( attribute == NULL ) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Could not locate attribute '%s' in the configured dictionary\n", var);
                        goto err;
                }
-               
+
                if ( GLOBAL_DEBUG ) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: dict attr '%s' value '%d' type '%d'\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: dict attr '%s' value '%d' type '%d'\n",
                                                          attribute->name, attribute->value, attribute->type);
                }
-               
+
                attr_num = attribute->value;
-               
+
                if ( vend ) {
                        vendor = rc_dict_findvend(handle, vend);
-                       
+
                        if ( vendor == NULL ) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Could not locate vendor '%s' in the configured dictionary %p\n", 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Could not locate vendor '%s' in the configured dictionary %p\n",
                                                                  vend, vend);
                                goto err;
-                       }                       
+                       }
 
                        if ( GLOBAL_DEBUG ) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: dict vend name '%s' vendorpec '%d'\n", 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: dict vend name '%s' vendorpec '%d'\n",
                                                                  vendor->vendorname, vendor->vendorpec);
                        }
-                       
+
                        vend_num = vendor->vendorpec;
-               } 
-               
+               }
+
                if ( var ) {
                        if ( session ) {
                                switch_channel_t *channel = switch_core_session_get_channel(session);
                                if ( skip_if_set && switch_channel_get_variable(channel, skip_if_set) ) {
                                        goto end_loop;
                                }
-                               
+
                                /*  Accounting only */
                                if ( strncmp( var, "h323-setup-time", 15) == 0 ) {
                                        switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
                                        switch_time_t time = profile->times->created;
                                        switch_time_exp_t tm;
-                                       
+
                                        if ( !time ) {
                                                goto end_loop;
                                        }
-                                       
+
                                        switch_time_exp_lt(&tm, time);
-                                       
+
                                        if ( GLOBAL_TIME_FORMAT == 1 ) {
                                                av_value = switch_mprintf("%02u:%02u:%02u.%03u %s %s %s %02u %04u",
                                                                                                  tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec/1000,
@@ -432,7 +432,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                        if (rc_avpair_add(handle, send, attr_num, av_value, -1, vend_num) == NULL) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                                                goto err;
-                                       } 
+                                       }
                                        if ( GLOBAL_DEBUG ) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: value: %s\n", (char *) av_value);
                                        }
@@ -444,7 +444,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                        if ( !time ) {
                                                goto end_loop;
                                        }
-                                       
+
                                        switch_time_exp_lt(&tm, time);
 
                                        if ( GLOBAL_TIME_FORMAT == 1 ) {
@@ -462,7 +462,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                        if (rc_avpair_add(handle, send, attr_num, av_value, -1, vend_num) == NULL) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                                                goto err;
-                                       } 
+                                       }
                                        if ( GLOBAL_DEBUG ) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: value: %s\n", (char *) av_value);
                                        }
@@ -478,7 +478,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                                        goto end_loop;
                                                }
                                        }
-                                       
+
                                        switch_time_exp_lt(&tm, time);
 
                                        if ( GLOBAL_TIME_FORMAT == 1 ) {
@@ -496,7 +496,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                        if (rc_avpair_add(handle, send, attr_num, av_value, -1, vend_num) == NULL) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                                                goto err;
-                                       } 
+                                       }
                                        if ( GLOBAL_DEBUG ) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: value: %s\n", (char *) av_value);
                                        }
@@ -506,8 +506,8 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                        if (rc_avpair_add(handle, send, 30, av_value, -1, 9) == NULL) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add disconnect cause \n");
                                                goto err;
-                                       }                       
-                                       
+                                       }
+
                                } else {
                                        if ( format == NULL ) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing format attribute for %s variable\n", variable);
@@ -516,7 +516,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
 
                                        if ( attribute->type == 0 ) {
                                                const char *val = NULL;
-                                               
+
                                                if ( other_leg ) {
                                                        val = switch_channel_get_variable_partner(channel, variable);
                                                        if ( val == NULL && variable_secondary != NULL) {
@@ -528,7 +528,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                                                val = switch_channel_get_variable(channel, variable_secondary);
                                                        }
                                                }
-                                               
+
                                                if ( regex && val ) {
                                                         switch_regex_t *re = NULL;
                                                         int ovector[30];
@@ -546,37 +546,37 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                                         }
                                                         switch_regex_safe_free(re);
                                                }
-                                               
+
                                                if ( val == NULL && val_default != NULL) {
-                                                       av_value = switch_mprintf(format, val_default);                                                 
+                                                       av_value = switch_mprintf(format, val_default);
                                                } else {
                                                        av_value = switch_mprintf(format, val);
                                                }
-                                               
+
                                                if ( GLOBAL_DEBUG ) {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: value: %s\n", (char *) av_value);
                                                }
-                               
+
                                                if (rc_avpair_add(handle, send, attr_num, av_value, -1, vend_num) == NULL) {
-                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                                                          "mod_xml_radius: failed to add option with val '%s' to handle\n", (char *) av_value);
                                                        goto err;
-                                               }                       
+                                               }
                                        } else if ( attribute->type == 1 ) {
                                                const char *data = switch_channel_get_variable(channel, variable);
                                                int number = 0;
-                                               
+
                                                if ( data ) {
                                                        number = atoi(data);
                                                }
-                                               
+
                                                if (rc_avpair_add(handle, send, attr_num, &number, -1, vend_num) == NULL) {
-                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                                                          "mod_xml_radius: failed to add option with value '%d' to handle\n", number);
                                                        goto err;
-                                               }                                               
+                                               }
                                        }
-                               }                       
+                               }
                        } else if ( params ) {
                                /* Auth only */
                                char *tmp = switch_event_get_header(params, variable);
@@ -584,17 +584,17 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                                if ( GLOBAL_DEBUG ) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: param var '%s' val: %s\n", variable, tmp);
                                }
-                               
+
                                if ( tmp == NULL ) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Unable to locate '%s' on the event\n", variable);
-                                       goto err;                                       
+                                       goto err;
                                }
-                               
+
                                av_value = switch_mprintf(format, tmp);
                                if (rc_avpair_add(handle, send, attr_num, av_value, -1, vend_num) == NULL) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                                        goto err;
-                               }                               
+                               }
                        } else {
                                goto err;
                        }
@@ -609,7 +609,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                        av_value  = NULL;
                }
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
  err:
        if ( av_value != NULL ) {
@@ -617,7 +617,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
                av_value  = NULL;
        }
        return SWITCH_STATUS_GENERR;
-       
+
 }
 
 /* static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream) */
@@ -647,37 +647,37 @@ switch_xml_t mod_xml_radius_auth_invite(switch_event_t *params) {
        if (GLOBAL_DEBUG ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting invite authentication\n");
        }
-       
+
        if ( mod_xml_radius_new_handle(&new_handle, globals.auth_invite_configs) != SWITCH_STATUS_SUCCESS ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load radius handle for digest invite authentication\n");
-               goto err;               
+               goto err;
        }
 
        if ( new_handle == NULL ) {
                goto err;
        }
-       
+
        if ((fields = switch_xml_child(globals.auth_invite_configs, "fields")) == NULL ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");           
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");
                goto err;
        }
-       
+
        if ( mod_xml_radius_add_params(NULL, params, new_handle, &send, fields) != SWITCH_STATUS_SUCCESS ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");         
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");
                goto err;
        }
-       
+
        if (rc_avpair_add(new_handle, &send, PW_SERVICE_TYPE, &service, -1, 0) == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                goto err;
        }
-       
+
        result = rc_auth(new_handle, 0, send, &recv, msg);
-       
+
        if ( GLOBAL_DEBUG ){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: result(RC=%d) %s \n", result, msg);
        }
-       
+
        if ( result != 0 ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Failed to authenticate\n");
                goto err;
@@ -691,9 +691,9 @@ switch_xml_t mod_xml_radius_auth_invite(switch_event_t *params) {
        switch_xml_set_attr_d(dom, "name", switch_event_get_header(params, "domain"));
        usr = switch_xml_add_child_d(dom, "user", 0);
        vars = switch_xml_add_child_d(usr, "variables", 0);
-       
+
        switch_xml_set_attr_d(usr, "id", switch_event_get_header(params, "user"));
-               
+
        var = switch_xml_add_child_d(vars, "variable", param_idx++);
        switch_xml_set_attr_d(var, "name", "radius_auth_result");
        switch_xml_set_attr_d(var, "value", "0");
@@ -716,7 +716,7 @@ switch_xml_t mod_xml_radius_auth_invite(switch_event_t *params) {
        if ( GLOBAL_DEBUG ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XML: %s \n", switch_xml_toxml(xml, 1));
        }
-       
+
        if ( recv ) {
                rc_avpair_free(recv);
                recv = NULL;
@@ -743,7 +743,7 @@ switch_xml_t mod_xml_radius_auth_invite(switch_event_t *params) {
                rc_destroy(new_handle);
                new_handle = NULL;
        }
-       
+
        return NULL;
 }
 
@@ -759,37 +759,37 @@ switch_xml_t mod_xml_radius_auth_reg(switch_event_t *params) {
        if (GLOBAL_DEBUG ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting registration authentication\n");
        }
-       
+
        if ( mod_xml_radius_new_handle(&new_handle, globals.auth_reg_configs) != SWITCH_STATUS_SUCCESS ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load radius handle for registration authentication\n");
-               goto err;               
+               goto err;
        }
 
        if ( new_handle == NULL ) {
                goto err;
        }
-       
+
        if ((fields = switch_xml_child(globals.auth_reg_configs, "fields")) == NULL ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");           
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");
                goto err;
        }
-       
+
        if ( mod_xml_radius_add_params(NULL, params, new_handle, &send, fields) != SWITCH_STATUS_SUCCESS ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");         
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");
                goto err;
        }
-       
+
        if (rc_avpair_add(new_handle, &send, PW_SERVICE_TYPE, &service, -1, 0) == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                goto err;
        }
-       
+
        result = rc_auth(new_handle, 0, send, &recv, msg);
-       
+
        if ( GLOBAL_DEBUG ){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: result(RC=%d) %s \n", result, msg);
        }
-       
+
        if ( result != 0 ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Failed to authenticate\n");
                goto err;
@@ -803,9 +803,9 @@ switch_xml_t mod_xml_radius_auth_reg(switch_event_t *params) {
        switch_xml_set_attr_d(dom, "name", switch_event_get_header(params, "domain"));
        usr = switch_xml_add_child_d(dom, "user", 0);
        vars = switch_xml_add_child_d(usr, "variables", 0);
-       
+
        switch_xml_set_attr_d(usr, "id", switch_event_get_header(params, "user"));
-               
+
        service_vp = recv;
        while (service_vp != NULL) {
                rc_avpair_tostr(new_handle, service_vp, name, 512, value, 512);
@@ -824,7 +824,7 @@ switch_xml_t mod_xml_radius_auth_reg(switch_event_t *params) {
        if ( GLOBAL_DEBUG ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XML: %s \n", switch_xml_toxml(xml, 1));
        }
-       
+
        if ( recv ) {
                rc_avpair_free(recv);
                recv = NULL;
@@ -852,30 +852,30 @@ switch_xml_t mod_xml_radius_auth_reg(switch_event_t *params) {
                rc_destroy(new_handle);
                new_handle = NULL;
        }
-       
+
        return NULL;
 }
 
-static switch_xml_t mod_xml_radius_directory_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, 
+static switch_xml_t mod_xml_radius_directory_search(const char *section, const char *tag_name, const char *key_name, const char *key_value,
                                                                                                        switch_event_t *params, void *user_data)
 {
        char *event_buf = NULL;
        switch_xml_t xml = NULL;
        char *auth_method = switch_event_get_header(params,"sip_auth_method");
-       
+
 
        if ( GLOBAL_DEBUG ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting authentication\n");
                switch_event_serialize(params, &event_buf, SWITCH_TRUE);
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event: %s \n", event_buf);
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\nSection: %s \nTag: %s\nKey_name: %s\nKey_value: %s\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\nSection: %s \nTag: %s\nKey_name: %s\nKey_value: %s\n",
                                                  section, tag_name, key_name, key_value);
        }
-       
+
        if ( auth_method == NULL) {
                return NULL;
        }
-       
+
        if ( strncmp( "INVITE", auth_method, 6) == 0) {
                xml = mod_xml_radius_auth_invite(params);
        } else if ( strncmp( "REGISTER", auth_method, 8) == 0) {
@@ -895,32 +895,32 @@ switch_status_t mod_xml_radius_check_conditions(switch_channel_t *channel, switc
        char *anti = NULL;
        int all_matched = 1;
        int result = 0;
-       
+
        if ( (condition = switch_xml_child(conditions, "condition")) == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to locate a condition under the conditions section\n");
                return SWITCH_STATUS_FALSE;
        }
-       
+
        for (; condition; condition = condition->next) {
-               
+
                if ( (param = switch_xml_child(condition, "param")) == NULL) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to locate a param under this condition\n");
                        return SWITCH_STATUS_FALSE;
                }
-               
+
                all_matched = 1;
                for (; param && all_matched; param = param->next) {
                        channel_var = (char *) switch_xml_attr(param, "var");
                        regex = (char *) switch_xml_attr(param, "regex");
                        anti = (char *) switch_xml_attr(param, "anti");
-                       
+
                        if ( channel_var == NULL || regex == NULL ) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Improperly constructed mod_radius condition: %s %s\n", channel_var, regex);
                                continue;
                        }
-                       
+
                        if ( ( channel_val = switch_channel_get_variable(channel, channel_var) ) == NULL ) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                                  "Improperly constructed mod_radius condition, no such channel variable: %s %s\n", channel_var, regex);
                                continue;
                        }
@@ -930,7 +930,7 @@ switch_status_t mod_xml_radius_check_conditions(switch_channel_t *channel, switc
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Didn't match: %s == %s \n", switch_channel_get_variable(channel, channel_var), regex);
                                all_matched = 0;
                        } else {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Result of %s match: %s == %s \n", 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Result of %s match: %s == %s \n",
                                                                  anti, switch_channel_get_variable(channel, channel_var), regex);
                        }
                }
@@ -939,7 +939,7 @@ switch_status_t mod_xml_radius_check_conditions(switch_channel_t *channel, switc
                        return SWITCH_STATUS_SUCCESS;
                }
        }
-       
+
        return SWITCH_STATUS_FALSE;
 }
 
@@ -960,27 +960,27 @@ switch_status_t mod_xml_radius_accounting_start(switch_core_session_t *session){
                mod_xml_radius_check_conditions(channel, conditions) != SWITCH_STATUS_SUCCESS ) {
                goto end;
        }
-       
+
        if ( mod_xml_radius_new_handle(&new_handle, globals.acct_start_configs) != SWITCH_STATUS_SUCCESS || new_handle == NULL ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new accounting_start handle for call: %s\n",
                                                  switch_channel_get_variable(channel, "uuid"));
-               goto end;               
+               goto end;
        }
 
        if ((fields = switch_xml_child(globals.acct_start_configs, "fields")) == NULL ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");           
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");
                goto end;
        }
-       
+
        if ( mod_xml_radius_add_params(session, NULL, new_handle, &send, fields) != SWITCH_STATUS_SUCCESS ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");         
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");
                goto end;
        }
-       
+
        if (rc_avpair_add(new_handle, &send, PW_ACCT_STATUS_TYPE, &service, -1, 0) == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                goto end;
-       }       
+       }
 
        if (rc_acct(new_handle, 0, send) == OK_RC) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "mod_xml_radius:  Accounting Start success\n");
@@ -1007,38 +1007,38 @@ switch_status_t mod_xml_radius_accounting_end(switch_core_session_t *session){
        rc_handle *new_handle = NULL;
        switch_xml_t fields = NULL, conditions = NULL;
        switch_channel_t *channel = switch_core_session_get_channel(session);
-       
+
        if (GLOBAL_DEBUG ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting accounting stop\n");
                switch_core_session_execute_application(session, "info", NULL);
        }
-       
+
        /* If there are conditions defined, and none of them pass, then skip this accounting */
        if ((conditions = switch_xml_child(globals.acct_end_configs, "conditions")) != NULL &&
                mod_xml_radius_check_conditions(channel, conditions) != SWITCH_STATUS_SUCCESS ) {
                goto end;
        }
-       
+
        if ( mod_xml_radius_new_handle(&new_handle, globals.acct_end_configs) != SWITCH_STATUS_SUCCESS || new_handle == NULL ) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new accounting_end handle for call: %s\n",
                                                  switch_channel_get_variable(channel, "uuid"));
-               goto end;               
+               goto end;
        }
 
        if ((fields = switch_xml_child(globals.acct_end_configs, "fields")) == NULL ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");           
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");
                goto end;
        }
-       
+
        if ( mod_xml_radius_add_params(session, NULL, new_handle, &send, fields) != SWITCH_STATUS_SUCCESS ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");         
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");
                goto end;
        }
-       
+
        if (rc_avpair_add(new_handle, &send, PW_ACCT_STATUS_TYPE, &service, -1, 0) == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                goto end;
-       }       
+       }
 
        if (rc_acct(new_handle, 0, send) == OK_RC) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "mod_xml_radius:  Accounting Stop success\n");
@@ -1055,7 +1055,7 @@ switch_status_t mod_xml_radius_accounting_end(switch_core_session_t *session){
                rc_destroy(new_handle);
                new_handle = NULL;
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1079,28 +1079,28 @@ SWITCH_STANDARD_APP(radius_auth_handle)
                                                  switch_channel_get_variable(channel, "uuid"));
                goto err;
        }
-       
+
        if ((fields = switch_xml_child(globals.auth_app_configs, "fields")) == NULL ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");           
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n");
                goto err;
        }
-       
+
        if ( mod_xml_radius_add_params(session, NULL, new_handle, &send, fields) != SWITCH_STATUS_SUCCESS ) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");         
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n");
                goto err;
        }
-       
+
        if (rc_avpair_add(new_handle, &send, PW_SERVICE_TYPE, &service, -1, 0) == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n");
                goto err;
        }
-       
+
        result = rc_auth(new_handle, 0, send, &recv, msg);
-       
+
        if ( GLOBAL_DEBUG ){
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: result(RC=%d) %s \n", result, msg);
        }
-       temp = switch_mprintf("%d",result);     
+       temp = switch_mprintf("%d",result);
        switch_channel_set_variable(channel, "radius_auth_result", temp);
        free(temp);
        temp = NULL;
@@ -1133,7 +1133,7 @@ SWITCH_STANDARD_APP(radius_auth_handle)
                rc_destroy(new_handle);
                new_handle = NULL;
        }
-       
+
        return;
  err:
        if ( recv ) {
@@ -1175,7 +1175,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_radius_load)
 
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       
+
        memset(&globals, 0, sizeof(globals));
        globals.pool = pool;
 
@@ -1187,17 +1187,17 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_radius_load)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Failed to load configs\n");
                return SWITCH_STATUS_TERM;
        }
-       
+
        if ( globals.auth_invite_configs && globals.auth_reg_configs ) {
                status = switch_xml_bind_search_function(mod_xml_radius_directory_search, switch_xml_parse_section_string("directory"), NULL);
        }
-               
+
        SWITCH_ADD_API(mod_xml_radius_api_interface, "xml_radius_debug", "mod_xml_radius toggle debug", mod_xml_radius_debug_api, NULL);
 
        switch_core_add_state_handler(&state_handlers);
 
        SWITCH_ADD_APP(app_interface, "radius_auth", NULL, NULL, radius_auth_handle, "radius_auth", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
-       
+
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
index 16e5df5fb6bfdda1f46a97b86be2a4855e78ee12..028ace286a1d6d934160208e1a738aaf3db0862c 100644 (file)
@@ -1,12 +1,12 @@
 <configuration name="xml_radius.conf" description="Radius XML Gateway">
   <!--
      auth_invite is only called when a directory lookup is done on an inbound invite. Usually that means a digest auth challenge on the invite.
-     
-     auth_reg is only called on the actual registration. 
-     
+
+     auth_reg is only called on the actual registration.
+
      auth_app is used when an invite is in the dialplan. If your profile requires digest auth then this isn't needed.
               but if your profile is doing only ip authentication this allows you to authenticate the call without the need for digest auth.
-             
+
      acct_start happens when the call goes into the state 'routing' which means it is starting the dialplan
   -->
   <auth_invite>
       <param name="Digest-Response" variable="sip_auth_response" format="%s"/>
       <param name="Digest-Realm" variable="sip_auth_realm" format="%s"/>
       <param name="Digest-Nonce" variable="sip_auth_nonce" format="%s"/>
-      <param name="Digest-Username" variable="sip_auth_username" format="%s"/> 
+      <param name="Digest-Username" variable="sip_auth_username" format="%s"/>
       <param name="Digest-URI" variable="sip_auth_uri" format="%s"/>
       <param name="Digest-Method" variable="sip_auth_method" format="%s"/>
       <param name="Digest-Algorithm" variable="sip_auth_method" format="MD5"/>
       <param name="Digest-Qop" variable="sip_auth_qop" format="%s"/>
       <param name="Digest-CNonce" variable="sip_auth_cnonce" format="%s"/>
-      <param name="Digest-Nonce-Count" variable="sip_auth_nc" format="%s"/> 
+      <param name="Digest-Nonce-Count" variable="sip_auth_nc" format="%s"/>
     </fields>
   </auth_invite>
   <auth_reg>
@@ -93,7 +93,7 @@
       <param name="dictionary" value="/usr/share/freeradius/dictionary.cisco"/>
       <param name="seqfile" value="/var/run/radius.seq"/>
     </connection>
-    <fields>      
+    <fields>
     </fields>
   </auth_reg>
   <acct_start>
       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-number-in=%s" />
       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-number-out=%s" />
       <param name="Calling-Station-Id" variable="sip_from_user" variable_secondary="ani" format="%s"/>
-      <param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>  
+      <param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>
       <param vendor="Cisco" name="Cisco-AVPair" variable="destination_number" format="dst-gw-name=%s"/>
       <param vendor="Cisco" name="Cisco-AVPair" variable="destination_number" format="dst-number-in=%s" />
       <param vendor="Cisco" name="Cisco-AVPair" variable="destination_number" format="dst-number-out=%s" />
       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-number-in=%s" />
       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_from_user" variable_secondary="ani" format="src-number-out=%s" />
       <param name="Calling-Station-Id" variable="sip_from_user" variable_secondary="ani" format="%s"/>
-      <param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>  
+      <param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_host" format="dst-gw-ip=%s"/>
       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_user" variable_secondary="dialed_extension" format="dst-gw-name=%s"/>
       <param vendor="Cisco" name="Cisco-AVPair" variable="sip_to_user" variable_secondary="dialed_extension" format="dst-number-in=%s" />
       <param name="Called-Station-Id" variable="destination_number" format="%s"/>
index 3ef840ea87681f3af88593e55941231714a5c70e..43e25b6f9ef844f1f68ad4854aa3d2fb2b10bdb0 100644 (file)
@@ -165,7 +165,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_rpc_load)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", "websocket::stophook");
                return SWITCH_STATUS_TERM;
        }
-       
+
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -1077,7 +1077,7 @@ abyss_bool handler_hook(TSession * r)
        /* fs api command will write to stream,  calling http_stream_write / http_stream_raw_write      */
        /* switch_api_execute will stream INVALID COMMAND before it fails                                               */
        switch_api_execute(command, api_str, NULL, &stream);
-       
+
         if (globals.commands_to_log != NULL) {
                 full_command = switch_mprintf("%s%s%s", command, (api_str==NULL ? "" : " "), api_str);
 
@@ -1286,7 +1286,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_rpc_shutdown)
 {
 
        switch_event_free_subclass("websocket::stophook");
-       
+
        /* Cann't find a way to stop the websockets, use this for a workaround before finding the real one that works */
        stop_all_websockets();
 
index 2f829136ae0c4073059cb30d3177debca7e0afeb..44a3860ae4d8396bea1dbc3e72036b54997ea227 100644 (file)
@@ -9,11 +9,11 @@ static struct globals_s globals;
 
 #ifndef WSS_STANDALONE
 
-void init_ssl(void) 
+void init_ssl(void)
 {
        //      SSL_library_init();
 }
-void deinit_ssl(void) 
+void deinit_ssl(void)
 {
        return;
 }
@@ -85,7 +85,7 @@ void init_ssl(void) {
        globals.ssl_method = TLSv1_server_method();   /* create server instance */
        globals.ssl_ctx = SSL_CTX_new(globals.ssl_method);         /* create context */
        assert(globals.ssl_ctx);
-       
+
        /* set the local certificate from CertFile */
        SSL_CTX_use_certificate_file(globals.ssl_ctx, globals.cert, SSL_FILETYPE_PEM);
        /* set the private key from KeyFile */
@@ -138,28 +138,28 @@ static int cheezy_get_var(char *data, char *name, char *buf, size_t buflen)
          e = strchr(v, '\n');
        }
          }
-                       
+
          if (v && e) {
        size_t cplen;
        size_t len = e - v;
-       
+
        if (len > buflen - 1) {
          cplen = buflen -1;
        } else {
          cplen = len;
        }
-       
+
        strncpy(buf, v, cplen);
        *(buf+cplen) = '\0';
        return 1;
          }
-         
+
        }
   }
   return 0;
 }
 
-static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t olen) 
+static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t olen)
 {
        int y=0,bytes=0;
        size_t x=0;
@@ -203,7 +203,7 @@ static void sha1_digest(char *digest, unsigned char *in)
        SHA1Update(&sha, in, strlen(in));
        SHA1Final(&sha, digest);
 }
-#else 
+#else
 
 static void sha1_digest(unsigned char *digest, char *in)
 {
@@ -236,7 +236,7 @@ int ws_handshake_kvp(wsh_t *wsh, char *key, char *version, char *proto)
        sha1_digest(output, input);
        b64encode((unsigned char *)output, SHA1_HASH_SIZE, (unsigned char *)b64, sizeof(b64));
 
-       snprintf(respond, sizeof(respond), 
+       snprintf(respond, sizeof(respond),
                         "HTTP/1.1 101 Switching Protocols\r\n"
                         "Upgrade: websocket\r\n"
                         "Connection: Upgrade\r\n"
@@ -358,7 +358,7 @@ void ws_destroy(wsh_t *wsh)
        if (wsh->down > 1) {
                return;
        }
-       
+
        wsh->down = 2;
 
        if (wsh->ssl) {
@@ -372,9 +372,9 @@ void ws_destroy(wsh_t *wsh)
        }
 }
 
-issize_t ws_close(wsh_t *wsh, int16_t reason) 
+issize_t ws_close(wsh_t *wsh, int16_t reason)
 {
-       
+
        if (wsh->down) {
                return -1;
        }
@@ -386,7 +386,7 @@ issize_t ws_close(wsh_t *wsh, int16_t reason)
 
 issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
 {
-       
+
        issize_t need = 2;
        char *maskp;
 
@@ -435,7 +435,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
 
                        if (mask) {
                                need += 4;
-                               
+
                                if (need > wsh->datalen) {
                                        /* too small - protocol err */
                                        *oc = WSOC_CLOSE;
@@ -445,7 +445,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
 
                        wsh->plen = wsh->buffer[1] & 0x7f;
                        wsh->payload = &wsh->buffer[2];
-                       
+
                        if (wsh->plen == 127) {
                                uint64_t *u64;
 
@@ -488,7 +488,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                        if ((need + wsh->datalen) > (issize_t)wsh->buflen) {
                                /* too big - Ain't nobody got time fo' dat */
                                *oc = WSOC_CLOSE;
-                               return ws_close(wsh, WS_DATA_TOO_BIG);                          
+                               return ws_close(wsh, WS_DATA_TOO_BIG);
                        }
 
                        wsh->rplen = wsh->plen - need;
@@ -506,7 +506,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                                wsh->rplen += r;
                                need -= r;
                        }
-                       
+
                        if (mask && maskp) {
                                issize_t i;
 
@@ -514,13 +514,13 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                                        wsh->payload[i] ^= maskp[i % 4];
                                }
                        }
-                       
+
 
                        if (*oc == WSOC_PING) {
                                ws_write_frame(wsh, WSOC_PONG, wsh->payload, wsh->rplen);
                                goto again;
                        }
-                       
+
 
                        *(wsh->payload+wsh->rplen) = '\0';
                        *data = (uint8_t *)wsh->payload;
@@ -549,7 +549,7 @@ issize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes)
        }
 
        memcpy(wsh->wbuffer + wsh->wdatalen, data, bytes);
-       
+
        wsh->wdatalen += (issize_t)bytes;
 
        return (issize_t)bytes;
@@ -562,9 +562,9 @@ issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc)
        if (!wsh->wdatalen) {
                return -1;
        }
-       
+
        r = ws_write_frame(wsh, oc, wsh->wbuffer, wsh->wdatalen);
-       
+
        wsh->wdatalen = 0;
 
        return r;
@@ -600,7 +600,7 @@ issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes)
 
                hdr[1] = 127;
                hlen += 8;
-               
+
                u64 = (uint64_t *) &hdr[2];
                *u64 = htonl((unsigned long)bytes);
        }
@@ -612,7 +612,7 @@ issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes)
        if (ws_raw_write(wsh, data, bytes) != (issize_t)bytes) {
                return -2;
        }
-       
+
        return (issize_t)bytes;
 }
 
index 79bdb7c116c81239d26931fc2c35a57e0c773c2a..4c9e47140254d5089f6ca22ec84a7b429478e9ce 100644 (file)
@@ -9,7 +9,7 @@
 #include <sys/types.h>
 #ifndef _MSC_VER
 #include <arpa/inet.h>
-#include <sys/wait.h> 
+#include <sys/wait.h>
 #include <sys/socket.h>
 #else
 #pragma warning(disable:4996)
@@ -95,7 +95,7 @@ int ws_handshake_kvp(wsh_t *wsh, char *key, char *version, char *proto);
 
 #ifndef _MSC_VER
 static inline uint64_t get_unaligned_uint64(const void *p)
-{   
+{
     const struct { uint64_t d; } __attribute__((packed)) *pp = p;
     return pp->d;
 }
index 16f0e9a8938c6dcba220a85c4bef0b5744c0eae2..e346230efe16fc3cdcc51e1cd1599496737c9a75 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * mod_xml_scgi.c -- SCGI XML Gateway
@@ -46,7 +46,7 @@ struct xml_binding {
        int timeout;
        switch_hash_t *vars_map;
        char *bindings;
-       
+
        char *server;
        switch_thread_t *thread;
        struct xml_binding *next;
@@ -116,7 +116,7 @@ void *SWITCH_THREAD_FUNC monitor_thread_run(switch_thread_t *thread, void *obj)
                        switch_yield(10000000);
                }
        }
-       
+
        return NULL;
 }
 
@@ -170,7 +170,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
 
                while((len = scgi_recv(&handle, buf, sizeof(buf))) > 0) {
                        char *expanded = switch_event_expand_headers(params, (char *)buf);
-                       
+
                        bytes += len;
 
                        if (bytes > XML_SCGI_MAX_BYTES) {
@@ -185,7 +185,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
                        if (expanded != (char *)buf) {
                                free(expanded);
                        }
-                       
+
                        memset(buf, 0, sizeof(buf));
                }
 
@@ -201,32 +201,32 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
                goto end;
        }
 
-       
+
 
        if (GLOBAL_DEBUG) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s\nPOST_DATA:\n%s\n\nRESPONSE:\n-----\n%s\n-----\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s\nPOST_DATA:\n%s\n\nRESPONSE:\n-----\n%s\n-----\n",
                                                  binding->url, data, switch_str_nil(txt));
        }
 
-       
+
 
        if (bytes && txt) {
                if (!(xml = switch_xml_parse_str_dynamic(txt, FALSE))) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result! [%s]\ndata: [%s] RESPONSE[%s]\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result! [%s]\ndata: [%s] RESPONSE[%s]\n",
                                                          binding->url, data, switch_str_nil(txt));
                }
                txt = NULL;
        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received error trying to fetch %s\ndata: [%s] RESPONSE [%s]\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received error trying to fetch %s\ndata: [%s] RESPONSE [%s]\n",
                                                  binding->url, data, switch_str_nil(txt));
        }
 
 
  end:
-       
+
        switch_safe_free(data);
        switch_safe_free(txt);
-       
+
        return xml;
 }
 
@@ -329,7 +329,7 @@ static switch_status_t do_config(void)
 
         if (bind_mask) {
                        binding->bindings = switch_core_strdup(globals.pool, bind_mask);
-               }                                         
+               }
 
                if (vars_map) {
                        switch_zmalloc(hash_node, sizeof(hash_node_t));
@@ -351,14 +351,14 @@ static switch_status_t do_config(void)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
                                                  zstr(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");
                switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->bindings), binding);
-               
+
                if (binding->server) {
                        launch_monitor_thread(binding);
                }
 
                binding->next = globals.bindings;
                globals.bindings = binding;
-               
+
 
                x++;
                binding = NULL;
@@ -423,7 +423,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_scgi_shutdown)
                                        }
                                        break;
                                }
-                               
+
                                switch_yield(5000000);
                        }
 
index 292baade790214a3929c782837db5f6950e04c9c..636d4c35430e39fece21a28fc15a6b795f543d8b 100644 (file)
@@ -237,7 +237,7 @@ static int check_fd(int fd, int ms)
                        }
                }
        }
-       
+
        return r;
 }
 
@@ -305,7 +305,7 @@ static void daemonize(int *fds)
                        close(fds[0]);
                        fds[0] = -1;
 
-                       
+
                        if (system_ready < 0) {
                                printf("FreeSWITCH[%d] Error starting system! pid:%d\n", (int)getpid(), (int) pid);
                                kill(pid, 9);
@@ -1092,7 +1092,7 @@ int main(int argc, char *argv[])
        if (switch_core_set_process_privileges() < 0) {
                return 255;
        }
-       
+
        switch (priority) {
        case 2:
                set_realtime_priority();
@@ -1107,7 +1107,7 @@ int main(int argc, char *argv[])
                set_auto_priority();
                break;
        }
-       
+
        switch_core_setrlimits();
 
 
@@ -1193,7 +1193,7 @@ int main(int argc, char *argv[])
                        } else {
                                (void)read(fds[1], &v, sizeof(v));
                        }
-               
+
                        shutdown(fds[1], 2);
                        close(fds[1]);
                        fds[1] = -1;
index f9df9e79d13eb9688dd846661294c71d93745404..85edb040d0a0e4e2e470b8dadca08e373c2cad58 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Michael Jerris <mike@jerris.com>
  * Eliot Gable <egable@gmail.com>
  * William King <william.king@quentustech.com>
@@ -276,7 +276,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock
 SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsigned int flags, switch_memory_pool_t *pool)
 {
 #ifdef WIN32
-       /* Old version of APR misunderstands mutexes. On Windows, mutexes are cross-process. 
+       /* Old version of APR misunderstands mutexes. On Windows, mutexes are cross-process.
           APR has no reason to not use critical sections instead of mutexes. */
        if (flags == SWITCH_MUTEX_NESTED) flags = SWITCH_MUTEX_DEFAULT;
 #endif
@@ -772,7 +772,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send_nonblock(switch_socket_t *soc
        if (!sock || !buf || !len) {
                return SWITCH_STATUS_GENERR;
        }
-       
+
        return apr_socket_send(sock, buf, len);
 }
 
@@ -830,7 +830,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int
 {
        if (opt == SWITCH_SO_TCP_KEEPIDLE) {
                int r = -10;
-               
+
 #if defined(TCP_KEEPIDLE)
                r = setsockopt(jsock->client_socket, SOL_TCP, TCP_KEEPIDLE, (void *)&on, sizeof(on));
 #endif
@@ -838,7 +838,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int
                        return SWITCH_STATUS_NOTIMPL;
                }
 
-       
+
                return r ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
        }
 
@@ -902,7 +902,7 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, sw
 {
        return apr_mcast_interface(sock, iface);
 }
-                                                                                                
+
 
 /* socket functions */
 
@@ -986,8 +986,8 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_remove(switch_pollset_t *pollset,
 {
        if (!pollset || !descriptor) {
                return SWITCH_STATUS_FALSE;
-       }       
-       
+       }
+
        return apr_pollset_remove((apr_pollset_t *) pollset, (const apr_pollfd_t *) descriptor);
 }
 
@@ -996,18 +996,18 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **po
        if (!pollfd || !sock) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if ((*pollfd = (switch_pollfd_t*)apr_palloc(pool, sizeof(switch_pollfd_t))) == 0) {
                return SWITCH_STATUS_MEMERR;
        }
-       
+
        memset(*pollfd, 0, sizeof(switch_pollfd_t));
 
        (*pollfd)->desc_type = (switch_pollset_type_t) APR_POLL_SOCKET;
        (*pollfd)->reqevents = flags;
        (*pollfd)->desc.s = sock;
        (*pollfd)->client_data = client_data;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1015,15 +1015,15 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **po
 SWITCH_DECLARE(switch_status_t) switch_pollset_poll(switch_pollset_t *pollset, switch_interval_time_t timeout, int32_t *num, const switch_pollfd_t **descriptors)
 {
        apr_status_t st = SWITCH_STATUS_FALSE;
-       
+
        if (pollset) {
                st = apr_pollset_poll((apr_pollset_t *) pollset, timeout, num, (const apr_pollfd_t **) descriptors);
-               
+
                if (st == APR_TIMEUP) {
                        st = SWITCH_STATUS_TIMEOUT;
                }
        }
-       
+
        return st;
 }
 
@@ -1256,7 +1256,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, swi
 /**
  * Get the timeout value for a pipe or manipulate the blocking state.
  * @param thepipe The pipe we are getting a timeout for.
- * @param timeout The current timeout value in microseconds. 
+ * @param timeout The current timeout value in microseconds.
  */
 SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thepipe, switch_interval_time_t *timeout)
 {
@@ -1266,7 +1266,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thep
 /**
  * Set the timeout value for a pipe or manipulate the blocking state.
  * @param thepipe The pipe we are setting a timeout on.
- * @param timeout The timeout value in microseconds.  Values < 0 mean wait 
+ * @param timeout The timeout value in microseconds.  Values < 0 mean wait
  *        forever, 0 means do not wait at all.
  */
 SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_set(switch_file_t *thepipe, switch_interval_time_t timeout)
index 01745cc6b19df8e07eaaab3b4d5a6d77c8a2dcb6..58e524490d9756191c3bb255914236536d1eacce 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index c36f599d93b828e582b26abf29a01243f2aa5cd9..d3b835ec80f008ffe45e0c920a363364537fb287 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
 
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -53,7 +53,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
 
        switch_uuid_str(uuid_str, sizeof(uuid_str));
        profile->uuid_str = switch_core_strdup(pool, uuid_str);
-       
+
        if (!context) {
                context = "default";
        }
@@ -163,10 +163,10 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(switch_memor
                                profile->soft = n;
                        } else {
                                for(pp = profile->soft; pp && pp->next; pp = pp->next);
-                       
+
                                if (pp) {
                                        pp->next = n;
-                               }       
+                               }
                        }
                }
 
@@ -311,13 +311,13 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_
        switch_channel_timetable_t *times = NULL;
 
        switch_snprintf(header_name, sizeof(header_name), "%s-Direction", prefix);
-       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->direction == SWITCH_CALL_DIRECTION_INBOUND ? 
+       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->direction == SWITCH_CALL_DIRECTION_INBOUND ?
                                                                   "inbound" : "outbound");
 
        switch_snprintf(header_name, sizeof(header_name), "%s-Logical-Direction", prefix);
-       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->logical_direction == SWITCH_CALL_DIRECTION_INBOUND ? 
+       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->logical_direction == SWITCH_CALL_DIRECTION_INBOUND ?
                                                                   "inbound" : "outbound");
-       
+
        if (!zstr(caller_profile->username)) {
                switch_snprintf(header_name, sizeof(header_name), "%s-Username", prefix);
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->username);
@@ -403,7 +403,7 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_
                }
 
        }
-       
+
        if (!(times = caller_profile->times)) {
                times = caller_profile->old_times;
        }
@@ -546,11 +546,11 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session
 
 
                if (caller_application->application_data && strstr(caller_application->application_data, "\\'")) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "App not added, Invalid character sequence in data string [%s]\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "App not added, Invalid character sequence in data string [%s]\n",
                                                          caller_application->application_data);
                        return;
                }
-               
+
                if (!caller_extension->applications) {
                        caller_extension->applications = caller_application;
                } else if (caller_extension->last_application) {
index 1fa9fcfa509879ab400fc81a64c6f7993ee7b00e..8086944190277c31bce085cdd17773d38b97e3e2 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  *
@@ -267,20 +267,20 @@ static struct switch_device_state_table DEVICE_STATE_CHART[] = {
 };
 
 
-SWITCH_DECLARE(void) switch_channel_perform_set_callstate(switch_channel_t *channel, switch_channel_callstate_t callstate, 
+SWITCH_DECLARE(void) switch_channel_perform_set_callstate(switch_channel_t *channel, switch_channel_callstate_t callstate,
                                                                                                                  const char *file, const char *func, int line)
 {
        switch_event_t *event;
        switch_channel_callstate_t o_callstate = channel->callstate;
 
        if (o_callstate == callstate || o_callstate == CCS_HANGUP) return;
-       
+
        channel->callstate = callstate;
        if (channel->device_node) {
                channel->device_node->callstate = callstate;
        }
        switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_DEBUG,
-                                         "(%s) Callstate Change %s -> %s\n", channel->name, 
+                                         "(%s) Callstate Change %s -> %s\n", channel->name,
                                          switch_channel_callstate2str(o_callstate), switch_channel_callstate2str(callstate));
 
        switch_channel_check_device_state(channel, channel->callstate);
@@ -461,17 +461,17 @@ SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel,
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_lock(switch_channel_t *channel) 
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_lock(switch_channel_t *channel)
 {
        return switch_mutex_lock(channel->dtmf_mutex);
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_try_dtmf_lock(switch_channel_t *channel) 
+SWITCH_DECLARE(switch_status_t) switch_channel_try_dtmf_lock(switch_channel_t *channel)
 {
        return switch_mutex_trylock(channel->dtmf_mutex);
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *channel) 
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *channel)
 {
        return switch_mutex_unlock(channel->dtmf_mutex);
 }
@@ -524,13 +524,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *chan
                                switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s SHORT DTMF DIGIT LEN [%d]\n",
                                                                  switch_channel_get_name(channel), new_dtmf.duration);
                                new_dtmf.duration = switch_core_min_dtmf_duration(0);
-                       } 
+                       }
                }
-               
+
                if (!new_dtmf.duration) {
                        new_dtmf.duration = switch_core_default_dtmf_duration(0);
                }
-               
+
 
                switch_zmalloc(dt, sizeof(*dt));
                *dt = new_dtmf;
@@ -815,9 +815,9 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
                                }
                        }
                }
-               
+
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-info-state", call_info_state);
-               
+
                if (call_info) {
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-info", call_info);
                }
@@ -845,7 +845,7 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_
        if (!!on == !!switch_channel_test_flag(channel, CF_LEG_HOLDING)) {
                goto end;
        }
-       
+
        if (on) {
                switch_channel_set_flag(channel, CF_LEG_HOLDING);
        } else {
@@ -881,7 +881,7 @@ SWITCH_DECLARE(const char *) switch_channel_get_hold_music(switch_channel_t *cha
 
        if (!zstr(var)) {
                char *expanded = switch_channel_expand_variables(channel, var);
-               
+
                if (expanded != var) {
                        var = switch_core_session_strdup(channel->session, expanded);
                        free(expanded);
@@ -920,7 +920,7 @@ SWITCH_DECLARE(void) switch_channel_set_scope_variables(switch_channel_t *channe
        }
 
        switch_mutex_unlock(channel->profile_mutex);
-       
+
 }
 
 SWITCH_DECLARE(switch_status_t) switch_channel_get_scope_variables(switch_channel_t *channel, switch_event_t **event)
@@ -1179,7 +1179,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t
        } else {
                profile_node_t *pn, *n = switch_core_alloc(channel->caller_profile->pool, sizeof(*n));
                int var_found;
-               
+
                n->var = switch_core_strdup(channel->caller_profile->pool, name);
                n->val = v;
 
@@ -1187,7 +1187,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t
                        channel->caller_profile->soft = n;
                } else {
                        var_found = 0;
-                       
+
                        for(pn = channel->caller_profile->soft; pn ; pn = pn->next) {
                                if (!strcasecmp(pn->var,n->var)) {
                                        pn->val = n->val;
@@ -1199,7 +1199,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t
                                        break;
                                }
                        }
-                       
+
                        if (pn && !pn->next && !var_found) {
                                pn->next = n;
                        }
@@ -1211,7 +1211,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t
 }
 
 
-SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel, 
+SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel,
                                                                                                   switch_event_t *var_event, const char *export_varname)
 {
 
@@ -1227,14 +1227,14 @@ SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, sw
                switch_event_del_header(var_event, export_varname);
                switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, export_varname, export_vars);
        }
-       
+
        if (peer_channel) {
                switch_channel_set_variable(peer_channel, export_varname, export_vars);
        }
 
        if ((argc = switch_separate_string(cptmp, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
                int x;
-               
+
                for (x = 0; x < argc; x++) {
                        const char *vval;
                        if ((vval = switch_channel_get_variable(channel, argv[x]))) {
@@ -1247,16 +1247,16 @@ SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, sw
                                if (var_event) {
                                        switch_event_del_header(var_event, vvar);
                                        switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, vvar, vval);
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG, 
-                                                                         "%s EXPORTING[%s] [%s]=[%s] to event\n", 
-                                                                         switch_channel_get_name(channel), 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG,
+                                                                         "%s EXPORTING[%s] [%s]=[%s] to event\n",
+                                                                         switch_channel_get_name(channel),
                                                                          export_varname,
                                                                          vvar, vval);
                                }
                                if (peer_channel) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG, 
-                                                                         "%s EXPORTING[%s] [%s]=[%s] to %s\n", 
-                                                                         switch_channel_get_name(channel), 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG,
+                                                                         "%s EXPORTING[%s] [%s]=[%s] to %s\n",
+                                                                         switch_channel_get_name(channel),
                                                                          export_varname,
                                                                          vvar, vval, switch_channel_get_name(peer_channel));
                                        switch_channel_set_variable(peer_channel, vvar, vval);
@@ -1268,8 +1268,8 @@ SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, sw
 
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, 
-                                                                                                                                                const char *varname, const char *val, 
+SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel,
+                                                                                                                                                const char *varname, const char *val,
                                                                                                                                                 const char *export_varname, switch_bool_t var_check)
 {
        char *var_name = NULL;
@@ -1293,11 +1293,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_
                }
        }
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG, "EXPORT (%s) %s[%s]=[%s]\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG, "EXPORT (%s) %s[%s]=[%s]\n",
                                          export_varname, local ? "" : "(REMOTE ONLY) ",
                                          var_name ? var_name : "", val ? val : "UNDEF");
 
-       
+
        switch_channel_set_variable_var_check(channel, var, val, var_check);
 
        if (var && val) {
@@ -1316,28 +1316,28 @@ SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, 
+SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname,
                                                                                                                                          const char *export_varname, const char *fmt, ...)
 {
        switch_status_t status = SWITCH_STATUS_FALSE;
        char *data = NULL;
        va_list ap;
        int ret;
-       
+
        switch_assert(channel != NULL);
-       
+
        va_start(ap, fmt);
        ret = switch_vasprintf(&data, fmt, ap);
        va_end(ap);
-       
+
        if (ret == -1) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        status = switch_channel_export_variable(channel, varname, data, export_varname);
-       
+
        free(data);
-       
+
        return status;
 }
 
@@ -1380,7 +1380,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_transfer_variable_prefix(switch_c
                }
                switch_channel_variable_last(orig_channel);
        }
-       
+
        return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
 }
 
@@ -1390,25 +1390,25 @@ SWITCH_DECLARE(void) switch_channel_set_presence_data_vals(switch_channel_t *cha
        char header_name[128] = "";
        int col_count = 0, i = 0;
        char *data_copy = NULL;
-       
+
        if (zstr(presence_data_cols)) {
                presence_data_cols = switch_channel_get_variable_dup(channel, "presence_data_cols", SWITCH_FALSE, -1);
                if (zstr(presence_data_cols)) {
                        return;
                }
        }
-       
+
        data_copy = strdup(presence_data_cols);
-       
+
        col_count = switch_split(data_copy, ':', cols);
-       
+
        for (i = 0; i < col_count; i++) {
                const char *val = NULL;
                switch_snprintf(header_name, sizeof(header_name), "PD-%s", cols[i]);
                val = switch_channel_get_variable(channel, cols[i]);
                switch_channel_set_profile_var(channel, header_name, val);
        }
-       
+
        switch_safe_free(data_copy);
 }
 
@@ -1630,7 +1630,7 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, sw
 {
 
        switch_assert(channel);
-       
+
        for (;;) {
                if ((channel->state < CS_HANGUP && channel->state == channel->running_state && channel->running_state == want_state) ||
                        (other_channel && switch_channel_down_nosig(other_channel)) || switch_channel_down(channel)) {
@@ -1850,7 +1850,7 @@ SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, sw
                if (brto) {
                        hr->uuid = switch_core_session_strdup(channel->session, brto);
                }
-                                                                                                                                                                                       
+
                if (channel->hold_record) {
                        hr->next = channel->hold_record;
                }
@@ -1870,7 +1870,7 @@ SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, sw
        if (flag == CF_VIDEO_ECHO || flag == CF_VIDEO_BLANK || flag == CF_VIDEO_DECODED_READ || flag == CF_VIDEO_PASSIVE) {
                switch_core_session_start_video_thread(channel->session);
        }
-       
+
        if (flag == CF_VIDEO_DECODED_READ && channel->flags[CF_VIDEO]) {
                switch_core_session_request_video_refresh(channel->session);
        }
@@ -1929,7 +1929,7 @@ SWITCH_DECLARE(void) switch_channel_set_app_flag_key(const char *key, switch_cha
                switch_core_hash_init(&channel->app_flag_hash);
                new++;
        }
-       
+
        if (new || !(flagp = switch_core_hash_find(channel->app_flag_hash, key))) {
                flagp = switch_core_session_alloc(channel->session, sizeof(uint32_t));
                switch_core_hash_insert(channel->app_flag_hash, key, flagp);
@@ -1944,7 +1944,7 @@ SWITCH_DECLARE(void) switch_channel_set_app_flag_key(const char *key, switch_cha
 SWITCH_DECLARE(void) switch_channel_clear_app_flag_key(const char *key, switch_channel_t *channel, uint32_t flags)
 {
        uint32_t *flagp = NULL;
-       
+
        switch_assert(channel != NULL);
        switch_mutex_lock(channel->flag_mutex);
        if (channel->app_flag_hash && (flagp = switch_core_hash_find(channel->app_flag_hash, key))) {
@@ -1968,7 +1968,7 @@ SWITCH_DECLARE(int) switch_channel_test_app_flag_key(const char *key, switch_cha
                r = (*flagp & flags);
        }
        switch_mutex_unlock(channel->flag_mutex);
-       
+
 
        return r;
 }
@@ -2102,7 +2102,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_running_state(switch_c
        return state;
 }
 
-SWITCH_DECLARE(int) switch_channel_state_change_pending(switch_channel_t *channel) 
+SWITCH_DECLARE(int) switch_channel_state_change_pending(switch_channel_t *channel)
 {
        if (switch_channel_down_nosig(channel) || !switch_core_session_in_thread(channel->session)) {
                return 0;
@@ -2129,7 +2129,7 @@ SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_
                ret = ((switch_channel_test_flag(channel, CF_ANSWERED) ||
                                switch_channel_test_flag(channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(channel, CF_PROXY_MODE) &&
                           switch_core_session_get_read_codec(channel->session) && switch_core_session_get_write_codec(channel->session));
-                          
+
 
                if (!ret)
                        return ret;
@@ -2141,7 +2141,7 @@ SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_
        ret = 0;
 
        if (!channel->hangup_cause && channel->state > CS_ROUTING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
-               !switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_NOT_READY) && 
+               !switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_NOT_READY) &&
                !switch_channel_state_change_pending(channel)) {
                ret++;
        }
@@ -2231,7 +2231,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
        switch_mutex_unlock(channel->flag_mutex);
 
        switch_channel_clear_flag(channel, CF_TAGGED);
-       
+
 
        switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_DEBUG, "(%s) Running State Change %s (Cur %d Tot %" SWITCH_SIZE_T_FMT ")\n",
                                          channel->name, state_names[state], switch_core_session_count(), switch_core_session_id() - 1);
@@ -2530,7 +2530,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann
        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Call-Direction",
                                                                   channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound");
 
-       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-HIT-Dialplan", 
+       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-HIT-Dialplan",
                                                                   switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND ||
                                                                   switch_channel_test_flag(channel, CF_DIALPLAN) ? "true" : "false");
 
@@ -2613,7 +2613,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *ch
 
        switch_core_session_ctl(SCSC_VERBOSE_EVENTS, &global_verbose_events);
 
-       if (global_verbose_events || 
+       if (global_verbose_events ||
                switch_channel_test_flag(channel, CF_VERBOSE_EVENTS) ||
                switch_event_get_header(event, "presence-data-cols") ||
                event->event_id == SWITCH_EVENT_CHANNEL_CREATE ||
@@ -2636,7 +2636,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *ch
                event->event_id == SWITCH_EVENT_SESSION_HEARTBEAT ||
                event->event_id == SWITCH_EVENT_API ||
                event->event_id == SWITCH_EVENT_RECORD_START ||
-               event->event_id == SWITCH_EVENT_RECORD_STOP || 
+               event->event_id == SWITCH_EVENT_RECORD_STOP ||
                event->event_id == SWITCH_EVENT_PLAYBACK_START ||
                event->event_id == SWITCH_EVENT_PLAYBACK_STOP ||
                event->event_id == SWITCH_EVENT_CALL_UPDATE || 
@@ -2656,13 +2656,13 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *ch
                                for (hi = ep->headers; hi; hi = hi->next) {
                                        char buf[1024];
                                        char *vvar = NULL, *vval = NULL;
-                                       
+
                                        vvar = (char *) hi->name;
                                        vval = (char *) hi->value;
-                                               
+
                                        switch_assert(vvar && vval);
                                        switch_snprintf(buf, sizeof(buf), "scope_variable_%s", vvar);
-                                       
+
                                        if (!switch_event_get_header(event, buf)) {
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, vval);
                                        }
@@ -2677,7 +2677,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *ch
 
                                vvar = (char *) hi->name;
                                vval = (char *) hi->value;
-                               
+
                                switch_assert(vvar && vval);
                                switch_snprintf(buf, sizeof(buf), "variable_%s", vvar);
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, vval);
@@ -2705,7 +2705,7 @@ SWITCH_DECLARE(void) switch_channel_step_caller_profile(switch_channel_t *channe
        switch_mutex_lock(channel->profile_mutex);
        cp = switch_caller_profile_clone(channel->session, channel->caller_profile);
        switch_mutex_unlock(channel->profile_mutex);
-       
+
        switch_channel_set_caller_profile(channel, cp);
 }
 
@@ -2859,7 +2859,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_p
        switch_assert(channel != NULL);
 
        switch_mutex_lock(channel->profile_mutex);
-       
+
        if (channel->caller_profile) {
                profile = channel->caller_profile->originator_caller_profile;
        }
@@ -2976,12 +2976,12 @@ SWITCH_DECLARE(void) switch_channel_restart(switch_channel_t *channel)
        switch_channel_set_state(channel, CS_EXECUTE);
 }
 
-/* XXX This is a somewhat simple operation.  Were essentially taking the extension that one channel 
-   was executing and generating a new extension for another channel that starts out where the 
-   original one left off with an optional forward offset.  Since all we are really doing is 
-   copying a few basic pool-allocated structures from one channel to another there really is 
-   not much to worry about here in terms of threading since we use read-write locks. 
-   While the features are nice, they only really are needed in one specific crazy attended 
+/* XXX This is a somewhat simple operation.  Were essentially taking the extension that one channel
+   was executing and generating a new extension for another channel that starts out where the
+   original one left off with an optional forward offset.  Since all we are really doing is
+   copying a few basic pool-allocated structures from one channel to another there really is
+   not much to worry about here in terms of threading since we use read-write locks.
+   While the features are nice, they only really are needed in one specific crazy attended
    transfer scenario where one channel was in the middle of calling a particular extension
    when it was rudely cut off by a transfer key press. XXX */
 
@@ -3068,7 +3068,7 @@ SWITCH_DECLARE(void) switch_channel_invert_cid(switch_channel_t *channel)
 
        cp->caller_id_name = cp->callee_id_name;
        cp->caller_id_number = cp->callee_id_number;
-       
+
        cp->callee_id_name = tname;
        cp->callee_id_number = tnum;
 
@@ -3099,7 +3099,7 @@ SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel)
        } else if (tmp) {
                channel->caller_profile->callee_id_name = tmp;
        }
-       
+
        if (channel->caller_profile->callee_id_number) {
                tmp = channel->caller_profile->caller_id_number;
                switch_channel_set_variable(channel, "pre_transfer_caller_id_number", channel->caller_profile->caller_id_number);
@@ -3127,7 +3127,7 @@ SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel)
        }
 
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, "%s Flipping CID from \"%s\" <%s> to \"%s\" <%s>\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, "%s Flipping CID from \"%s\" <%s> to \"%s\" <%s>\n",
                                          switch_channel_get_name(channel),
                                          switch_str_nil(switch_channel_get_variable(channel, "pre_transfer_caller_id_name")),
                                          switch_str_nil(switch_channel_get_variable(channel, "pre_transfer_caller_id_number")),
@@ -3168,7 +3168,7 @@ SWITCH_DECLARE(void) switch_channel_transfer_to_extension(switch_channel_t *chan
        switch_mutex_unlock(channel->profile_mutex);
 
        switch_channel_set_flag(channel, CF_TRANSFER);
-       switch_channel_set_state(channel, CS_ROUTING);  
+       switch_channel_set_state(channel, CS_ROUTING);
 }
 
 SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension)
@@ -3176,7 +3176,7 @@ SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *chann
        switch_assert(channel != NULL);
 
        switch_channel_sort_cid(channel);
-       
+
        switch_mutex_lock(channel->profile_mutex);
        caller_extension->next = channel->caller_profile->caller_extension;
        channel->caller_profile->caller_extension = caller_extension;
@@ -3306,7 +3306,7 @@ static switch_status_t send_ind(switch_channel_t *channel, switch_core_session_m
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(switch_channel_t *channel, 
+SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(switch_channel_t *channel,
                                                                                                                                                         switch_ring_ready_t rv,
                                                                                                                                                         const char *file, const char *func, int line)
 {
@@ -3362,18 +3362,18 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel)
                switch_core_session_t *other_session;
                switch_channel_t *other_channel;
                int doit = 1;
-               
+
                if (switch_core_session_get_partner(channel->session, &other_session) == SWITCH_STATUS_SUCCESS) {
                        other_channel = switch_core_session_get_channel(other_session);
 
                        if (switch_channel_test_flag(other_channel, CF_ZRTP_HASH) && !switch_channel_test_flag(other_channel, CF_ZRTP_PASSTHRU)) {
-                               
+
                                switch_channel_set_flag(channel, CF_ZRTP_PASSTHRU);
                                switch_channel_set_flag(other_channel, CF_ZRTP_PASSTHRU);
-                       
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, 
+
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO,
                                                                  "%s Activating ZRTP passthru mode.\n", switch_channel_get_name(channel));
-       
+
                                switch_channel_set_variable(channel, "zrtp_passthru_active", "true");
                                switch_channel_set_variable(other_channel, "zrtp_passthru_active", "true");
                                switch_channel_set_variable(channel, "zrtp_secure_media", "false");
@@ -3387,20 +3387,20 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel)
                if (doit) {
                        switch_channel_set_variable(channel, "zrtp_passthru_active", "false");
                        switch_channel_set_variable(channel, "zrtp_secure_media", "true");
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO,
                                                          "%s ZRTP not negotiated on both sides; disabling ZRTP passthru mode.\n", switch_channel_get_name(channel));
 
                        switch_channel_clear_flag(channel, CF_ZRTP_PASSTHRU);
                        switch_channel_clear_flag(channel, CF_ZRTP_HASH);
 
                        if (switch_core_session_get_partner(channel->session, &other_session) == SWITCH_STATUS_SUCCESS) {
-                               other_channel = switch_core_session_get_channel(other_session);  
+                               other_channel = switch_core_session_get_channel(other_session);
 
                                switch_channel_set_variable(other_channel, "zrtp_passthru_active", "false");
                                switch_channel_set_variable(other_channel, "zrtp_secure_media", "true");
                                switch_channel_clear_flag(other_channel, CF_ZRTP_PASSTHRU);
                                switch_channel_clear_flag(other_channel, CF_ZRTP_HASH);
-                               
+
                                switch_core_session_rwunlock(other_session);
                        }
 
@@ -3421,13 +3421,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
                switch_channel_check_zrtp(channel);
                switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
                switch_channel_set_flag(channel, CF_EARLY_MEDIA);
-               
+
                switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA");
 
                if (switch_true(switch_channel_get_variable(channel, "video_mirror_input"))) {
                        switch_channel_set_flag(channel, CF_VIDEO_MIRROR_INPUT);
                }
-               
+
                if (channel->caller_profile && channel->caller_profile->times) {
                        switch_mutex_lock(channel->profile_mutex);
                        channel->caller_profile->times->progress_media = switch_micro_time_now();
@@ -3462,7 +3462,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
                }
 
 
-               /* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send 
+               /* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send
                   a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel
                 */
                if ((uuid = switch_channel_get_variable(channel, SWITCH_ORIGINATOR_VARIABLE))
@@ -3518,7 +3518,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel
        return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready_value(switch_channel_t *channel, switch_ring_ready_t rv, 
+SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready_value(switch_channel_t *channel, switch_ring_ready_t rv,
                                                                                                                                                const char *file, const char *func, int line)
 {
        switch_core_session_message_t msg = { 0 };
@@ -3558,15 +3558,15 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready_value(switch_c
 static void do_api_on(switch_channel_t *channel, const char *variable)
 {
        char *app;
-       char *arg = NULL;       
+       char *arg = NULL;
        switch_stream_handle_t stream = { 0 };
 
        app = switch_core_session_strdup(channel->session, variable);
-       
+
        if ((arg = strchr(app, ' '))) {
                *arg++ = '\0';
        }
-       
+
        SWITCH_STANDARD_STREAM(stream);
        switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s process %s: %s(%s)\n%s\n",
                                          channel->name, variable, app, switch_str_nil(arg), (char *) stream.data);
@@ -3581,9 +3581,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_api_on(switch_channel_t *channel,
        switch_event_t *event;
        int x = 0;
 
-                                                               
+
        switch_channel_get_variables(channel, &event);
-       
+
        for (hp = event->headers; hp; hp = hp->next) {
                char *var = hp->name;
                char *val = hp->value;
@@ -3593,7 +3593,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_api_on(switch_channel_t *channel,
                                int i;
                                for (i = 0; i < hp->idx; i++) {
                                        x++;
-                                       do_api_on(channel, hp->array[i]);                                       
+                                       do_api_on(channel, hp->array[i]);
                                }
                        } else {
                                x++;
@@ -3601,7 +3601,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_api_on(switch_channel_t *channel,
                        }
                }
        }
-       
+
        switch_event_destroy(&event);
 
        return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
@@ -3626,11 +3626,11 @@ static void do_execute_on(switch_channel_t *channel, const char *variable)
                        break;
                }
        }
-       
+
        if (!strncasecmp(app, "perl", 4)) {
                bg++;
        }
-       
+
        if (bg) {
                switch_core_session_execute_application_async(channel->session, app, arg);
        } else {
@@ -3647,7 +3647,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *chan
        switch_core_get_variables(&event);
        switch_channel_get_variables(channel, &cevent);
        switch_event_merge(event, cevent);
-       
+
        for (hp = event->headers; hp; hp = hp->next) {
                char *var = hp->name;
                char *val = hp->value;
@@ -3657,7 +3657,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *chan
                                int i;
                                for (i = 0; i < hp->idx; i++) {
                                        x++;
-                                       do_execute_on(channel, hp->array[i]);                                   
+                                       do_execute_on(channel, hp->array[i]);
                                }
                        } else {
                                x++;
@@ -3665,7 +3665,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *chan
                        }
                }
        }
-       
+
        switch_event_destroy(&event);
        switch_event_destroy(&cevent);
 
@@ -3704,14 +3704,14 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
                switch_channel_set_flag(channel, CF_VIDEO_MIRROR_INPUT);
                //switch_channel_set_flag(channel, CF_VIDEO_DECODED_READ);
        }
-       
+
 
        if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_ANSWER) == SWITCH_STATUS_SUCCESS) {
                switch_channel_event_set_data(channel, event);
                switch_event_fire(&event);
        }
 
-       /* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send 
+       /* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send
           a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel
         */
        if ((uuid = switch_channel_get_variable(channel, SWITCH_ORIGINATOR_VARIABLE))
@@ -3748,7 +3748,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
 
 
        if (switch_channel_get_variable(channel, "absolute_codec_string")) {
-               /* inherit_codec == true will implicitly clear the absolute_codec_string 
+               /* inherit_codec == true will implicitly clear the absolute_codec_string
                   variable if used since it was the reason it was set in the first place and is no longer needed */
                if (switch_true(switch_channel_get_variable(channel, "inherit_codec"))) {
                        switch_channel_set_variable(channel, "absolute_codec_string", NULL);
@@ -3773,7 +3773,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
        switch_channel_set_callstate(channel, CCS_ACTIVE);
 
        send_ind(channel, SWITCH_MESSAGE_ANSWER_EVENT, file, func, line);
-       
+
        switch_core_media_check_autoadj(channel->session);
 
        if (switch_channel_test_flag(channel, CF_RTT)) {
@@ -3817,13 +3817,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *
        }
 
 
-       if (switch_core_session_in_thread(channel->session) && !switch_channel_test_flag(channel, CF_PROXY_MODE) && 
+       if (switch_core_session_in_thread(channel->session) && !switch_channel_test_flag(channel, CF_PROXY_MODE) &&
                !switch_channel_test_flag(channel, CF_HAS_TEXT)) {
                const char *delay;
 
                if ((delay = switch_channel_get_variable(channel, "answer_delay"))) {
                        uint32_t msec = atoi(delay);
-                       
+
                        if (msec) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG, "Answer delay for %u msec\n", msec);
                                switch_ivr_sleep(channel->session, msec, SWITCH_TRUE, NULL);
@@ -4003,7 +4003,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
                                        int ooffset = 0;
                                        char *ptr;
                                        int idx = -1;
-                                       
+
                                        if ((expanded = switch_channel_expand_variables_check(channel, (char *) vname, var_list, api_list, recur+1)) == vname) {
                                                expanded = NULL;
                                        } else {
@@ -4023,7 +4023,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
                                                *ptr++ = '\0';
                                                idx = atoi(ptr);
                                        }
-                                       
+
                                        if ((sub_val = (char *) switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx))) {
                                                if (var_list && !switch_event_check_permission_list(var_list, vname)) {
                                                        sub_val = "<Variable Expansion Permission Denied>";
@@ -4034,7 +4034,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
                                                } else {
                                                        sub_val = expanded_sub_val;
                                                }
-                                               
+
                                                if (offset || ooffset) {
                                                        cloned_sub_val = strdup(sub_val);
                                                        switch_assert(cloned_sub_val);
@@ -4067,7 +4067,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
 
                                        if (stream.data) {
                                                char *expanded_vname = NULL;
-                                               
+
                                                if ((expanded_vname = switch_channel_expand_variables_check(channel, (char *) vname, var_list, api_list, recur+1)) == vname) {
                                                        expanded_vname = NULL;
                                                } else {
@@ -4185,7 +4185,7 @@ SWITCH_DECLARE(char *) switch_channel_build_param_string(switch_channel_t *chann
        prof[9] = caller_profile->chan_name;
        prof[10] = caller_profile->uuid;
        prof[11] = caller_profile->transfer_source;
-       
+
        prof_names[0] = "context";
        prof_names[1] = "destination_number";
        prof_names[2] = "caller_id_name";
@@ -4206,7 +4206,7 @@ SWITCH_DECLARE(char *) switch_channel_build_param_string(switch_channel_t *chann
                new_len = (strlen(prof[x]) * 3) + 1;
                if (encode_len < new_len) {
                        char *tmp;
-                       
+
                        encode_len = new_len;
 
                        if (!(tmp = realloc(encode_buf, encode_len))) {
@@ -4329,7 +4329,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
        switch_caller_profile_t *caller_profile;
        switch_app_log_t *app_log, *ap;
        char *last_app = NULL, *last_arg = NULL;
-       char start[80] = "", resurrect[80] = "", answer[80] = "", hold[80], 
+       char start[80] = "", resurrect[80] = "", answer[80] = "", hold[80],
                bridge[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "",
                profile_start[80] =     "";
        int32_t duration = 0, legbillsec = 0, billsec = 0, mduration = 0, billmsec = 0, legbillmsec = 0, progressmsec = 0, progress_mediamsec = 0;
@@ -4397,7 +4397,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
                                const char *replace = NULL;
 
                                X = malloc(len);
-                               
+
                                for (i = 0; i < proceed; i++) {
                                        if (pcre_get_substring(dtstr, ovector, proceed, i, &replace) > 0) {
                                                switch_size_t plen = strlen(replace);
@@ -4406,11 +4406,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
 
                                                switch_safe_free(substituted);
                                                substituted = switch_string_replace(substituted ? substituted : dtstr, replace, X);
-                                               
+
                                                pcre_free_substring(replace);
                                        }
                                }
-                               
+
                                if (!zstr(substituted)) {
                                        digit_string = substituted;
                                }
@@ -4705,12 +4705,12 @@ SWITCH_DECLARE(void) switch_channel_handle_cause(switch_channel_t *channel, swit
        switch_split(tof_data, ' ', tof_array);
        transfer_on_fail = tof_array[0];
 
-       /* 
+       /*
           if the variable continue_on_fail is set it can be:
           'true' to continue on all failures.
           'false' to not continue.
           A list of codes either names or numbers eg "user_busy,normal_temporary_failure,603"
-          failure_causes acts as the opposite version  
+          failure_causes acts as the opposite version
           EXCEPTION... ATTENDED_TRANSFER never is a reason to continue.......
        */
        if (cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
@@ -4769,7 +4769,7 @@ SWITCH_DECLARE(void) switch_channel_handle_cause(switch_channel_t *channel, swit
                                return;
                        }
                }
-                       
+
                if (transfer_on_fail || failure_causes) {
                        const char *cause_str;
                        char cause_num[35] = "";
@@ -4796,7 +4796,7 @@ SWITCH_DECLARE(void) switch_channel_handle_cause(switch_channel_t *channel, swit
                                if (!x) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                          "Failure causes [%s]:  Cause: %s\n", failure_causes, cause_str);
-                                                                                 
+
                                        switch_ivr_session_transfer(session, tof_array[1], tof_array[2], tof_array[3]);
                                }
                        }
@@ -4819,11 +4819,11 @@ SWITCH_DECLARE(void) switch_channel_handle_cause(switch_channel_t *channel, swit
                                        }
                                }
                        }
-               } 
+               }
        }
 
 
-       if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_CONFIRM_BLIND_TRANSFER) && 
+       if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_CONFIRM_BLIND_TRANSFER) &&
                switch_channel_get_state(channel) != CS_ROUTING) {
                switch_channel_hangup(channel, cause);
        }
@@ -4850,7 +4850,7 @@ static void fetch_device_stats(switch_device_record_t *drec)
 
 
        memset(&drec->stats, 0, sizeof(switch_device_stats_t));
-       
+
        switch_mutex_lock(drec->mutex);
        for(np = drec->uuid_list; np; np = np->next) {
                drec->stats.total++;
@@ -4859,7 +4859,7 @@ static void fetch_device_stats(switch_device_record_t *drec)
                } else {
                        drec->stats.total_out++;
                }
-               
+
                if (!np->hup_profile) {
                        drec->stats.offhook++;
                        if (np->direction == SWITCH_CALL_DIRECTION_INBOUND) {
@@ -4943,7 +4943,7 @@ SWITCH_DECLARE(void) switch_channel_clear_device_record(switch_channel_t *channe
                switch_yield(100000);
        }
 
-       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Destroying device cdr %s on device [%s]\n", 
+       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Destroying device cdr %s on device [%s]\n",
                                          channel->device_node->parent->uuid,
                                          channel->device_node->parent->device_id);
 
@@ -4978,14 +4978,14 @@ SWITCH_DECLARE(void) switch_channel_clear_device_record(switch_channel_t *channe
        pool = channel->device_node->parent->pool;
 
        switch_mutex_lock(globals.device_mutex);
-       switch_core_destroy_memory_pool(&pool);         
+       switch_core_destroy_memory_pool(&pool);
 
        switch_mutex_unlock(globals.device_mutex);
-       
-       
+
+
 }
 
-SWITCH_DECLARE(void) switch_channel_process_device_hangup(switch_channel_t *channel) 
+SWITCH_DECLARE(void) switch_channel_process_device_hangup(switch_channel_t *channel)
 {
 
        switch_channel_check_device_state(channel, channel->callstate);
@@ -5002,7 +5002,7 @@ static void process_device_hup(switch_channel_t *channel)
        if (!channel->device_node) {
                return;
        }
-       
+
        switch_mutex_lock(globals.device_mutex);
        node = channel->device_node;
        drec = channel->device_node->parent;
@@ -5031,12 +5031,12 @@ static void process_device_hup(switch_channel_t *channel)
                }
 
                last = newhr;
-       }       
+       }
 
        if (!drec->stats.offhook) { /* this is final call */
 
                switch_core_hash_delete(globals.device_hash, drec->device_id);
-               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Processing last call from device [%s]\n", 
+               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Processing last call from device [%s]\n",
                                                  drec->device_id);
                switch_channel_set_flag(channel, CF_FINAL_DEVICE_LEG);
        } else {
@@ -5046,7 +5046,7 @@ static void process_device_hup(switch_channel_t *channel)
        drec->refs--;
 
        switch_mutex_unlock(globals.device_mutex);
-       
+
 }
 
 static void switch_channel_check_device_state(switch_channel_t *channel, switch_channel_callstate_t callstate)
@@ -5157,9 +5157,9 @@ static void switch_channel_check_device_state(switch_channel_t *channel, switch_
                }
        }
 
-       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, 
+       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1,
                                          "%s device: %s\nState: %s Dev State: %s/%s Total:%u Offhook:%u "
-                                         "Ringing:%u Early:%u Active:%u Held:%u Unheld:%u Hungup:%u Dur: %u Ringtime: %u Holdtime: %u %s\n", 
+                                         "Ringing:%u Early:%u Active:%u Held:%u Unheld:%u Hungup:%u Dur: %u Ringtime: %u Holdtime: %u %s\n",
                                          switch_channel_get_name(channel),
                                          drec->device_id,
                                          switch_channel_callstate2str(callstate),
@@ -5211,7 +5211,7 @@ static void switch_channel_check_device_state(switch_channel_t *channel, switch_
 
        switch_mutex_unlock(drec->mutex);
        switch_mutex_unlock(globals.device_mutex);
-       
+
 
        if (event) {
                switch_event_fire(&event);
@@ -5284,13 +5284,13 @@ SWITCH_DECLARE(const char *) switch_channel_set_device_id(switch_channel_t *chan
        }
 
        add_uuid(drec, channel);
-       
+
        switch_mutex_unlock(globals.device_mutex);
 
        switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Setting DEVICE ID to [%s]\n", device_id);
-       
+
        switch_channel_check_device_state(channel, channel->callstate);
-       
+
        return device_id;
 }
 
index 476f4560ce18f624a0ec5098a0e60b3a8120b297..23510ecf5ece1948ac80279b30f28d6bc9a0b97d 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
index 3f953b80860037bf7eab513af18811c2bb51dadd..876b77434e46fadd3d21d4475f30e3034b8028a6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -247,7 +247,7 @@ SWITCH_DECLARE(char *) switch_console_expand_alias(char *cmd, char *arg)
        switch_core_flag_t cflags = switch_core_flags();
        int full = 0;
 
-       
+
        if (!(cflags & SCF_USE_SQL)) {
                return NULL;
        }
@@ -502,7 +502,7 @@ static int comp_callback(void *pArg, int argc, char **argv, char **columnNames)
                        char *s_argv[100] = { 0 };
                        char *r_argv[1] = { 0 }, *r_cols[1] = {0};
                        list = strdup(p);
-                       
+
                        argc = switch_separate_string(list, ':', s_argv, (sizeof(s_argv) / sizeof(s_argv[0])));
 
                        for (i = 0; (int)i < argc; i++) {
@@ -859,7 +859,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch
                }
 
                stream.write_function(&stream, " and hostname='%s' order by a%d", switch_core_get_hostname(), h.words + 1);
-               
+
                switch_cache_db_execute_sql_callback(db, stream.data, comp_callback, &h, &errmsg);
 
                if (errmsg) {
@@ -1848,7 +1848,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
                if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
                        switch_stream_handle_t mystream = { 0 };
                        SWITCH_STANDARD_STREAM(mystream);
-                       
+
                        if (!strcasecmp(argv[0], "stickyadd")) {
                                mystream.write_function(&mystream, "insert into complete values (1,");
                                for (x = 0; x < 10; x++) {
@@ -1885,8 +1885,8 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
                        } else if (!strcasecmp(argv[0], "del")) {
                                char *what = argv[1];
                                if (zstr(what)) {
-                                       switch_safe_free(mystream.data);  
-                                       switch_safe_free(mydata); 
+                                       switch_safe_free(mystream.data);
+                                       switch_safe_free(mydata);
                                        return SWITCH_STATUS_FALSE;
                                } else if (!strcasecmp(what, "*")) {
                                        mystream.write_function(&mystream, "delete from complete where hostname='%q'", switch_core_get_hostname());
@@ -1938,7 +1938,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_alias(const char *string)
                                free(mydata);
                                return SWITCH_STATUS_FALSE;
                        }
-                       
+
                        if (!strcasecmp(argv[0], "stickyadd") && argc == 3) {
                                sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_switchname());
                                switch_cache_db_persistant_execute(db, sql, 5);
index 606ccb59be794a103e48bcdf5257c2e77946b041..185a2f11a526f6db4c70f031bf00ea3af5768978 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -359,7 +359,7 @@ SWITCH_DECLARE(char *) switch_core_get_domain(switch_bool_t dup)
        char *domain;
        const char *var;
 
-       switch_thread_rwlock_rdlock(runtime.global_var_rwlock);  
+       switch_thread_rwlock_rdlock(runtime.global_var_rwlock);
        if (!(var = switch_core_get_variable("domain"))) {
                var = "freeswitch.local";
        }
@@ -556,7 +556,7 @@ SWITCH_DECLARE(void) switch_core_thread_session_end(switch_core_session_t *sessi
        switch_channel_clear_flag(channel, CF_SERVICE_VIDEO);
 
        switch_core_session_kill_channel(session, SWITCH_SIG_BREAK);
-       
+
 }
 
 SWITCH_DECLARE(void) switch_core_service_session_av(switch_core_session_t *session, switch_bool_t audio, switch_bool_t video)
@@ -900,7 +900,7 @@ SWITCH_DECLARE(int32_t) switch_core_set_process_privileges(void)
 {
 #ifdef SOLARIS_PRIVILEGES
        priv_set_t *basicset;
-       
+
        /* make the process privilege-aware */
        setpflags(PRIV_AWARE, 1);
 
@@ -909,7 +909,7 @@ SWITCH_DECLARE(int32_t) switch_core_set_process_privileges(void)
        if (setppriv(PRIV_SET, PRIV_EFFECTIVE, basicset) != 0) {
                fprintf(stderr, "ERROR: Failed to acquire basic privileges (%s)\n", strerror(errno));
        }
-       
+
        /* we need high-resolution clock, and this requires a non-basic privilege */
        if (priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_PROC_CLOCK_HIGHRES, NULL) < 0) {
                fprintf(stderr, "ERROR: Failed to acquire proc_clock_highres privilege (%s)\n", strerror(errno));
@@ -921,7 +921,7 @@ SWITCH_DECLARE(int32_t) switch_core_set_process_privileges(void)
                fprintf(stderr, "ERROR: Failed to acquire sys_resource privilege (%s)\n", strerror(errno));
                return -1;
        }
-       
+
        /* we need to read directories belonging to other uid */
        if (priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_FILE_DAC_SEARCH, NULL) < 0) {
                fprintf(stderr, "ERROR: Failed to acquire file_dac_search privilege (%s)\n", strerror(errno));
@@ -1317,11 +1317,11 @@ SWITCH_DECLARE(void) switch_core_setrlimits(void)
 #ifdef HAVE_SETRLIMIT
        struct rlimit rlp;
 
-       /* 
+       /*
           Setting the stack size on FreeBSD results in an instant crash.
 
           If anyone knows how to fix this,
-          feel free to submit a patch to https://freeswitch.org/jira 
+          feel free to submit a patch to https://freeswitch.org/jira
         */
 
 #ifndef __FreeBSD__
@@ -1740,7 +1740,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_thread_set_cpu_affinity(int cpu)
                if (!sched_setaffinity(0, sizeof(set), &set)) {
                        status = SWITCH_STATUS_SUCCESS;
                }
-               
+
 #else
 #if WIN32
                if (SetThreadAffinityMask(GetCurrentThread(), (DWORD_PTR) cpu)) {
@@ -1754,7 +1754,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_thread_set_cpu_affinity(int cpu)
 }
 
 
-#ifdef ENABLE_ZRTP 
+#ifdef ENABLE_ZRTP
 static void switch_core_set_serial(void)
 {
        char buf[13] = "";
@@ -1820,13 +1820,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
                /* one per customer */
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        memset(&runtime, 0, sizeof(runtime));
        gethostname(runtime.hostname, sizeof(runtime.hostname));
 
        runtime.max_db_handles = 50;
        runtime.db_handle_timeout = 5000000;
-       
+
        runtime.runlevel++;
        runtime.dummy_cng_frame.data = runtime.dummy_data;
        runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data);
@@ -1857,7 +1857,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
                GetSystemInfo( &sysinfo );
                runtime.cpu_count = sysinfo.dwNumberOfProcessors;
        }
-#endif 
+#endif
 
        if (!runtime.cpu_count) runtime.cpu_count = 1;
 
@@ -1968,7 +1968,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
        }
 
        switch_log_init(runtime.memory_pool, runtime.colorize_console);
-                       
+
        runtime.tipping_point = 0;
        runtime.timer_affinity = -1;
        runtime.microseconds_per_tick = 20000;
@@ -1992,7 +1992,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
 
        runtime.running = 1;
        runtime.initiated = switch_mono_micro_time_now();
-       
+
        switch_scheduler_add_task(switch_epoch_time_now(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
 
        switch_scheduler_add_task(switch_epoch_time_now(NULL), check_ip_callback, "check_ip", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL | SSHF_OWN_THREAD);
@@ -2071,7 +2071,7 @@ static void switch_load_core_config(const char *file)
                        for (param = switch_xml_child(settings, "codec"); param; param = param->next) {
                                const char *var = switch_xml_attr_soft(param, "name");
                                const char *val = switch_xml_attr_soft(param, "ptime");
-                               
+
                                if (!zstr(var) && !zstr(val)) {
                                        uint32_t *p;
                                        uint32_t v = switch_atoul(val);
@@ -2080,7 +2080,7 @@ static void switch_load_core_config(const char *file)
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error adding %s, defaults cannot be changed\n", var);
                                                continue;
                                        }
-                                       
+
                                        if (v == 0) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error adding %s, invalid ptime\n", var);
                                                continue;
@@ -2133,13 +2133,13 @@ static void switch_load_core_config(const char *file)
                                        }
                                } else if (!strcasecmp(var, "db-handle-timeout")) {
                                        long tmp = atol(val);
-                                       
+
                                        if (tmp > 0 && tmp < 5001) {
                                                runtime.db_handle_timeout = (uint32_t) tmp * 1000000;
                                        } else {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "db-handle-timeout must be between 1 and 5000\n");
                                        }
-                                       
+
                                } else if (!strcasecmp(var, "multiple-registrations")) {
                                        runtime.multiple_registrations = switch_true(val);
                                } else if (!strcasecmp(var, "auto-create-schemas")) {
@@ -2270,7 +2270,7 @@ static void switch_load_core_config(const char *file)
 
                                        if (tmp > runtime.cpu_count / 2) {
                                                tmp = runtime.cpu_count / 2;
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "This value cannot be higher than %d so setting it to that value\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "This value cannot be higher than %d so setting it to that value\n",
                                                                                  runtime.cpu_count / 2);
                                        }
 
@@ -2361,8 +2361,8 @@ SWITCH_DECLARE(const char *) switch_core_banner(void)
                        "|   Anthony Minessale II, Michael Jerris, Brian West, Others  |\n"
                        "|   FreeSWITCH (http://www.freeswitch.org)                    |\n"
                        "|   Paypal Donations Appreciated: paypal@freeswitch.org       |\n"
-                       "|   Brought to you by ClueCon http://www.cluecon.com/         |\n" 
-                       ".=============================================================.\n" 
+                       "|   Brought to you by ClueCon http://www.cluecon.com/         |\n"
+                       ".=============================================================.\n"
                        "\n");
 }
 
@@ -2379,7 +2379,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t
        if (switch_core_init(flags, console, err) != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_GENERR;
        }
-       
+
        if (runtime.runlevel > 1) {
                /* one per customer */
                return SWITCH_STATUS_SUCCESS;
@@ -2419,12 +2419,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t
 #ifdef WIN32
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s\n\n", switch_core_banner(), use);
 #else
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s%s%s%s%s\n\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s%s%s%s%s\n\n",
                                          SWITCH_SEQ_DEFAULT_COLOR,
                                          SWITCH_SEQ_FYELLOW, SWITCH_SEQ_BBLUE,
-                                         switch_core_banner(), 
+                                         switch_core_banner(),
                                          use, SWITCH_SEQ_DEFAULT_COLOR);
-       
+
 #endif
 
 
@@ -2565,7 +2565,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
 {
        int *intval = (int *) val;
        int oldintval = 0, newintval = 0;
-       
+
        if (intval) {
                oldintval = *intval;
        }
@@ -2583,7 +2583,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
 
                        if (!zstr(arg)) {
                                tech = strdup(arg);
-                               
+
                                if ((prof = strchr(tech, ':'))) {
                                        *prof++ = '\0';
                                }
@@ -3193,7 +3193,7 @@ static int switch_system_fork(const char *cmd, switch_bool_t wait)
        switch_core_set_signal_handlers();
 
        pid = switch_fork();
-       
+
        if (pid) {
                if (wait) {
                        waitpid(pid, NULL, 0);
index 6102d9c1390f16eb6e75eb7f04f7878bb571bc77..b49dfb63c385fa8f109771b4b5e4a1852a0ce4d4 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
index 42c34b315046a70a87b2bbb391cffdf289993b6c..36be34ae28625e7ceb32a192a7673f1191f9523d 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -9,7 +9,7 @@
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
- * Software distributed under the License is distributed on an "AS IS" basis, 
+ * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_cert.c -- Cert Functions
@@ -58,7 +58,7 @@ SWITCH_DECLARE(void) switch_ssl_init_ssl_locks(void)
 
        if (ssl_count == 0) {
                num = CRYPTO_num_locks();
-               
+
                ssl_mutexes = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(switch_mutex_t*));
                switch_assert(ssl_mutexes != NULL);
 
@@ -141,7 +141,7 @@ SWITCH_DECLARE(int) switch_core_cert_verify(dtls_fingerprint_t *fp)
        while ((v = strsep(&p, ":")) && (i != (MAX_FPLEN - 1))) {
                sscanf(v, "%02x", (uint32_t *) &fdata[i++]);
        }
-       
+
        free(tmp);
 
        i = !memcmp(fdata, fp->data, i);
@@ -159,7 +159,7 @@ SWITCH_DECLARE(int) switch_core_cert_expand_fingerprint(dtls_fingerprint_t *fp,
        while ((v = strsep(&p, ":")) && (i != (MAX_FPLEN - 1))) {
                sscanf(v, "%02x", (uint32_t *) &fp->data[i++]);
        }
-       
+
        free(tmp);
 
        return i;
@@ -171,7 +171,7 @@ SWITCH_DECLARE(int) switch_core_cert_extract_fingerprint(X509* x509, dtls_finger
        unsigned int i, j;
 
        evp = get_evp_by_name(fp->type);
-       
+
        if (X509_digest(x509, evp, fp->data, &fp->len) != 1 ||  fp->len <= 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FP DIGEST ERR!\n");
                return -1;
@@ -183,7 +183,7 @@ SWITCH_DECLARE(int) switch_core_cert_extract_fingerprint(X509* x509, dtls_finger
        *(&fp->str[fp->len * 3]) = '\0';
 
        return 0;
-       
+
 }
 
 SWITCH_DECLARE(int) switch_core_cert_gen_fingerprint(const char *prefix, dtls_fingerprint_t *fp)
@@ -204,7 +204,7 @@ SWITCH_DECLARE(int) switch_core_cert_gen_fingerprint(const char *prefix, dtls_fi
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FP BIO ERR!\n");
                goto end;
        }
-       
+
        if (BIO_read_filename(bio, rsa) != 1) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FP FILE ERR!\n");
                goto end;
@@ -216,7 +216,7 @@ SWITCH_DECLARE(int) switch_core_cert_gen_fingerprint(const char *prefix, dtls_fi
        }
 
        switch_core_cert_extract_fingerprint(x509, fp);
-       
+
        ret = 1;
 
  end:
@@ -230,7 +230,7 @@ SWITCH_DECLARE(int) switch_core_cert_gen_fingerprint(const char *prefix, dtls_fi
        }
 
        free(rsa);
-       
+
        return ret;
 }
 
@@ -272,9 +272,9 @@ SWITCH_DECLARE(int) switch_core_gen_certs(const char *prefix)
        }
 
        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
-               
+
        //bio_err=BIO_new_fp(stderr, BIO_NOCLOSE);
-               
+
        mkcert(&x509, &pkey, 1024, 0, 36500);
 
        //RSA_print_fp(stdout, pkey->pkey.rsa, 0);
@@ -292,7 +292,7 @@ SWITCH_DECLARE(int) switch_core_gen_certs(const char *prefix)
                        PEM_write_PrivateKey(fp, pkey, NULL, NULL, 0, NULL, NULL);
                        fclose(fp);
                }
-               
+
                if (rsa && (fp = fopen(rsa, "w"))) {
                        PEM_write_X509(fp, x509);
                        fclose(fp);
@@ -339,13 +339,13 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days
        EVP_PKEY *pk;
        RSA *rsa;
        X509_NAME *name=NULL;
-       
+
        switch_assert(pkeyp);
        switch_assert(x509p);
 
        if (*pkeyp == NULL) {
                if ((pk = EVP_PKEY_new()) == NULL) {
-                       abort(); 
+                       abort();
                }
        } else {
                pk = *pkeyp;
@@ -382,7 +382,7 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days
         */
        X509_NAME_add_entry_by_txt(name, "C", MBSTRING_ASC, (unsigned char *)"US", -1, -1, 0);
        X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, (unsigned char *)"FreeSWITCH", -1, -1, 0);
-                                                          
+
 
        /* Its self signed so set the issuer name to be the same as the
         * subject.
index c25357a74da0f46418b5d98f5657ad288b228a55..73fca25b2c6236c614cdabe5b3612dffcb3ca51e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -133,7 +133,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
                        }
                        session->real_read_codec = codec;
                        session->real_read_impl = *codec->implementation;
-                       
+
                        /* set read_codec with real_read_codec if it no longer is ready */
                        if (!switch_core_codec_ready(session->read_codec)) {
                                session->read_codec = codec;
@@ -248,7 +248,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Restore previous codec %s:%d.\n",
                                                          switch_channel_get_name(session->channel),
                                                          session->read_impl.iananame ? session->read_impl.iananame : "N/A", session->read_impl.ianacode);
-                       
+
 
                } else if (session->real_read_codec) {
                        session->read_codec = session->real_read_codec;
@@ -344,7 +344,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_s
                *impp = session->write_impl;
                return SWITCH_STATUS_SUCCESS;
        }
-       
+
        memset(impp, 0, sizeof(*impp));
        impp->number_of_channels = 1;
        return SWITCH_STATUS_FALSE;
@@ -581,13 +581,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_n
 {
        switch_codec_interface_t *codec_interface;
        switch_status_t status = SWITCH_STATUS_FALSE;
-       
+
        if (zstr(codec_name) || zstr(fmtp) || !codec_fmtp) {
                return SWITCH_STATUS_FALSE;
        }
 
        memset(codec_fmtp, 0, sizeof(*codec_fmtp));
-       
+
        if ((codec_interface = switch_loadable_module_get_codec_interface(codec_name, NULL))) {
                if (codec_interface->parse_fmtp) {
                        codec_fmtp->actual_samples_per_second = rate;
@@ -611,13 +611,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_reset(switch_codec_t *codec)
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, 
+SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec,
                                                                                                           const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool)
 {
        switch_assert(codec != NULL);
        switch_assert(new_codec != NULL);
-       
-       return switch_core_codec_init(new_codec, 
+
+       return switch_core_codec_init(new_codec,
                                                                  codec->implementation->iananame,
                                                                  codec->implementation->modname,
                                                                  codec->fmtp_in,
@@ -627,7 +627,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, sw
                                                                  codec->flags,
                                                                  codec_settings,
                                                                  pool);
-       
+
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec_t *codec, const char *codec_name, const char *modname, const char *fmtp,
@@ -671,7 +671,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec
 
                goto found;
        }
-       
+
        /* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */
        if (!ms) {
                for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) {
@@ -720,9 +720,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec
                switch_set_flag(codec, SWITCH_CODEC_FLAG_READY);
                return SWITCH_STATUS_SUCCESS;
        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec %s Exists but not at the desired implementation. %dhz %dms %dch\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec %s Exists but not at the desired implementation. %dhz %dms %dch\n",
                                                  codec_name, rate, ms, channels);
-                                                 
+
        }
 
        UNPROTECT_INTERFACE(codec_interface);
@@ -789,14 +789,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
                uint32_t frames = encoded_data_len / codec->implementation->encoded_bytes_per_packet / codec->implementation->number_of_channels;
 
                if (frames && codec->implementation->decoded_bytes_per_packet * frames > *decoded_data_len) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Buffer size sanity check failed! edl:%u ebpp:%u fr:%u ddl:%u\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Buffer size sanity check failed! edl:%u ebpp:%u fr:%u ddl:%u\n",
                                                          encoded_data_len, codec->implementation->encoded_bytes_per_packet, frames, *decoded_data_len);
                        *decoded_data_len = codec->implementation->decoded_bytes_per_packet;
                        memset(decoded_data, 255, *decoded_data_len);
                        return SWITCH_STATUS_SUCCESS;
                }
        }
-       
+
        if (codec->mutex) switch_mutex_lock(codec->mutex);
        status = codec->implementation->decode(codec, other_codec, encoded_data, encoded_data_len, encoded_rate,
                                                                                   decoded_data, decoded_data_len, decoded_rate, flag);
@@ -825,7 +825,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode_video(switch_codec_t *c
 
        if (codec->implementation->encode_video) {
                status = codec->implementation->encode_video(codec, frame);
-               
+
                if (status == SWITCH_STATUS_MORE_DATA) {
                        frame->flags |= SFF_SAME_IMAGE;
                } else {
@@ -869,14 +869,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode_video(switch_codec_t *c
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec, 
-                                                                                                                 switch_codec_control_command_t cmd, 
+SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
+                                                                                                                 switch_codec_control_command_t cmd,
                                                                                                                  switch_codec_control_type_t ctype,
                                                                                                                  void *cmd_data,
                                                                                                                  switch_codec_control_type_t atype,
                                                                                                                  void *cmd_arg,
                                                                                                                  switch_codec_control_type_t *rtype,
-                                                                                                                 void **ret_data) 
+                                                                                                                 void **ret_data)
 {
 
        switch_status_t status = SWITCH_STATUS_FALSE;
@@ -884,7 +884,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
 
        switch_assert(codec != NULL);
 
-       
+
        if (!codec->implementation || !switch_core_codec_ready(codec)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initialized!\n");
                abort();
@@ -927,17 +927,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
        }
 
        codec->implementation->destroy(codec);
-       
+
        UNPROTECT_INTERFACE(codec->codec_interface);
 
        if (mutex) switch_mutex_unlock(mutex);
-       
+
        if (free_pool) {
                switch_core_destroy_memory_pool(&pool);
        }
 
        memset(codec, 0, sizeof(*codec));
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index 15466bf3434f931aaeb5df2d404f972e01aa86ac..d89fbdd4874ca2ba490403f7d60b5f2d15d2ece6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Michael Jerris <mike@jerris.com>
  *
  *
index 0309a6f70d139ac91b5be61dd46cacdc6a47da48..6ce2e79bf3eb078b9bbf14ec9b029d61807542a3 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
index 5fa33b8bdcbbf7e61452ccd64db3fdee84650760..77cdaf90bffa0da13184eea81dff74dd0ed647f0 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_core_event_hook.c Core Event Hooks
index 46ee5390b981e48cef9cd31c1966a1fcd0151542..598876c99f5d95635a06324668c8e42ab23db32a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -95,22 +95,22 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
                char *modname;
                const char *val;
                int tmp;
-               
+
                fp = switch_core_strdup(fh->memory_pool, file_path);
 
                while (*fp == '{') {
                        char *parsed = NULL;
-                       
+
                        if (switch_event_create_brackets(fp, '{', '}', ',', &fh->params, &parsed, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS || !parsed) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
                                goto fail;
                        }
-                       
+
                        fp = parsed;
                }
 
                file_path = fp;
-               
+
                if ((timeout = switch_event_get_header(fh->params, "timeout"))) {
                        if ((to = atoi(timeout)) < 1) {
                                to = 0;
@@ -149,7 +149,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
 
                if ((val = switch_event_get_header(fh->params, "vb"))) {
                        tmp = atoi(val);
-                       
+
                        if (strrchr(val, 'k')) {
                                tmp *= 1024;
                        } else if (strrchr(val, 'm')) {
@@ -192,7 +192,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
                        } else if (strrchr(val, 'm')) {
                                tmp *= 1048576;
                        }
-                       
+
                        if (tmp > 0 && tmp < 104857600 /*100mb*/) {
                                fh->mm.vbuf = tmp;
                        } else {
@@ -365,7 +365,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
 
        fh->samples_in = 0;
        fh->max_samples = 0;
-       
+
        if (switch_test_flag(fh, SWITCH_FILE_FLAG_FREE_POOL)) {
                switch_core_destroy_memory_pool(&fh->memory_pool);
        }
@@ -419,7 +419,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
                                if ((status = fh->file_interface->file_read(fh, fh->pre_buffer_data, &rlen)) == SWITCH_STATUS_BREAK) {
                                        return SWITCH_STATUS_BREAK;
                                }
-                               
+
 
                                if (status != SWITCH_STATUS_SUCCESS || !rlen) {
                                        switch_set_flag_locked(fh, SWITCH_FILE_BUFFER_DONE);
@@ -636,7 +636,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh,
 {
        switch_status_t status;
        int ok = 1;
-       
+
        switch_assert(fh != NULL);
 
        if (!switch_test_flag(fh, SWITCH_FILE_OPEN) || !fh->file_interface->file_seek) {
@@ -648,11 +648,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh,
        } else if (!switch_test_flag(fh, SWITCH_FILE_FLAG_READ)) {
                ok = 0;
        }
-       
+
        if (!ok) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if (fh->buffer) {
                switch_buffer_zero(fh->buffer);
        }
@@ -748,7 +748,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_truncate(switch_file_handle_t *
 SWITCH_DECLARE(switch_status_t) switch_core_file_command(switch_file_handle_t *fh, switch_file_command_t command)
 {
        switch_status_t status = SWITCH_STATUS_FALSE;
-       
+
        switch_assert(fh != NULL);
        switch_assert(fh->file_interface != NULL);
 
index 3e954f5b529b21bf4ce3a4bc87a66f09338cad33..a6d3ddc68c21ff7ca126410bc4adf1e167a09fb5 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -60,7 +60,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(switch_hash_t
        int r = 0;
 
        r = switch_hashtable_insert_destructor(hash, strdup(key), (void *)data, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_DUP_CHECK, destructor);
-       
+
        return r ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
 }
 
@@ -143,14 +143,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(switch_hash_t *has
        switch_event_t *event = NULL;
        switch_event_header_t *header = NULL;
        switch_status_t status = SWITCH_STATUS_GENERR;
-       
+
        switch_event_create_subclass(&event, SWITCH_EVENT_CLONE, NULL);
        switch_assert(event);
-       
+
        /* iterate through the hash, call callback, if callback returns NULL or true, put the key on the list (event)
           When done, iterate through the list deleting hash entries
         */
-       
+
        for (hi = switch_core_hash_first(hash); hi; hi = switch_core_hash_next(&hi)) {
                const void *key;
                void *val;
@@ -159,7 +159,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(switch_hash_t *has
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delete", (const char *) key);
                }
        }
-       
+
        /* now delete them */
        for (header = event->headers; header; header = header->next) {
                if (switch_core_hash_delete(hash, header->value)) {
@@ -168,7 +168,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(switch_hash_t *has
        }
 
        switch_event_destroy(&event);
-       
+
        return status;
 }
 
index f91f89f3fe012aaf7f145c03bd8b08957177bc47..0ccb215f269f646bf439e2f4e57a1eae29b5e379 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Moular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
 SWITCH_DECLARE(void) switch_core_gen_encoded_silence(unsigned char *data, const switch_codec_implementation_t *read_impl, switch_size_t len)
 {
        unsigned char g729_filler[] = {
-               114, 170, 250, 103, 54, 211, 203, 194, 94, 64, 
+               114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
                229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
-               114, 170, 250, 103, 54, 211, 203, 194, 94, 64, 
+               114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
                229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
-               114, 170, 250, 103, 54, 211, 203, 194, 94, 64, 
+               114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
                229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
-               114, 170, 250, 103, 54, 211, 203, 194, 94, 64, 
+               114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
                229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
-               114, 170, 250, 103, 54, 211, 203, 194, 94, 64, 
+               114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
                229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
-               114, 170, 250, 103, 54, 211, 203, 194, 94, 64, 
+               114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
                229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
-               114, 170, 250, 103, 54, 211, 203, 194, 94, 64, 
+               114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
                229, 127, 79, 96, 207, 82, 216, 110, 245, 81
        };
 
-       
+
        if (read_impl->ianacode == 18 || switch_stristr("g729", read_impl->iananame)) {
                memcpy(data, g729_filler, len);
        } else {
@@ -122,7 +122,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
        switch_mutex_lock(session->read_codec->mutex);
 
   top:
-       
+
        for(i = 0; i < 2; i++) {
                if (session->dmachine[i]) {
                        switch_channel_dtmf_lock(session->channel);
@@ -130,7 +130,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                        switch_channel_dtmf_unlock(session->channel);
                }
        }
-       
+
        if (switch_channel_down(session->channel) || !switch_core_codec_ready(session->read_codec)) {
                *frame = NULL;
                status = SWITCH_STATUS_FALSE;
@@ -153,7 +153,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                        msg.message_id = SWITCH_MESSAGE_HEARTBEAT_EVENT;
                        msg.numeric_arg = session->track_duration;
                        switch_core_session_receive_message(session, &msg);
-                       
+
                        switch_event_create(&event, SWITCH_EVENT_SESSION_HEARTBEAT);
                        switch_channel_event_set_data(session->channel, event);
                        switch_event_fire(&event);
@@ -205,7 +205,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                if (!switch_core_codec_ready(session->read_codec)) {
                        *frame = NULL;
                        status = SWITCH_STATUS_FALSE;
-                       goto even_more_done;                    
+                       goto even_more_done;
                }
        }
 
@@ -245,7 +245,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                        if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
                                continue;
                        }
-                       
+
                        if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) {
                                continue;
                        }
@@ -253,11 +253,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                prune++;
                                continue;
                        }
-                       
+
                        if (bp->ready) {
                                if (switch_test_flag(bp, SMBF_TAP_NATIVE_READ)) {
-                                       if ((*frame)->codec && (*frame)->codec->implementation && 
-                                               (*frame)->codec->implementation->encoded_bytes_per_packet && 
+                                       if ((*frame)->codec && (*frame)->codec->implementation &&
+                                               (*frame)->codec->implementation->encoded_bytes_per_packet &&
                                                (*frame)->datalen != (*frame)->codec->implementation->encoded_bytes_per_packet) {
                                                switch_set_flag((*frame), SFF_CNG);
                                                break;
@@ -269,7 +269,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                        }
                                }
                        }
-                       
+
                        if ((bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) || ok == SWITCH_FALSE) {
                                switch_set_flag(bp, SMBF_PRUNE);
                                prune++;
@@ -287,8 +287,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
        if (session->read_codec->implementation->impl_id != codec_impl.impl_id) {
                need_codec = TRUE;
                tap_only = 0;
-       } 
-       
+       }
+
        if (codec_impl.actual_samples_per_second != session->read_impl.actual_samples_per_second) {
                do_resample = 1;
        }
@@ -296,7 +296,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
        if (tap_only) {
                switch_media_bug_t *bp;
                switch_bool_t ok = SWITCH_TRUE;
-               int prune = 0;          
+               int prune = 0;
 
                if (session->bugs && switch_test_flag((*frame), SFF_CNG)) {
                        switch_thread_rwlock_rdlock(session->bug_rwlock);
@@ -306,7 +306,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
                                        continue;
                                }
-                       
+
                                if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) {
                                        continue;
                                }
@@ -314,29 +314,29 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                        prune++;
                                        continue;
                                }
-                       
+
                                if (bp->ready && (*frame)->codec && (*frame)->codec->implementation && (*frame)->codec->implementation->encoded_bytes_per_packet) {
                                        if (switch_test_flag(bp, SMBF_TAP_NATIVE_READ)) {
                                                if (bp->callback) {
                                                        switch_frame_t tmp_frame = {0};
                                                        unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
-                                                       
-                                                       
+
+
                                                        tmp_frame.codec = (*frame)->codec;
                                                        tmp_frame.datalen = (*frame)->codec->implementation->encoded_bytes_per_packet;
                                                        tmp_frame.samples = (*frame)->codec->implementation->samples_per_packet;
                                                        tmp_frame.channels = (*frame)->codec->implementation->number_of_channels;
                                                        tmp_frame.data = data;
-                                                       
+
                                                        switch_core_gen_encoded_silence(data, (*frame)->codec->implementation, tmp_frame.datalen);
-                                                       
+
                                                        bp->native_read_frame = &tmp_frame;
                                                        ok = bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_TAP_NATIVE_READ);
                                                        bp->native_read_frame = NULL;
                                                }
                                        }
                                }
-                               
+
                                if ((bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) || ok == SWITCH_FALSE) {
                                        switch_set_flag(bp, SMBF_PRUNE);
                                        prune++;
@@ -347,8 +347,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                        if (prune) {
                                switch_core_media_bug_prune(session);
                        }
-                       
-               
+
+
                }
 
 
@@ -389,7 +389,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                switch_core_session_t *other_session;
                const char *uuid = switch_channel_get_partner_uuid(switch_core_session_get_channel(session));
                switch_clear_flag(session, SSF_READ_TRANSCODE);
-               
+
                if (uuid && (other_session = switch_core_session_locate(uuid))) {
                        switch_set_flag(other_session, SSF_READ_CODEC_RESET);
                        switch_set_flag(other_session, SSF_READ_CODEC_RESET);
@@ -403,7 +403,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                switch_clear_flag(session, SSF_READ_CODEC_RESET);
        }
 
-       
+
        if (status == SWITCH_STATUS_SUCCESS && need_codec) {
                switch_frame_t *enc_frame, *read_frame = *frame;
 
@@ -449,7 +449,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                                                                  read_frame->codec->implementation->iananame, read_frame->codec->implementation->ianacode);
                                                switch_core_codec_copy(read_frame->codec, &session->bug_codec, NULL, NULL);
                                                if (!switch_core_codec_ready(&session->bug_codec)) {
-                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Error setting BUG codec %s!\n", 
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Error setting BUG codec %s!\n",
                                                                                          switch_core_session_get_name(session), read_frame->codec->implementation->iananame);
                                                }
                                        }
@@ -472,7 +472,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                         switch_channel_test_flag(session->channel, CF_CNG_PLC)) && !session->plc) {
                                        session->plc = plc_init(NULL);
                                }
-                               
+
                                if (!switch_test_flag(read_frame->codec, SWITCH_CODEC_FLAG_HAS_PLC) && session->plc && switch_test_flag(read_frame, SFF_PLC)) {
                                        session->raw_read_frame.datalen = read_frame->codec->implementation->decoded_bytes_per_packet;
                                        session->raw_read_frame.samples = session->raw_read_frame.datalen / sizeof(int16_t) / session->read_impl.number_of_channels;
@@ -487,12 +487,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                        if (!switch_core_codec_ready(codec)) {
                                                codec = read_frame->codec;
                                        }
-                                       
+
                                        if (!switch_core_codec_ready(codec)) {
                                                switch_thread_rwlock_unlock(session->bug_rwlock);
                                                goto done;
                                        }
-                                       
+
                                        codec->cur_frame = read_frame;
                                        session->read_codec->cur_frame = read_frame;
                                        status = switch_core_codec_decode(codec,
@@ -500,7 +500,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                                                                                          read_frame->data,
                                                                                                          read_frame->datalen,
                                                                                                          session->read_impl.actual_samples_per_second,
-                                                                                                         session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, 
+                                                                                                         session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate,
                                                                                                          &read_frame->flags);
 
                                        if (status == SWITCH_STATUS_NOT_INITALIZED) {
@@ -515,7 +515,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                        switch_thread_rwlock_unlock(session->bug_rwlock);
 
                                }
-                               
+
                                if (status == SWITCH_STATUS_SUCCESS && session->read_impl.number_of_channels == 1) {
                                        if (session->plc) {
                                                if (switch_test_flag(read_frame, SFF_PLC)) {
@@ -552,7 +552,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                        status = switch_resample_create(&session->read_resampler,
                                                                                                        read_frame->codec->implementation->actual_samples_per_second,
                                                                                                        session->read_impl.actual_samples_per_second,
-                                                                                                       session->read_impl.decoded_bytes_per_packet, SWITCH_RESAMPLE_QUALITY, 
+                                                                                                       session->read_impl.decoded_bytes_per_packet, SWITCH_RESAMPLE_QUALITY,
                                                                                                        session->read_impl.number_of_channels);
 
                                        switch_mutex_unlock(session->resample_mutex);
@@ -729,8 +729,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                                uint32_t samples = bytes / 2 / bp->read_demux_frame->channels;
 
                                                memcpy(data, read_frame->data, read_frame->datalen);
-                                               datalen = switch_unmerge_sln((int16_t *)data, samples, 
-                                                                                                        bp->read_demux_frame->data, samples, 
+                                               datalen = switch_unmerge_sln((int16_t *)data, samples,
+                                                                                                        bp->read_demux_frame->data, samples,
                                                                                                         bp->read_demux_frame->channels) * 2 * bp->read_demux_frame->channels;
 
                                                switch_buffer_write(bp->raw_read_buffer, data, datalen);
@@ -787,7 +787,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                        goto done;
                                }
                        }
-                       
+
                        if (perfect || switch_buffer_inuse(session->raw_read_buffer) >= session->read_impl.decoded_bytes_per_packet) {
                                if (perfect) {
                                        enc_frame = read_frame;
@@ -936,7 +936,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
        switch_mutex_unlock(session->read_codec->mutex);
        switch_mutex_unlock(session->codec_read_mutex);
 
-       
+
        if (status == SWITCH_STATUS_SUCCESS && switch_channel_get_callstate(session->channel) == CCS_UNHELD) {
                switch_channel_set_callstate(session->channel, CCS_ACTIVE);
        }
@@ -980,12 +980,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio
        switch_status_t status;
        switch_dtmf_t new_dtmf;
        int fed = 0;
-       
+
        if (switch_channel_down(session->channel)) {
                return SWITCH_STATUS_FALSE;
        }
 
-       if (switch_test_flag(dtmf, DTMF_FLAG_SENSITIVE)) {      
+       if (switch_test_flag(dtmf, DTMF_FLAG_SENSITIVE)) {
                return SWITCH_STATUS_SUCCESS;
        }
 
@@ -1004,7 +1004,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio
        } else if (!new_dtmf.duration) {
                new_dtmf.duration = switch_core_default_dtmf_duration(0);
        }
-       
+
        if (!switch_test_flag(dtmf, DTMF_FLAG_SKIP_PROCESS)) {
                if (session->dmachine[0]) {
                        char str[2] = { dtmf->digit, '\0' };
@@ -1032,7 +1032,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
                return SWITCH_STATUS_FALSE;
        }
 
-       if (switch_test_flag(dtmf, DTMF_FLAG_SENSITIVE)) {      
+       if (switch_test_flag(dtmf, DTMF_FLAG_SENSITIVE)) {
                return SWITCH_STATUS_SUCCESS;
        }
 
@@ -1064,7 +1064,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
        switch_assert(dtmf);
 
        new_dtmf = *dtmf;
-       
+
        if (new_dtmf.digit != 'w' && new_dtmf.digit != 'W') {
                if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
@@ -1074,14 +1074,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
                                                  switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration);
                        new_dtmf.duration = switch_core_min_dtmf_duration(0);
-               } 
+               }
        }
 
        if (!new_dtmf.duration) {
                new_dtmf.duration = switch_core_default_dtmf_duration(0);
        }
 
-       if (!switch_test_flag(dtmf, DTMF_FLAG_SKIP_PROCESS)) {  
+       if (!switch_test_flag(dtmf, DTMF_FLAG_SKIP_PROCESS)) {
                for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) {
                        if ((status = ptr->send_dtmf(session, dtmf, SWITCH_DTMF_SEND)) != SWITCH_STATUS_SUCCESS) {
                                return SWITCH_STATUS_SUCCESS;
@@ -1098,7 +1098,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
        if (session->endpoint_interface->io_routines->send_dtmf) {
                int send = 0;
                status = SWITCH_STATUS_SUCCESS;
-               
+
                if (switch_channel_test_cap(session->channel, CC_QUEUEABLE_DTMF_DELAY) && (dtmf->digit == 'w' || dtmf->digit == 'W')) {
                        send = 1;
                } else {
@@ -1180,13 +1180,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
                                                                                  switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
                                                dtmf.duration = switch_core_min_dtmf_duration(0);
-                                       } 
+                                       }
                                }
 
                                if (!dtmf.duration) {
                                        dtmf.duration = switch_core_default_dtmf_duration(0);
                                }
-                               
+
 
                                if (switch_core_session_send_dtmf(session, &dtmf) == SWITCH_STATUS_SUCCESS) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n",
index bcc7c2861df961717dd49655a070a2007a01f475..22fab244d934da9e739ff7c35bc2c9dc0ab3afbb 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Seven Du <dujinfang@gmail.com>
  *
@@ -264,7 +264,7 @@ struct switch_media_handle_s {
        switch_timer_t video_timer;
 
 
-       switch_vid_params_t vid_params; 
+       switch_vid_params_t vid_params;
        switch_file_handle_t *video_read_fh;
        switch_file_handle_t *video_write_fh;
 
@@ -330,7 +330,7 @@ static inline switch_media_flow_t sdp_media_flow(unsigned in)
        case sdp_inactive:
                return SWITCH_MEDIA_FLOW_INACTIVE;
        }
-       
+
        return SWITCH_MEDIA_FLOW_SENDRECV;
 }
 
@@ -355,11 +355,11 @@ static void _switch_core_media_pass_zrtp_hash2(switch_core_session_t *aleg_sessi
 
 
 
-       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_session->channel), SWITCH_LOG_DEBUG1, 
+       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_session->channel), SWITCH_LOG_DEBUG1,
                                          "Deciding whether to pass zrtp-hash between a-leg and b-leg\n");
 
        if (!(switch_channel_test_flag(aleg_session->channel, CF_ZRTP_PASSTHRU_REQ))) {
-               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_session->channel), SWITCH_LOG_DEBUG1, 
+               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_session->channel), SWITCH_LOG_DEBUG1,
                                                  "CF_ZRTP_PASSTHRU_REQ not set on a-leg, so not propagating zrtp-hash\n");
                return;
        }
@@ -369,7 +369,7 @@ static void _switch_core_media_pass_zrtp_hash2(switch_core_session_t *aleg_sessi
                bleg_engine->local_sdp_zrtp_hash = switch_core_session_strdup(bleg_session, aleg_engine->remote_sdp_zrtp_hash);
                switch_channel_set_variable(bleg_session->channel, "l_sdp_audio_zrtp_hash", bleg_engine->local_sdp_zrtp_hash);
        }
-       
+
        if (bleg_engine->remote_sdp_zrtp_hash) {
                switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_session->channel), SWITCH_LOG_DEBUG, "Passing b-leg remote zrtp-hash (audio) to a-leg\n");
                aleg_engine->local_sdp_zrtp_hash = switch_core_session_strdup(aleg_session, bleg_engine->remote_sdp_zrtp_hash);
@@ -382,12 +382,12 @@ SWITCH_DECLARE(uint32_t) switch_core_media_get_video_fps(switch_core_session_t *
        switch_media_handle_t *smh;
        time_t now;
        uint32_t fps, elapsed = 0;
-       
+
        switch_assert(session);
-       
+
        if (!(smh = session->media_handle)) {
                return SWITCH_STATUS_FALSE;
-       }               
+       }
 
        if (!switch_channel_test_flag(session->channel, CF_VIDEO)) {
                return 0;
@@ -400,8 +400,8 @@ SWITCH_DECLARE(uint32_t) switch_core_media_get_video_fps(switch_core_session_t *
        if (!(smh->vid_started && smh->vid_frames && elapsed > 0)) {
                return 0;
        }
-       
-       fps = switch_round_to_step(smh->vid_frames / (elapsed), 5);     
+
+       fps = switch_round_to_step(smh->vid_frames / (elapsed), 5);
 
        if (smh->vid_frames > 1000) {
                smh->vid_started = switch_epoch_time_now(NULL);
@@ -410,7 +410,7 @@ SWITCH_DECLARE(uint32_t) switch_core_media_get_video_fps(switch_core_session_t *
 
        if (fps > 0) {
                video_globals.fps = fps;
-       
+
                if (smh->vid_params.fps != fps) {
                        switch_channel_set_variable_printf(session->channel, "video_fps", "%d", fps);
                        smh->vid_params.fps = fps;
@@ -458,7 +458,7 @@ SWITCH_DECLARE(const char *) switch_core_media_get_zrtp_hash(switch_core_session
                return engine->local_sdp_zrtp_hash;
        }
 
-       
+
        return engine->remote_sdp_zrtp_hash;
 
 }
@@ -521,7 +521,7 @@ static switch_t38_options_t * switch_core_media_process_udptl(switch_core_sessio
        sdp_attribute_t *attr;
 
        switch_assert(sdp);
-       
+
        if (!t38_options) {
                t38_options = switch_core_session_alloc(session, sizeof(switch_t38_options_t));
 
@@ -541,7 +541,7 @@ static switch_t38_options_t * switch_core_media_process_udptl(switch_core_sessio
        } else {
                t38_options->sdp_o_line = "unknown";
        }
-       
+
        if (m->m_connections && m->m_connections->c_address) {
                t38_options->remote_ip = switch_core_session_strdup(session, m->m_connections->c_address);
        } else if (sdp->sdp_connection && sdp->sdp_connection->c_address) {
@@ -598,19 +598,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_check_autoadj(switch_core_sess
        }
 
        a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
-       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];      
-       t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT];       
-       
+       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
+       t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT];
+
        if (!switch_media_handle_test_media_flag(smh, SCMF_DISABLE_RTP_AUTOADJ) &&
-               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) && 
+               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) &&
                !switch_channel_test_flag(session->channel, CF_AVPF)) {
                /* Reactivate the NAT buster flag. */
-               
+
                if (a_engine->rtp_session) {
                        switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
                        x++;
                }
-               
+
                if (v_engine->rtp_session) {
                        switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
                        x++;
@@ -672,7 +672,7 @@ SWITCH_DECLARE(switch_t38_options_t *) switch_core_media_extract_t38_options(swi
 
 
 //?
-SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_core_session_t *session,
                                                                                                                                           switch_core_session_t *other_session, switch_t38_options_t *t38_options)
 {
        char *remote_host;
@@ -691,23 +691,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_co
 
        remote_host = switch_rtp_get_remote_host(a_engine->rtp_session);
        remote_port = switch_rtp_get_remote_port(a_engine->rtp_session);
-       
+
        a_engine->cur_payload_map->remote_sdp_ip = switch_core_session_strdup(session, t38_options->remote_ip);
        a_engine->cur_payload_map->remote_sdp_port = t38_options->remote_port;
-                                                       
-       if (remote_host && remote_port && !strcmp(remote_host, a_engine->cur_payload_map->remote_sdp_ip) && 
+
+       if (remote_host && remote_port && !strcmp(remote_host, a_engine->cur_payload_map->remote_sdp_ip) &&
                remote_port == a_engine->cur_payload_map->remote_sdp_port) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                  "Audio params are unchanged for %s.\n",
                                                  switch_channel_get_name(session->channel));
        } else {
                const char *err = NULL;
-                       
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                  "Audio params changed for %s from %s:%d to %s:%d\n",
                                                  switch_channel_get_name(session->channel),
                                                  remote_host, remote_port, a_engine->cur_payload_map->remote_sdp_ip, a_engine->cur_payload_map->remote_sdp_port);
-                       
+
                switch_snprintf(tmp, sizeof(tmp), "%d", a_engine->cur_payload_map->remote_sdp_port);
                switch_channel_set_variable(session->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, a_engine->cur_payload_map->remote_sdp_ip);
                switch_channel_set_variable(session->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
@@ -717,7 +717,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_co
                        switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
                }
        }
-               
+
        switch_core_media_copy_t38_options(t38_options, other_session);
 
        return SWITCH_STATUS_SUCCESS;
@@ -773,9 +773,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core
                        *ptP = pt;
                }
                if (recv_ptP) {
-                       *recv_ptP = recv_pt; 
+                       *recv_ptP = recv_pt;
                }
-               
+
                if (!zstr(fmtp) && fmtpP) {
                        *fmtpP = fmtp;
                }
@@ -784,18 +784,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core
        }
 
        return SWITCH_STATUS_FALSE;
-       
+
 }
 
 
-SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_session_t *session, 
+SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_session_t *session,
                                                                                                                                  switch_media_type_t type,
-                                                                                                                                 const char *name, 
-                                                                                                                                 const char *modname, 
+                                                                                                                                 const char *name,
+                                                                                                                                 const char *modname,
                                                                                                                                  const char *fmtp,
                                                                                                                                  switch_sdp_type_t sdp_type,
-                                                                                                                                 uint32_t pt, 
-                                                                                                                                 uint32_t rate, 
+                                                                                                                                 uint32_t pt,
+                                                                                                                                 uint32_t rate,
                                                                                                                                  uint32_t ptime,
                                                                                                                                  uint32_t channels,
                                                                                                                                  uint8_t negotiated)
@@ -829,7 +829,7 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
                                exists = (type == pmap->type && !strcasecmp(name, pmap->iananame));
                                break;
                        }
-                       
+
                        if (exists) {
 
                                if (!zstr(fmtp) && !zstr(pmap->rm_fmtp)) {
@@ -856,7 +856,7 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
                                                continue;
                                        }
                                }
-                       
+
                                break;
                        }
                }
@@ -925,7 +925,7 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
                        engine->pmap_tail = engine->pmap_tail->next;
                }
        }
-       
+
        switch_mutex_unlock(smh->sdp_mutex);
 
        return pmap;
@@ -945,7 +945,7 @@ SWITCH_DECLARE(const char *)switch_core_media_get_codec_string(switch_core_sessi
                preferred = "PCMU";
                fallback = "PCMU";
        } else {
-       
+
                if (!(preferred = switch_channel_get_variable(session->channel, "absolute_codec_string"))) {
                        preferred = switch_channel_get_variable(session->channel, "codec_string");
                }
@@ -1036,11 +1036,11 @@ SWITCH_DECLARE(void) switch_core_media_parse_rtp_bugs(switch_rtp_bug_flag_t *fla
 
        if (switch_stristr("IGNORE_MARK_BIT", str)) {
                *flag_pole |= RTP_BUG_IGNORE_MARK_BIT;
-       }       
+       }
 
        if (switch_stristr("~IGNORE_MARK_BIT", str)) {
                *flag_pole &= ~RTP_BUG_IGNORE_MARK_BIT;
-       }       
+       }
 
        if (switch_stristr("SEND_LINEAR_TIMESTAMPS", str)) {
                *flag_pole |= RTP_BUG_SEND_LINEAR_TIMESTAMPS;
@@ -1144,7 +1144,7 @@ static switch_status_t switch_core_media_build_crypto(switch_media_handle_t *smh
                return SWITCH_STATUS_SUCCESS;
        }
 
-       
+
 
 //#define SAME_KEY
 #ifdef SAME_KEY
@@ -1163,7 +1163,7 @@ static switch_status_t switch_core_media_build_crypto(switch_media_handle_t *smh
                } else {
                        key = engine->ssec[ctype].remote_raw_key;
                }
-               
+
                switch_rtp_get_random(key, SUITES[ctype].keylen);
 #ifdef SAME_KEY
        }
@@ -1182,7 +1182,7 @@ static switch_status_t switch_core_media_build_crypto(switch_media_handle_t *smh
        switch_channel_set_variable_name_printf(smh->session->channel, engine->ssec[ctype].local_crypto_key, "rtp_last_%s_local_crypto_key", type2str(type));
        switch_channel_set_flag(smh->session->channel, CF_SECURE);
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "Set Local %s crypto Key [%s]\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "Set Local %s crypto Key [%s]\n",
                                          type2str(type),
                                          engine->ssec[ctype].local_crypto_key);
 
@@ -1213,7 +1213,7 @@ switch_status_t switch_core_media_add_crypto(switch_secure_settings_t *ssec, con
                p++;
 
                type = switch_core_media_crypto_str2type(p);
-               
+
                if (type == CRYPTO_INVALID) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error near [%s]\n", p);
                        goto bad;
@@ -1325,16 +1325,16 @@ static void switch_core_session_apply_crypto(switch_core_session_t *session, swi
        if (engine->ssec[engine->crypto_type].remote_crypto_key && switch_channel_test_flag(session->channel, CF_SECURE)) {
                switch_core_media_add_crypto(&engine->ssec[engine->crypto_type], engine->ssec[engine->crypto_type].remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
 
-               
+
                switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_SEND, 1,
-                                                                 engine->ssec[engine->crypto_type].crypto_type, 
-                                                                 engine->ssec[engine->crypto_type].local_raw_key, 
+                                                                 engine->ssec[engine->crypto_type].crypto_type,
+                                                                 engine->ssec[engine->crypto_type].local_raw_key,
                                                                  SUITES[engine->ssec[engine->crypto_type].crypto_type].keylen);
 
-               switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_RECV, 
+               switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_RECV,
                                                                  engine->ssec[engine->crypto_type].crypto_tag,
-                                                                 engine->ssec[engine->crypto_type].crypto_type, 
-                                                                 engine->ssec[engine->crypto_type].remote_raw_key, 
+                                                                 engine->ssec[engine->crypto_type].crypto_type,
+                                                                 engine->ssec[engine->crypto_type].remote_raw_key,
                                                                  SUITES[engine->ssec[engine->crypto_type].crypto_type].keylen);
 
                switch_channel_set_variable(session->channel, varname, "true");
@@ -1354,7 +1354,7 @@ static void switch_core_session_parse_crypto_prefs(switch_core_session_t *sessio
        switch_media_handle_t *smh;
        char *fields[CRYPTO_INVALID+1];
        int argc = 0, i = 0, j = 0, k = 0;
-       
+
        if (!(smh = session->media_handle)) {
                return;
        }
@@ -1373,7 +1373,7 @@ static void switch_core_session_parse_crypto_prefs(switch_core_session_t *sessio
                var = "rtp_secure_media";
                val = switch_channel_get_variable(session->channel, var);
        }
-       
+
        if (!zstr(val) && (suites = strchr(val, ':'))) {
                *suites++ = '\0';
        }
@@ -1403,10 +1403,10 @@ static void switch_core_session_parse_crypto_prefs(switch_core_session_t *sessio
 
        if (smh->crypto_mode != CRYPTO_MODE_FORBIDDEN && !zstr(suites)) {
                argc = switch_split((char *)suites, ':', fields);
-               
+
                for (i = 0; i < argc; i++) {
                        int ok = 0;
-                       
+
                        for (j = 0; j < CRYPTO_INVALID; j++) {
                                if (!strcasecmp(fields[i], SUITES[j].name)) {
                                        smh->crypto_suite_order[k++] = SUITES[j].type;
@@ -1414,7 +1414,7 @@ static void switch_core_session_parse_crypto_prefs(switch_core_session_t *sessio
                                        break;
                                }
                        }
-                       
+
                        if (!ok) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "INVALID SUITE SUPPLIED\n");
                        }
@@ -1429,7 +1429,7 @@ static void switch_core_session_parse_crypto_prefs(switch_core_session_t *sessio
 
 
 
-SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_session_t *session, 
+SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_session_t *session,
                                                                                                                           const char *varname,
                                                                                                                          switch_media_type_t type, const char *crypto, int crypto_tag, switch_sdp_type_t sdp_type)
 {
@@ -1451,14 +1451,14 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
        if (switch_channel_test_flag(session->channel, CF_AVPF)) {
                return 0;
        }
-       
+
        engine = &session->media_handle->engines[type];
-       
+
        for (i = 0; smh->crypto_suite_order[i] != CRYPTO_INVALID; i++) {
                switch_rtp_crypto_key_type_t j = SUITES[smh->crypto_suite_order[i]].type;
-               
+
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"looking for crypto suite [%s] in [%s]\n", SUITES[j].name, crypto);
-               
+
                if (switch_stristr(SUITES[j].name, crypto)) {
                        ctype = SUITES[j].type;
                        vval = SUITES[j].name;
@@ -1494,7 +1494,7 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
 
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Change Remote key to [%s]\n", crypto);
                                engine->ssec[engine->crypto_type].remote_crypto_key = switch_core_session_strdup(session, crypto);
-                               
+
                                if (engine->type == SWITCH_MEDIA_TYPE_AUDIO) {
                                        switch_channel_set_variable(session->channel, "srtp_remote_audio_crypto_key", crypto);
                                        switch_channel_set_variable_printf(session->channel, "srtp_remote_audio_crypto_tag", "%d", crypto_tag);
@@ -1510,15 +1510,15 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
                                }
 
                                engine->ssec[engine->crypto_type].crypto_tag = crypto_tag;
-                                                               
-                               
+
+
                                if (switch_rtp_ready(engine->rtp_session) && switch_channel_test_flag(session->channel, CF_SECURE)) {
                                        switch_core_media_add_crypto(&engine->ssec[engine->crypto_type], engine->ssec[engine->crypto_type].remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
                                        switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_RECV, engine->ssec[engine->crypto_type].crypto_tag,
                                                                                          engine->ssec[engine->crypto_type].crypto_type, engine->ssec[engine->crypto_type].remote_raw_key, SUITES[engine->ssec[engine->crypto_type].crypto_type].keylen);
                                }
                                got_crypto++;
-                               
+
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Ignoring unacceptable key\n");
                        }
@@ -1546,7 +1546,7 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
 
                engine->ssec[engine->crypto_type].crypto_tag = crypto_tag;
                got_crypto++;
-               
+
                switch_channel_set_variable(session->channel, varname, vval);
                switch_channel_set_flag(smh->session->channel, CF_SECURE);
 
@@ -1664,8 +1664,8 @@ SWITCH_DECLARE(void) switch_core_media_sync_stats(switch_core_session_t *session
        }
 
        a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
-       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];      
-       t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT];       
+       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
+       t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT];
 
        if (a_engine->rtp_session) {
                switch_rtp_sync_stats(a_engine->rtp_session);
@@ -1683,7 +1683,7 @@ SWITCH_DECLARE(void) switch_core_media_sync_stats(switch_core_session_t *session
 
 SWITCH_DECLARE(void) switch_core_media_set_stats(switch_core_session_t *session)
 {
-       
+
        if (!session->media_handle) {
                return;
        }
@@ -1709,10 +1709,10 @@ SWITCH_DECLARE(void) switch_media_handle_destroy(switch_core_session_t *session)
        }
 
        a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
-       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];      
-       //t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT];     
+       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
+       //t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT];
+
 
-       
        if (smh->video_timer.timer_interface) {
                switch_core_timer_destroy(&smh->video_timer);
        }
@@ -1781,11 +1781,11 @@ SWITCH_DECLARE(switch_status_t) switch_media_handle_create(switch_media_handle_t
                }
 
 
-               
+
                session->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO].read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
                session->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO].type = SWITCH_MEDIA_TYPE_VIDEO;
                session->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO].crypto_type = CRYPTO_INVALID;
-               
+
 
                switch_channel_set_variable(session->channel, "video_media_flow", "sendrecv");
                switch_channel_set_variable(session->channel, "audio_media_flow", "sendrecv");
@@ -1800,7 +1800,7 @@ SWITCH_DECLARE(switch_status_t) switch_media_handle_create(switch_media_handle_t
                }
 
                session->media_handle->mparams = params;
-               
+
                if (!session->media_handle->mparams->video_key_freq) {
                        session->media_handle->mparams->video_key_freq = 10000000;
                }
@@ -1818,13 +1818,13 @@ SWITCH_DECLARE(switch_status_t) switch_media_handle_create(switch_media_handle_t
                switch_mutex_init(&session->media_handle->sdp_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
                switch_mutex_init(&session->media_handle->control_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
 
-               session->media_handle->engines[SWITCH_MEDIA_TYPE_AUDIO].ssrc = 
+               session->media_handle->engines[SWITCH_MEDIA_TYPE_AUDIO].ssrc =
                        (uint32_t) ((intptr_t) &session->media_handle->engines[SWITCH_MEDIA_TYPE_AUDIO] + (uint32_t) time(NULL));
 
-               session->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO].ssrc = 
+               session->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO].ssrc =
                        (uint32_t) ((intptr_t) &session->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO] + (uint32_t) time(NULL) / 2);
 
-               session->media_handle->engines[SWITCH_MEDIA_TYPE_TEXT].ssrc = 
+               session->media_handle->engines[SWITCH_MEDIA_TYPE_TEXT].ssrc =
                        (uint32_t) ((intptr_t) &session->media_handle->engines[SWITCH_MEDIA_TYPE_TEXT] + (uint32_t) time(NULL) / 2);
 
 
@@ -1857,7 +1857,7 @@ SWITCH_DECLARE(void) switch_media_handle_set_media_flag(switch_media_handle_t *s
        switch_assert(smh);
 
        smh->media_flags[flag] = 1;
-       
+
 }
 
 SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[SCMF_MAX])
@@ -1870,7 +1870,7 @@ SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *
                        smh->media_flags[i] = flags[i];
                }
        }
-       
+
 }
 
 SWITCH_DECLARE(void) switch_media_handle_clear_media_flag(switch_media_handle_t *smh, switch_core_media_flag_t flag)
@@ -1901,7 +1901,7 @@ SWITCH_DECLARE(switch_media_flow_t) switch_core_session_media_flow(switch_core_s
        if (!smh->media_flags[SCMF_RUNNING]) {
                goto end;
        }
-       
+
        engine = &smh->engines[type];
        flow = engine->smode;
 
@@ -1935,7 +1935,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_clear_media_handle(switch_co
        if (!session->media_handle) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1951,7 +1951,7 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses
        const char *ocodec = NULL, *val;
        switch_media_handle_t *smh;
        char *tmp_codec_string;
-       
+
        switch_assert(session);
 
        if (!(smh = session->media_handle)) {
@@ -1987,7 +1987,7 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses
                codec_string = ocodec;
                goto ready;
        }
-       
+
        if (!(codec_string = switch_channel_get_variable(session->channel, "codec_string"))) {
                codec_string = switch_core_media_get_codec_string(smh->session);
        }
@@ -2006,7 +2006,7 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses
        if (!codec_string) {
                codec_string = "PCMU@20i,PCMA@20i,speex@20i";
        }
-       
+
        tmp_codec_string = switch_core_session_strdup(smh->session, codec_string);
        switch_channel_set_variable(session->channel, "rtp_use_codec_string", codec_string);
        smh->codec_order_last = switch_separate_string(tmp_codec_string, ',', smh->codec_order, SWITCH_MAX_CODECS);
@@ -2053,25 +2053,25 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
 
                        switch_channel_set_variable(session->channel, "jitterbuffer_msec", input);
                }
-               
+
                if (v_engine->rtp_session) {
                        if (!strncasecmp(input, "vbsize:", 7)) {
                                int frames = 0, max_frames = 0;
                                s = input + 7;
-                               
+
                                frames = atoi(s);
 
                                if ((s = strchr(s, ':')) && *(s+1) != '\0') {
                                        max_frames = atoi(s+1);
                                }
-                               
+
                                if (frames > 0) {
                                        switch_rtp_set_video_buffer_size(v_engine->rtp_session, frames, max_frames);
                                }
                                return;
                        } else if (!strncasecmp(input, "vdebug:", 7)) {
                                s = input + 7;
-                               
+
                                if (s && !strcmp(s, "off")) {
                                        s = NULL;
                                }
@@ -2084,20 +2084,20 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
                        if (!strncasecmp(input, "tbsize:", 7)) {
                                int frames = 0, max_frames = 0;
                                s = input + 7;
-                               
+
                                frames = atoi(s);
 
                                if ((s = strchr(s, ':')) && *(s+1) != '\0') {
                                        max_frames = atoi(s+1);
                                }
-                               
+
                                if (frames > 0) {
                                        switch_rtp_set_video_buffer_size(t_engine->rtp_session, frames, max_frames);
                                }
                                return;
                        } else if (!strncasecmp(input, "tdebug:", 7)) {
                                s = input + 7;
-                               
+
                                if (s && !strcmp(s, "off")) {
                                        s = NULL;
                                }
@@ -2106,7 +2106,7 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
                        }
                }
        }
-       
+
 
        if (jb_msec || (val = switch_channel_get_variable(session->channel, "jitterbuffer_msec")) || (val = smh->mparams->jb_msec)) {
                char *p;
@@ -2117,7 +2117,7 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
                        if (strchr(val, 'p') && jb_msec > 0) {
                                jb_msec *= -1;
                        }
-                                       
+
                        if ((p = strchr(val, ':'))) {
                                p++;
                                maxlen = atoi(p);
@@ -2141,7 +2141,7 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
                                                          "Invalid Jitterbuffer spec [%d] must be between 10 and 10000\n", jb_msec);
                } else {
                        int qlen, maxqlen = 50;
-                       
+
                        qlen = jb_msec / (a_engine->read_impl.microseconds_per_packet / 1000);
 
                        if (maxlen) {
@@ -2152,11 +2152,11 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
                                maxqlen = qlen * 5;
                        }
                        if (switch_rtp_activate_jitter_buffer(a_engine->rtp_session, qlen, maxqlen,
-                                                                                                 a_engine->read_impl.samples_per_packet, 
+                                                                                                 a_engine->read_impl.samples_per_packet,
                                                                                                  a_engine->read_impl.samples_per_second) == SWITCH_STATUS_SUCCESS) {
                                if (!silent) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), 
-                                                                         SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
+                                                                         SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n",
                                                                          jb_msec, qlen, maxqlen);
                                }
                                switch_channel_set_flag(session->channel, CF_JITTERBUFFER);
@@ -2164,10 +2164,10 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
                                        switch_channel_set_flag(session->channel, CF_JITTERBUFFER_PLC);
                                }
                        } else if (!silent) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
                                                                  SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", jb_msec, qlen);
                        }
-                               
+
                }
        }
 
@@ -2197,11 +2197,11 @@ static void check_jb_sync(switch_core_session_t *session)
        }
 
        v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
-       
+
        if ((var = switch_channel_get_variable_dup(session->channel, "jb_av_sync_msec", SWITCH_FALSE, -1))) {
                int tmp;
                char *p;
-               
+
                if (!strcasecmp(var, "disabled")) {
                        return;
                }
@@ -2217,7 +2217,7 @@ static void check_jb_sync(switch_core_session_t *session)
                        frames = atoi(p);
                }
        }
-       
+
        switch_rtp_get_video_buffer_size(v_engine->rtp_session, &min_frames, &max_frames, &cur_frames, NULL);
 
        fps = video_globals.fps;
@@ -2234,11 +2234,11 @@ static void check_jb_sync(switch_core_session_t *session)
                        sync_audio = 1;
                }
        }
-       
+
        if (!jb_sync_msec) {
                jb_sync_msec = (double)(1000 / fps) * frames;
        }
-       
+
        if (frames != cur_frames && frames > min_frames) {
                switch_rtp_set_video_buffer_size(v_engine->rtp_session, frames, 0);
                sync_audio = 1;
@@ -2246,12 +2246,12 @@ static void check_jb_sync(switch_core_session_t *session)
        }
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
-                                         SWITCH_LOG_DEBUG1, "%s %s \"%s\" Sync A/V JB to %dms %u VFrames FPS %u a:%s v:%s sync_ms:%d\n", 
+                                         SWITCH_LOG_DEBUG1, "%s %s \"%s\" Sync A/V JB to %dms %u VFrames FPS %u a:%s v:%s sync_ms:%d\n",
                                          switch_core_session_get_uuid(session),
                                          switch_channel_get_name(session->channel),
                                          switch_channel_get_variable_dup(session->channel, "caller_id_name", SWITCH_FALSE, -1),
                                          jb_sync_msec, frames, video_globals.fps, sync_audio ? "yes" : "no", sync_video ? "yes" : "no", jb_sync_msec);
-       
+
        if (sync_audio) {
                check_jb(session, NULL, jb_sync_msec, 0, SWITCH_TRUE);
        }
@@ -2292,7 +2292,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_lock_unlock(switch_core_s
        if (lock) {
                if (smh->read_mutex[type] && switch_mutex_trylock(smh->read_mutex[type]) != SWITCH_STATUS_SUCCESS) {
                        /* return CNG, another thread is already reading  */
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being read for %s\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being read for %s\n",
                                                          switch_channel_get_name(session->channel), type2str(type));
                        return SWITCH_STATUS_INUSE;
                }
@@ -2312,7 +2312,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_text_factory_create(switch_rtp_text_f
        int x;
 
        *tfP = switch_core_alloc(pool, sizeof(**tfP));
-       
+
        switch_buffer_create_dynamic(&(*tfP)->write_buffer,  512, 1024, 0);
        (*tfP)->pool = pool;
        (*tfP)->text_write_frame_data = switch_core_alloc(pool, SWITCH_RTP_MAX_BUF_LEN);
@@ -2355,13 +2355,13 @@ static int get_rtt_red_seq(int want_seq, void *data, switch_size_t datalen, int
        *new_datalen = datalen;
 
        *(buf + datalen) = '\0';
-       
+
        while (*buf & 0x80) {
                if (buf + 3 > e) {
                        *new_datalen = 0;
                        return 0;
                }
-               
+
                pt[count] = *buf & 0x7F;
                len[count] = (ntohs(*(uint16_t *)(buf + 2)) & 0x03ff);
                buf += 4;
@@ -2390,11 +2390,11 @@ static int get_rtt_red_seq(int want_seq, void *data, switch_size_t datalen, int
        *new_payload = pt[idx];
 
        memcpy(new_data, buf, len[idx]);
-       
+
        *(((char *)new_data) + len[idx]) = '\0';
 
        return 1;
-       
+
 }
 
 static void *get_rtt_payload(void *data, switch_size_t datalen, switch_payload_t *new_payload, uint32_t *new_datalen, int *red_level)
@@ -2427,7 +2427,7 @@ static void *get_rtt_payload(void *data, switch_size_t datalen, switch_payload_t
                *new_datalen = 0;
                return NULL;
        }
-       
+
        return buf;
 }
 
@@ -2471,7 +2471,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
 
        if (smh->read_mutex[type] && switch_mutex_trylock(smh->read_mutex[type]) != SWITCH_STATUS_SUCCESS) {
                /* return CNG, another thread is already reading  */
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being read for %s\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being read for %s\n",
                                                  switch_channel_get_name(session->channel), type2str(type));
                return SWITCH_STATUS_INUSE;
        }
@@ -2482,7 +2482,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
        engine->read_frame.m = SWITCH_FALSE;
        engine->read_frame.img = NULL;
        engine->read_frame.payload = 0;
-       
+
        while (smh->media_flags[SCMF_RUNNING] && engine->read_frame.datalen == 0) {
                engine->read_frame.flags = SFF_NONE;
                status = switch_rtp_zerocopy_read_frame(engine->rtp_session, &engine->read_frame, flags);
@@ -2499,7 +2499,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                                        switch_channel_execute_on(session->channel, "execute_on_media_timeout");
                                        switch_goto_status(SWITCH_STATUS_SUCCESS, end);
                                }
-                               
+
 
                                switch_channel_hangup(session->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
                        }
@@ -2510,7 +2510,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                        status = SWITCH_STATUS_INUSE;
                        goto end;
                }
-       
+
                if (status == SWITCH_STATUS_BREAK) {
                        goto end;
                }
@@ -2521,11 +2521,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                                        smh->vid_started = switch_epoch_time_now(NULL);
                                }
                                smh->vid_frames++;
-                               
+
                                if ((smh->vid_frames % 5) == 0) {
                                        switch_core_media_get_video_fps(session);
                                }
-                               
+
                                if (video_globals.fps && (!video_globals.synced || ((smh->vid_frames % 300) == 0))) {
                                        check_jb_sync(session);
                                }
@@ -2539,7 +2539,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                        int rtp_hold_timeout_sec = 0;
 
                        engine->reset_codec = 0;
-                                       
+
                        if (switch_rtp_ready(engine->rtp_session)) {
                                if (type == SWITCH_MEDIA_TYPE_VIDEO) {
                                        switch_core_media_set_video_codec(session, 1);
@@ -2549,7 +2549,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                                                switch_goto_status(SWITCH_STATUS_GENERR, end);
                                        }
                                }
-                               
+
                                if (type == SWITCH_MEDIA_TYPE_AUDIO && engine->read_impl.samples_per_second) {
                                        if ((val = switch_channel_get_variable(session->channel, "rtp_timeout_sec"))) {
                                                int v = atoi(val);
@@ -2557,7 +2557,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                                                        rtp_timeout_sec = v;
                                                }
                                        }
-                               
+
                                        if ((val = switch_channel_get_variable(session->channel, "rtp_hold_timeout_sec"))) {
                                                int v = atoi(val);
                                                if (v >= 0) {
@@ -2600,7 +2600,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                        memset((*frame)->data, 0, (*frame)->datalen);
                        switch_goto_status(SWITCH_STATUS_SUCCESS, end);
                }
-                               
+
 
                /* Try to read an RTCP frame, if successful raise an event */
                if (switch_rtcp_zerocopy_read_frame(engine->rtp_session, &rtcp_frame) == SWITCH_STATUS_SUCCESS) {
@@ -2687,7 +2687,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                        switch_rtp_dequeue_dtmf(engine->rtp_session, &dtmf);
                        switch_channel_queue_dtmf(session->channel, &dtmf);
                }
-               
+
                if (type != SWITCH_MEDIA_TYPE_TEXT && engine->read_frame.datalen > 0) {
                        uint32_t bytes = 0;
                        int frames = 1;
@@ -2698,7 +2698,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                                        *frame = NULL;
                                        switch_goto_status(SWITCH_STATUS_GENERR, end);
                                }
-                               
+
                                /* check for timing issues */
                                if (smh->media_flags[SCMF_AUTOFIX_TIMING]) {
                                        char is_vbr;
@@ -2706,10 +2706,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
 
                                        engine->check_frames++;
                                        /* CBR */
-                                       if ((smh->media_flags[SCMF_AUTOFIX_TIMING] && (engine->read_frame.datalen % 10) == 0) 
+                                       if ((smh->media_flags[SCMF_AUTOFIX_TIMING] && (engine->read_frame.datalen % 10) == 0)
                                                        && (engine->check_frames < MAX_CODEC_CHECK_FRAMES) && !is_vbr) {
                                                engine->check_frames++;
-                                               
+
                                                if (engine->last_ts && engine->read_frame.datalen != engine->read_impl.encoded_bytes_per_packet) {
 
                                                        uint32_t codec_ms = (int) (engine->read_frame.timestamp -
@@ -2774,7 +2774,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                                                engine->last_ts = engine->read_frame.timestamp;
                                                engine->last_seq = engine->read_frame.seq;
 
-                                       } else if (smh->media_flags[SCMF_AUTOFIX_TIMING] && is_vbr && switch_rtp_get_jitter_buffer(engine->rtp_session) 
+                                       } else if (smh->media_flags[SCMF_AUTOFIX_TIMING] && is_vbr && switch_rtp_get_jitter_buffer(engine->rtp_session)
                                                           && engine->read_frame.timestamp && engine->read_frame.seq && engine->read_impl.samples_per_second) {
                                                uint32_t codec_ms = (int) (engine->read_frame.timestamp -
                                                                   engine->last_ts) / (engine->read_impl.samples_per_second / 1000);
@@ -2842,9 +2842,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                                        (!smh->mparams->te || engine->read_frame.payload != smh->mparams->te) &&
                                        engine->read_frame.payload != engine->cur_payload_map->recv_pt &&
                                        engine->read_frame.payload != engine->cur_payload_map->pt) {
-                                       
+
                                        payload_map_t *pmap;
-                                       
+
 
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                          "alternate payload received (received %d, expecting %d)\n",
@@ -2860,14 +2860,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                                                                                          "Changing current codec to %s (payload type %d).\n",
                                                                                          pmap->iananame, pmap->pt);
-                                                               
+
                                                        /* mark to re-set codec */
                                                        engine->reset_codec = 1;
                                                        break;
                                                }
                                        }
                                        switch_mutex_unlock(smh->sdp_mutex);
-                               
+
                                        if (!engine->reset_codec) {
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                                                                                  "Could not change to payload type %d, ignoring...\n",
@@ -2898,14 +2898,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
        if (type == SWITCH_MEDIA_TYPE_TEXT && !switch_test_flag((&engine->read_frame), SFF_CNG)) {
                if (engine->red_pt) {
                        unsigned char *p = engine->read_frame.data;
-                       
+
                        *(p + engine->read_frame.datalen) = '\0';
                        engine->tf->text_frame = engine->read_frame;
-                       
+
                        if (switch_test_flag((&engine->read_frame), SFF_PLC)) {
                                switch_jb_t *jb = switch_core_session_get_jb(session, SWITCH_MEDIA_TYPE_TEXT);
                                int i = 0;
-                                       
+
                                engine->tf->text_frame.datalen = 0;
 
                                for (i = 1; i < 3; i++) {
@@ -2916,14 +2916,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
 
                                        if (switch_jb_peek_frame(jb, 0, engine->read_frame.seq, i, &frame) == SWITCH_STATUS_SUCCESS) {
                                                if (get_rtt_red_seq(engine->read_frame.seq,
-                                                                                       frame.data, 
-                                                                                       frame.datalen, 
+                                                                                       frame.data,
+                                                                                       frame.datalen,
                                                                                        frame.seq,
                                                                                        &engine->tf->text_frame.payload,
                                                                                        engine->tf->text_frame.data,
                                                                                        &engine->tf->text_frame.datalen)) {
                                                        break;
-                                                       
+
                                                }
                                        }
 
@@ -2935,8 +2935,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
                                }
 
                        } else {
-                               if (!(engine->tf->text_frame.data = get_rtt_payload(engine->read_frame.data, 
-                                                                                                                                       engine->tf->text_frame.datalen, 
+                               if (!(engine->tf->text_frame.data = get_rtt_payload(engine->read_frame.data,
+                                                                                                                                       engine->tf->text_frame.datalen,
                                                                                                                                        &engine->tf->text_frame.payload,
                                                                                                                                        &engine->tf->text_frame.datalen,
                                                                                                                                        &engine->tf->red_level))) {
@@ -2968,7 +2968,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
 }
 
 //?
-SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_session_t *session,
                                                                                                  switch_frame_t *frame, switch_io_flag_t flags, int stream_id, switch_media_type_t type)
 {
        switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -2991,7 +2991,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_sessio
 
        if (switch_channel_test_flag(session->channel, CF_VIDEO_ONLY) && type == SWITCH_MEDIA_TYPE_AUDIO) {
                return SWITCH_STATUS_SUCCESS;
-       }  
+       }
 
        if (type != SWITCH_MEDIA_TYPE_TEXT) {
 
@@ -3036,7 +3036,7 @@ SWITCH_DECLARE(void) switch_core_media_copy_t38_options(switch_t38_options_t *t3
        switch_t38_options_t *local_t38_options = switch_channel_get_private(channel, "t38_options");
 
        switch_assert(t38_options);
-       
+
        if (!local_t38_options) {
                local_t38_options = switch_core_session_alloc(session, sizeof(switch_t38_options_t));
        }
@@ -3086,7 +3086,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_get_offered_pt(switch_core_ses
 
 //#define get_int_value(_var, _set) { const char *__v = switch_channel_get_variable(session->channel, _var); if (__v) { _set = atol(__v);} }
 //?
-static void switch_core_session_parse_codec_settings(switch_core_session_t *session, switch_media_type_t type) 
+static void switch_core_session_parse_codec_settings(switch_core_session_t *session, switch_media_type_t type)
 {
        switch_media_handle_t *smh;
        switch_rtp_engine_t *engine;
@@ -3098,7 +3098,7 @@ static void switch_core_session_parse_codec_settings(switch_core_session_t *sess
        }
 
        if (!(engine = &smh->engines[type])) return;
-       
+
        switch(type) {
        case SWITCH_MEDIA_TYPE_AUDIO:
                break;
@@ -3113,11 +3113,11 @@ static void switch_core_session_parse_codec_settings(switch_core_session_t *sess
                if (!(bwv = switch_channel_get_variable(session->channel, "rtp_video_max_bandwidth"))) {
                        bwv = switch_channel_get_variable(session->channel, "rtp_video_max_bandwidth_out");
                }
-               
+
                if (!bwv) {
                        bwv = "1mb";
                }
-               
+
                system_bw = switch_parse_bandwidth_string(bwv);
 
                if (engine->sdp_bw && engine->sdp_bw <= system_bw) {
@@ -3197,7 +3197,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se
                } else {
                        v_engine->read_frame.rate = v_engine->cur_payload_map->rm_rate;
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set VIDEO Codec %s %s/%ld %d ms\n",
-                                                         switch_channel_get_name(session->channel), v_engine->cur_payload_map->rm_encoding, 
+                                                         switch_channel_get_name(session->channel), v_engine->cur_payload_map->rm_encoding,
                                                          v_engine->cur_payload_map->rm_rate, v_engine->cur_payload_map->codec_ms);
                        v_engine->read_frame.codec = &v_engine->read_codec;
 
@@ -3209,7 +3209,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se
                        switch_core_session_set_video_write_codec(session, &v_engine->write_codec);
 
 
-                       switch_channel_set_variable_printf(session->channel, "rtp_last_video_codec_string", "%s@%dh", 
+                       switch_channel_set_variable_printf(session->channel, "rtp_last_video_codec_string", "%s@%dh",
                                                                                           v_engine->cur_payload_map->rm_encoding, v_engine->cur_payload_map->rm_rate);
 
 
@@ -3220,14 +3220,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se
                                msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ;
 
                                switch_rtp_set_default_payload(v_engine->rtp_session, v_engine->cur_payload_map->pt);
-                               
+
                                //XX
 
                                switch_core_session_receive_message(session, &msg);
 
 
                        }
-                       
+
                        switch_channel_set_variable(session->channel, "rtp_use_video_codec_name", v_engine->cur_payload_map->rm_encoding);
                        switch_channel_set_variable(session->channel, "rtp_use_video_codec_fmtp", v_engine->cur_payload_map->rm_fmtp);
                        switch_channel_set_variable_printf(session->channel, "rtp_use_video_codec_rate", "%d", v_engine->cur_payload_map->rm_rate);
@@ -3266,14 +3266,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
                if (strcasecmp(a_engine->read_impl.iananame, a_engine->cur_payload_map->iananame) ||
                        (uint32_t) a_engine->read_impl.microseconds_per_packet / 1000 != a_engine->cur_payload_map->codec_ms ||
                        a_engine->read_impl.samples_per_second != a_engine->cur_payload_map->rm_rate ) {
-                       
+
                        if (session->read_resampler) {
                                switch_mutex_lock(session->resample_mutex);
                                switch_resample_destroy(&session->read_resampler);
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Deactivating read resampler\n");
                                switch_mutex_unlock(session->resample_mutex);
                        }
-                       
+
                        if (session->write_resampler) {
                                switch_mutex_lock(session->resample_mutex);
                                switch_resample_destroy(&session->write_resampler);
@@ -3284,16 +3284,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
                        switch_core_session_reset(session, 0, 0);
                        switch_channel_audio_sync(session->channel);
 
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                          "Changing Codec from %s@%dms@%dhz to %s@%dms@%luhz\n",
-                                                         a_engine->read_impl.iananame, 
+                                                         a_engine->read_impl.iananame,
                                                          a_engine->read_impl.microseconds_per_packet / 1000,
                                                          a_engine->read_impl.actual_samples_per_second,
 
-                                                         a_engine->cur_payload_map->iananame, 
+                                                         a_engine->cur_payload_map->iananame,
                                                          a_engine->cur_payload_map->codec_ms,
                                                          a_engine->cur_payload_map->rm_rate);
-                       
+
                        switch_yield(a_engine->read_impl.microseconds_per_packet);
                        switch_core_session_lock_codec_write(session);
                        switch_core_session_lock_codec_read(session);
@@ -3325,7 +3325,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
                switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
                switch_goto_status(SWITCH_STATUS_FALSE, end);
        }
-       
+
        a_engine->read_codec.session = session;
 
 
@@ -3356,7 +3356,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
        switch_channel_set_variable_printf(session->channel, "rtp_use_codec_rate", "%d", a_engine->cur_payload_map->rm_rate);
        switch_channel_set_variable_printf(session->channel, "rtp_use_codec_ptime", "%d", a_engine->cur_payload_map->codec_ms);
        switch_channel_set_variable_printf(session->channel, "rtp_use_codec_channels", "%d", a_engine->cur_payload_map->channels);
-       switch_channel_set_variable_printf(session->channel, "rtp_last_audio_codec_string", "%s@%dh@%di@%dc", 
+       switch_channel_set_variable_printf(session->channel, "rtp_last_audio_codec_string", "%s@%dh@%di@%dc",
                                                                           a_engine->cur_payload_map->iananame, a_engine->cur_payload_map->rm_rate, a_engine->cur_payload_map->codec_ms, a_engine->cur_payload_map->channels);
 
        switch_assert(a_engine->read_codec.implementation);
@@ -3370,9 +3370,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
 
        if (switch_rtp_ready(a_engine->rtp_session)) {
                switch_assert(a_engine->read_codec.implementation);
-               
+
                if (switch_rtp_change_interval(a_engine->rtp_session,
-                                                                          a_engine->read_impl.microseconds_per_packet, 
+                                                                          a_engine->read_impl.microseconds_per_packet,
                                                                           a_engine->read_impl.samples_per_packet) != SWITCH_STATUS_SUCCESS) {
                        switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        switch_goto_status(SWITCH_STATUS_FALSE, end);
@@ -3387,7 +3387,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
        }
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set Codec %s %s/%ld %d ms %d samples %d bits %d channels\n",
-                                         switch_channel_get_name(session->channel), a_engine->cur_payload_map->iananame, a_engine->cur_payload_map->rm_rate, 
+                                         switch_channel_get_name(session->channel), a_engine->cur_payload_map->iananame, a_engine->cur_payload_map->rm_rate,
                                          a_engine->cur_payload_map->codec_ms,
                                          a_engine->read_impl.samples_per_packet, a_engine->read_impl.bits_per_second, a_engine->read_impl.number_of_channels);
        a_engine->read_frame.codec = &a_engine->read_codec;
@@ -3415,7 +3415,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
 
        return status;
 }
-static void clear_ice(switch_core_session_t *session, switch_media_type_t type) 
+static void clear_ice(switch_core_session_t *session, switch_media_type_t type)
 {
        switch_media_handle_t *smh;
        switch_rtp_engine_t *engine;
@@ -3469,7 +3469,7 @@ SWITCH_DECLARE(void) switch_core_media_pause(switch_core_session_t *session)
        if (a_engine->rtp_session) {
                switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
        }
-       
+
        if (v_engine->rtp_session) {
                switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
        }
@@ -3497,7 +3497,7 @@ SWITCH_DECLARE(void) switch_core_media_resume(switch_core_session_t *session)
        if (a_engine->rtp_session) {
                switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
        }
-       
+
        if (v_engine->rtp_session) {
                switch_rtp_clear_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_PAUSE);
        }
@@ -3545,7 +3545,7 @@ SWITCH_DECLARE(void) switch_core_media_check_video_codecs(switch_core_session_t
                int i;
                smh->video_count = 0;
                for (i = 0; i < smh->mparams->num_codecs; i++) {
-                       
+
                        if (smh->codecs[i]->codec_type == SWITCH_CODEC_TYPE_VIDEO) {
                                if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_INBOUND &&
                                        switch_channel_test_flag(session->channel, CF_NOVIDEO)) {
@@ -3618,14 +3618,14 @@ static switch_status_t ip_choose_family(switch_media_handle_t *smh, const char *
        if (strchr(ip, ':')) {
                if (!zstr(smh->mparams->rtpip6)) {
                        smh->mparams->rtpip = smh->mparams->rtpip6;
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "%s choosing family v6\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "%s choosing family v6\n",
                                                          switch_channel_get_name(smh->session->channel));
                        status = SWITCH_STATUS_SUCCESS;
                }
        } else {
                if (!zstr(smh->mparams->rtpip4)) {
                        smh->mparams->rtpip = smh->mparams->rtpip4;
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "%s choosing family v4\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "%s choosing family v4\n",
                                                          switch_channel_get_name(smh->session->channel));
                        status = SWITCH_STATUS_SUCCESS;
                }
@@ -3693,7 +3693,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                        if (zstr(attr->a_name)) {
                                continue;
                        }
-               
+
                        if (!strcasecmp(attr->a_name, "ice-ufrag")) {
                                if (engine->ice_in.ufrag && !strcmp(engine->ice_in.ufrag, attr->a_value)) {
                                        engine->new_ice = 0;
@@ -3726,7 +3726,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                char *p;
 
                                engine->remote_dtls_fingerprint.type = switch_core_session_strdup(smh->session, attr->a_value);
-                       
+
                                if ((p = strchr(engine->remote_dtls_fingerprint.type, ' '))) {
                                        *p++ = '\0';
 
@@ -3739,7 +3739,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                                engine->new_ice = 1;
                                        }
                                }
-                       
+
 
                                //if (strcasecmp(engine->remote_dtls_fingerprint.type, "sha-256")) {
                                //      switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Unsupported fingerprint type.\n");
@@ -3750,14 +3750,14 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
 
                                generate_local_fingerprint(smh, type);
                                switch_channel_set_flag(smh->session->channel, CF_DTLS);
-                       
+
                        } else if (!engine->remote_ssrc && !strcasecmp(attr->a_name, "ssrc") && attr->a_value) {
                                engine->remote_ssrc = (uint32_t) atol(attr->a_value);
 
                                if (engine->rtp_session && engine->remote_ssrc) {
                                        switch_rtp_set_remote_ssrc(engine->rtp_session, engine->remote_ssrc);
                                }
-       
+
 
 #ifdef RTCP_MUX
                        } else if (!strcasecmp(attr->a_name, "rtcp-mux")) {
@@ -3767,7 +3767,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
 
                                if (!smh->mparams->rtcp_audio_interval_msec) {
                                        smh->mparams->rtcp_audio_interval_msec = SWITCH_RTCP_AUDIO_INTERVAL_MSEC;
-                               }                               
+                               }
 #endif
                        } else if (!strcasecmp(attr->a_name, "candidate")) {
                                switch_channel_set_flag(smh->session->channel, CF_ICE);
@@ -3783,9 +3783,9 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                }
 
                                data = switch_core_session_strdup(smh->session, attr->a_value);
-                       
+
                                argc = switch_split(data, ' ', fields);
-                       
+
                                cid = fields[1] ? atoi(fields[1]) - 1 : 0;
 
                                if (argc < 5 || engine->ice_in.cand_idx[cid] >= MAX_CAND - 1) {
@@ -3798,31 +3798,31 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                }
 
                                if (!ip_possible(smh, fields[4])) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, 
-                                                                         "Drop %s Candidate cid: %d proto: %s type: %s addr: %s:%s (no network path)\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG,
+                                                                         "Drop %s Candidate cid: %d proto: %s type: %s addr: %s:%s (no network path)\n",
                                                                          type == SWITCH_MEDIA_TYPE_VIDEO ? "video" : "audio",
                                                                          cid+1, fields[2], fields[7], fields[4], fields[5]);
                                        continue;
                                } else {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, 
-                                                                         "Save %s Candidate cid: %d proto: %s type: %s addr: %s:%s\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG,
+                                                                         "Save %s Candidate cid: %d proto: %s type: %s addr: %s:%s\n",
                                                                          type == SWITCH_MEDIA_TYPE_VIDEO ? "video" : "audio",
                                                                          cid+1, fields[2], fields[7], fields[4], fields[5]);
                                }
-               
-                       
+
+
                                engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].foundation = switch_core_session_strdup(smh->session, fields[0]);
                                engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].component_id = atoi(fields[1]);
                                engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].transport = switch_core_session_strdup(smh->session, fields[2]);
                                engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].priority = atol(fields[3]);
                                engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].con_addr = switch_core_session_strdup(smh->session, fields[4]);
                                engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].con_port = (switch_port_t)atoi(fields[5]);
-                               
+
                                j = 6;
 
                                while(j < argc && fields[j+1]) {
                                        if (!strcasecmp(fields[j], "typ")) {
-                                               engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].cand_type = switch_core_session_strdup(smh->session, fields[j+1]);                                                      
+                                               engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].cand_type = switch_core_session_strdup(smh->session, fields[j+1]);
                                        } else if (!strcasecmp(fields[j], "raddr")) {
                                                engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].raddr = switch_core_session_strdup(smh->session, fields[j+1]);
                                        } else if (!strcasecmp(fields[j], "rport")) {
@@ -3830,7 +3830,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                        } else if (!strcasecmp(fields[j], "generation")) {
                                                engine->ice_in.cands[engine->ice_in.cand_idx[cid]][cid].generation = switch_core_session_strdup(smh->session, fields[j+1]);
                                        }
-                               
+
                                        j += 2;
                                }
 
@@ -3851,7 +3851,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                for (ai = 0; ai < engine->cand_acl_count; ai++) {
                        for (i = 0; i < engine->ice_in.cand_idx[cid]; i++) {
                                if (switch_check_network_list_ip(engine->ice_in.cands[i][cid].con_addr, engine->cand_acl[ai])) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG,
                                                                          "Choose %s candidate, index %d, %s:%d\n", cid ? "rtcp" : "rtp", i,
                                                                          engine->ice_in.cands[i][cid].con_addr, engine->ice_in.cands[i][cid].con_port);
 
@@ -3859,9 +3859,9 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                        engine->ice_in.is_chosen[cid] = 1;
                                        engine->ice_in.cands[i][cid].ready++;
                                        ip_choose_family(smh, engine->ice_in.cands[i][cid].con_addr);
-                                       
+
                                        if (cid == 0 && got_rtcp_mux && engine->ice_in.cand_idx[1] < MAX_CAND) {
-                                               
+
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG,
                                                                                  "Choose same candidate, index %d, for rtcp based on rtcp-mux attribute %s:%d\n", engine->ice_in.cand_idx[1],
                                                                                  engine->ice_in.cands[i][cid].con_addr, engine->ice_in.cands[i][cid].con_port);
@@ -3871,10 +3871,10 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                                engine->ice_in.chosen[1] = engine->ice_in.cand_idx[1];
                                                engine->ice_in.is_chosen[1] = 1;
                                                engine->ice_in.cand_idx[1]++;
-                                               
+
                                                goto done_choosing;
                                        }
-                                       
+
                                        goto next_cid;
                                }
                        }
@@ -3890,7 +3890,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
 
        if (!engine->ice_in.is_chosen[0]) {
                /* PUNT */
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "%s no suitable candidates found.\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "%s no suitable candidates found.\n",
                                                  switch_channel_get_name(smh->session->channel));
                return SWITCH_STATUS_FALSE;
        }
@@ -3907,7 +3907,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
        if (engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr && engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_port) {
                char tmp[80] = "";
                engine->cur_payload_map->remote_sdp_ip = switch_core_session_strdup(smh->session, (char *) engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr);
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG,
                                                  "setting remote %s ice addr to index %d %s:%d based on candidate\n", type2str(type), engine->ice_in.chosen[0],
                                                  engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr, engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_port);
                engine->ice_in.cands[engine->ice_in.chosen[0]][0].ready++;
@@ -3917,14 +3917,14 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
 
                engine->cur_payload_map->remote_sdp_ip = switch_core_session_strdup(smh->session, (char *) engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr);
                engine->cur_payload_map->remote_sdp_port = (switch_port_t) engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_port;
-               
+
                if (!smh->mparams->remote_ip) {
                        smh->mparams->remote_ip = engine->cur_payload_map->remote_sdp_ip;
                }
-               
+
                switch_snprintf(tmp, sizeof(tmp), "%d", engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_port);
                switch_channel_set_variable(smh->session->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr);
-               switch_channel_set_variable(smh->session->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);                                     
+               switch_channel_set_variable(smh->session->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
        }
 
        if (engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port) {
@@ -3933,7 +3933,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                                  engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port);
                engine->remote_rtcp_ice_port = engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port;
                engine->remote_rtcp_ice_addr = switch_core_session_strdup(smh->session, engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr);
-               
+
                engine->remote_rtcp_port = engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port;
        }
 
@@ -3946,7 +3946,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                if (switch_rtp_ready(engine->rtp_session) && engine->ice_in.cands[engine->ice_in.chosen[0]][0].ready && engine->new_ice) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "RE-Activating %s ICE\n", type2str(type));
 
-                       switch_rtp_activate_ice(engine->rtp_session, 
+                       switch_rtp_activate_ice(engine->rtp_session,
                                                                        engine->ice_in.ufrag,
                                                                        engine->ice_out.ufrag,
                                                                        engine->ice_out.pwd,
@@ -3956,28 +3956,28 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                                                        ICE_GOOGLE_JINGLE,
                                                                        NULL
 #else
-                                                                       switch_ice_direction(smh->session) == 
+                                                                       switch_ice_direction(smh->session) ==
                                                                        SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
                                                                        &engine->ice_in
 #endif
                                                                        );
 
-               
+
                        engine->new_ice = 0;
                }
-               
+
 
                if (engine->rtp_session && ((val = switch_channel_get_variable(smh->session->channel,
-                                                                                                                                          type == SWITCH_MEDIA_TYPE_VIDEO ? 
-                                                                                                                                          "rtcp_video_interval_msec" : "rtcp_audio_interval_msec")) 
-                                                                       || (val = type == SWITCH_MEDIA_TYPE_VIDEO ? 
+                                                                                                                                          type == SWITCH_MEDIA_TYPE_VIDEO ?
+                                                                                                                                          "rtcp_video_interval_msec" : "rtcp_audio_interval_msec"))
+                                                                       || (val = type == SWITCH_MEDIA_TYPE_VIDEO ?
                                                                                smh->mparams->rtcp_video_interval_msec : smh->mparams->rtcp_audio_interval_msec))) {
-                       
+
                        switch_port_t remote_rtcp_port = engine->remote_rtcp_port;
 
                        if (remote_rtcp_port) {
                                if (!strcasecmp(val, "passthru")) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Activating %s RTCP PASSTHRU PORT %d\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Activating %s RTCP PASSTHRU PORT %d\n",
                                                                          type2str(type), remote_rtcp_port);
                                        switch_rtp_activate_rtcp(engine->rtp_session, -1, remote_rtcp_port, engine->rtcp_mux > 0);
                                } else {
@@ -3993,15 +3993,15 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                }
                        }
                }
-                       
+
                if (engine->rtp_session && engine->ice_in.cands[engine->ice_in.chosen[1]][1].ready) {
                        if (engine->rtcp_mux > 0 && !strcmp(engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr)
                                && engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port == engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_port) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Skipping %s RTCP ICE (Same as RTP)\n", type2str(type));
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Activating %s RTCP ICE\n", type2str(type));
-                               
-                               switch_rtp_activate_ice(engine->rtp_session, 
+
+                               switch_rtp_activate_ice(engine->rtp_session,
                                                                                engine->ice_in.ufrag,
                                                                                engine->ice_out.ufrag,
                                                                                engine->ice_out.pwd,
@@ -4011,15 +4011,15 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
                                                                                ICE_GOOGLE_JINGLE,
                                                                                NULL
 #else
-                                                                               switch_ice_direction(smh->session) == 
+                                                                               switch_ice_direction(smh->session) ==
                                                                                SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
                                                                                &engine->ice_in
 #endif
                                                                                );
                        }
-                       
+
                }
-               
+
        }
 
        return ice_seen ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_BREAK;
@@ -4063,7 +4063,7 @@ static void greedy_sort(switch_media_handle_t *smh, struct matches *matches, int
                                        }
        for (g = 0; g < smh->mparams->num_codecs && g < total_codecs; g++) {
                const switch_codec_implementation_t *imp = codec_array[g];
-               
+
                for(j = 0; j < m_idx; j++) {
                        if (mtmp[j].imp == imp) {
                                *&matches[f++] = *&mtmp[j];
@@ -4086,7 +4086,7 @@ static void restore_pmaps(switch_rtp_engine_t *engine)
 {
        payload_map_t *pmap;
        int top = 0;
-       
+
        for (pmap = engine->payload_map; pmap && pmap->allocated; pmap = pmap->next) {
                pmap->negotiated = 1;
                if (!top++) pmap->current = 1;
@@ -4177,7 +4177,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
        a_engine->reject_avp = 0;
 
        switch_media_handle_set_media_flag(smh, SCMF_RECV_SDP);
-       
+
        switch_core_session_parse_crypto_prefs(session);
 
        clear_pmaps(a_engine);
@@ -4199,8 +4199,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        scrooge = 1;
                        greedy = 1;
                } else {
-                   switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtp_codec_negotiation ignored invalid value : '%s' \n", val );    
-               }               
+                   switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtp_codec_negotiation ignored invalid value : '%s' \n", val );
+               }
        }
 
        if ((smh->origin = switch_core_session_strdup(session, (char *) sdp->sdp_origin->o_username))) {
@@ -4232,7 +4232,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                switch_channel_set_flag(session->channel, CF_LIBERAL_DTMF);
        }
 
-       if (switch_stristr("T38FaxFillBitRemoval:", r_sdp) || switch_stristr("T38FaxTranscodingMMR:", r_sdp) || 
+       if (switch_stristr("T38FaxFillBitRemoval:", r_sdp) || switch_stristr("T38FaxTranscodingMMR:", r_sdp) ||
                switch_stristr("T38FaxTranscodingJBIG:", r_sdp)) {
                switch_channel_set_variable(session->channel, "t38_broken_boolean", "true");
        }
@@ -4286,7 +4286,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        got_webrtc++;
                        switch_core_session_set_ice(session);
                }
-               
+
                if (m->m_proto_name && !strcasecmp(m->m_proto_name, "UDP/TLS/RTP/SAVPF")) {
                        switch_channel_set_flag(session->channel, CF_AVPF_MOZ);
                }
@@ -4433,17 +4433,17 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
 
                                        restore_pmaps(a_engine);
                                        fmatch = 0;
-                                       
+
                                        goto t38_done;
                                } else {
                                        switch_t38_options_t *t38_options = switch_core_media_process_udptl(session, sdp, m);
                                        const char *var = switch_channel_get_variable(channel, "t38_passthru");
                                        int pass = switch_channel_test_flag(smh->session->channel, CF_T38_PASSTHRU);
-                                       
+
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s T38 ACCEPT on %s\n",
                                                                          switch_channel_get_name(channel),
                                                                          sdp_type == SDP_TYPE_RESPONSE ? "response" : "request");
-                                       
+
                                        if (switch_channel_test_app_flag_key("T38", session->channel, CF_APP_T38)) {
                                                if (proceed) *proceed = 0;
                                        }
@@ -4456,15 +4456,15 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                }
                                        }
 
-                                       if ((pass == 2 && switch_channel_test_flag(smh->session->channel, CF_T38_PASSTHRU)) 
+                                       if ((pass == 2 && switch_channel_test_flag(smh->session->channel, CF_T38_PASSTHRU))
                                                || !switch_channel_test_flag(session->channel, CF_REINVITE) ||
-                                       
-                                               switch_channel_test_flag(session->channel, CF_PROXY_MODE) || 
-                                               switch_channel_test_flag(session->channel, CF_PROXY_MEDIA) || 
+
+                                               switch_channel_test_flag(session->channel, CF_PROXY_MODE) ||
+                                               switch_channel_test_flag(session->channel, CF_PROXY_MEDIA) ||
                                                !switch_rtp_ready(a_engine->rtp_session)) {
                                                pass = 0;
                                        }
-                               
+
                                        if (pass && switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                                switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
                                                switch_core_session_message_t *msg;
@@ -4487,12 +4487,12 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
 
                                                switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_POSSIBLE);
                                                switch_channel_set_app_flag_key("T38", other_channel, CF_APP_T38_POSSIBLE);
-                                               
-                                               if (switch_true(switch_channel_get_variable(session->channel, "t38_broken_boolean")) && 
+
+                                               if (switch_true(switch_channel_get_variable(session->channel, "t38_broken_boolean")) &&
                                                        switch_true(switch_channel_get_variable(session->channel, "t38_pass_broken_boolean"))) {
                                                        switch_channel_set_variable(other_channel, "t38_broken_boolean", "true");
                                                }
-                                       
+
                                                a_engine->cur_payload_map->remote_sdp_ip = switch_core_session_strdup(session, t38_options->remote_ip);
                                                a_engine->cur_payload_map->remote_sdp_port = t38_options->remote_port;
 
@@ -4505,7 +4505,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio params changed for %s from %s:%d to %s:%d\n",
                                                                                          switch_channel_get_name(session->channel),
                                                                                          remote_host, remote_port, a_engine->cur_payload_map->remote_sdp_ip, a_engine->cur_payload_map->remote_sdp_port);
-                                               
+
                                                        switch_snprintf(tmp, sizeof(tmp), "%d", a_engine->cur_payload_map->remote_sdp_port);
                                                        switch_channel_set_variable(session->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, a_engine->cur_payload_map->remote_sdp_ip);
                                                        switch_channel_set_variable(session->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
@@ -4519,13 +4519,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                        switch_core_media_check_autoadj(session);
                                                }
 
-                                       
+
 
                                                switch_core_media_copy_t38_options(t38_options, other_session);
 
                                                switch_channel_set_flag(smh->session->channel, CF_T38_PASSTHRU);
                                                switch_channel_set_flag(other_session->channel, CF_T38_PASSTHRU);
-                                       
+
                                                msg = switch_core_session_alloc(other_session, sizeof(*msg));
                                                msg->message_id = SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA;
                                                msg->from = __FILE__;
@@ -4550,7 +4550,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                                  fmatch ? "IS" : "IS NOT",
                                                                  sdp_type == SDP_TYPE_RESPONSE ? "response" : "request");
 
-                               
+
                                goto done;
                        }
                } else if (m->m_type == sdp_media_audio && m->m_port && got_audio && got_savp) {
@@ -4600,13 +4600,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        break;
                                }
                        }
-                       
+
                        for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
                                if (zstr(attr->a_name)) {
                                        continue;
                                }
 
-                               
+
                                if (!strncasecmp(attr->a_name, "ice", 3)) {
                                        ice++;
                                } else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendonly")) {
@@ -4617,7 +4617,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                } else if (!strcasecmp(attr->a_name, "recvonly")) {
                                        switch_channel_set_variable(session->channel, "media_audio_mode", "sendonly");
                                        recvonly = 1;
-                                       
+
                                        if (switch_rtp_ready(a_engine->rtp_session)) {
                                                switch_rtp_set_max_missed_packets(a_engine->rtp_session, 0);
                                                a_engine->max_missed_hold_packets = 0;
@@ -4674,11 +4674,11 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        switch_core_media_prepare_codecs(session, SWITCH_TRUE);
                        codec_array = smh->codecs;
                        total_codecs = smh->mparams->num_codecs;
-                       
+
 
                        if (switch_rtp_has_dtls() && dtls_ok(session)) {
                                for (attr = m->m_attributes; attr; attr = attr->a_next) {
-                                       
+
                                        if (!strcasecmp(attr->a_name, "fingerprint") && !zstr(attr->a_value)) {
                                                got_crypto = 1;
                                        }
@@ -4693,7 +4693,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        skip_rtcp = 1;
                                        if (!smh->mparams->rtcp_video_interval_msec) {
                                                smh->mparams->rtcp_video_interval_msec = SWITCH_RTCP_VIDEO_INTERVAL_MSEC;
-                                       }                                       
+                                       }
                                } else if (!strcasecmp(attr->a_name, "ice-ufrag")) {
                                        skip_rtcp = 1;
                                }
@@ -4702,7 +4702,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        if (!got_rtcp_mux) {
                                a_engine->rtcp_mux = -1;
                        }
-                       
+
                        for (attr = m->m_attributes; attr; attr = attr->a_next) {
                                if (!strcasecmp(attr->a_name, "rtcp") && attr->a_value && !skip_rtcp) {
                                        a_engine->remote_rtcp_port = (switch_port_t)atoi(attr->a_value);
@@ -4718,8 +4718,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        maxptime = atoi(attr->a_value);
                                } else if (got_crypto < 1 && !strcasecmp(attr->a_name, "crypto") && !zstr(attr->a_value)) {
                                        int crypto_tag;
-                                       
-                                       if (!(smh->mparams->ndlb & SM_NDLB_ALLOW_CRYPTO_IN_AVP) && 
+
+                                       if (!(smh->mparams->ndlb & SM_NDLB_ALLOW_CRYPTO_IN_AVP) &&
                                                !switch_true(switch_channel_get_variable(session->channel, "rtp_allow_crypto_in_avp"))) {
                                                if (m->m_proto != sdp_proto_srtp && !got_webrtc) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "a=crypto in RTP/AVP, refer to rfc3711\n");
@@ -4730,7 +4730,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
 
                                        crypto = attr->a_value;
                                        crypto_tag = atoi(crypto);
-                                       got_crypto = switch_core_session_check_incoming_crypto(session, 
+                                       got_crypto = switch_core_session_check_incoming_crypto(session,
                                                                                                                                                   "rtp_has_crypto", SWITCH_MEDIA_TYPE_AUDIO, crypto, crypto_tag, sdp_type);
 
                                }
@@ -4754,7 +4754,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        }
 
                        x = 0;
-                       
+
                        for (map = m->m_rtpmaps; map; map = map->rm_next) {
                                int32_t i;
                                const char *rm_encoding;
@@ -4765,8 +4765,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                if (!(rm_encoding = map->rm_encoding)) {
                                        rm_encoding = "";
                                }
-                               
-                               
+
+
                                if (!strcasecmp(rm_encoding, "telephone-event")) {
                                        if (!best_te || map->rm_rate == a_engine->cur_payload_map->rm_rate) {
                                                best_te = (switch_payload_t) map->rm_pt;
@@ -4775,7 +4775,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        }
                                        continue;
                                }
-                               
+
                                if (!switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
                                        cng_pt = (switch_payload_t) map->rm_pt;
                                        if (a_engine->rtp_session) {
@@ -4784,8 +4784,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        }
                                        continue;
                                }
-                               
-                               
+
+
                                if (x++ < skip) {
                                        continue;
                                }
@@ -4810,11 +4810,11 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                }
 
                                map_bit_rate = switch_known_bitrate((switch_payload_t)map->rm_pt);
-                               
+
                                if (!ptime && !strcasecmp(map->rm_encoding, "g723")) {
                                        codec_ms = 30;
                                }
-                               
+
                                remote_codec_rate = map->rm_rate;
                                fmtp_remote_codec_rate = 0;
                                memset(&codec_fmtp, 0, sizeof(codec_fmtp));
@@ -4861,7 +4861,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        if ((zstr(map->rm_encoding) || (smh->mparams->ndlb & SM_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
                                                match = (map->rm_pt == imp->ianacode) ? 1 : 0;
                                        } else {
-                                               match = (!strcasecmp(rm_encoding, imp->iananame) && 
+                                               match = (!strcasecmp(rm_encoding, imp->iananame) &&
                                                                 ((map->rm_pt < 96 && imp->ianacode < 96) || (map->rm_pt > 95 && imp->ianacode > 95)) &&
                                                                 (remote_codec_rate == codec_rate || fmtp_remote_codec_rate == imp->actual_samples_per_second)) ? 1 : 0;
                                                if (fmtp_remote_codec_rate) {
@@ -4869,19 +4869,19 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                }
                                        }
 
-                                       if (match && bit_rate && map_bit_rate && map_bit_rate != bit_rate && strcasecmp(map->rm_encoding, "ilbc") && 
+                                       if (match && bit_rate && map_bit_rate && map_bit_rate != bit_rate && strcasecmp(map->rm_encoding, "ilbc") &&
                                                strcasecmp(map->rm_encoding, "isac")) {
                                                /* if a bit rate is specified and doesn't match, this is not a codec match, except for ILBC */
                                                match = 0;
                                        }
 
-                                       if (match && remote_codec_rate && codec_rate && remote_codec_rate != codec_rate && (!strcasecmp(map->rm_encoding, "pcma") || 
+                                       if (match && remote_codec_rate && codec_rate && remote_codec_rate != codec_rate && (!strcasecmp(map->rm_encoding, "pcma") ||
                                                                                                                                                                                          !strcasecmp(map->rm_encoding, "pcmu"))) {
                                                /* if the sampling rate is specified and doesn't match, this is not a codec match for G.711 */
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "sampling rates have to match for G.711\n");
                                                match = 0;
                                        }
-                                       
+
                                        if (match) {
                                                if (scrooge) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
@@ -4890,9 +4890,9 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                } else if ((ptime && codec_ms && codec_ms * 1000 != imp->microseconds_per_packet) || remote_codec_rate != codec_rate) {
                                                        /* ptime does not match */
                                                        match = 0;
-                                                       
-                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
-                                                                                         "Audio Codec Compare [%s:%d:%u:%d:%u:%d] is saved as a near-match\n", 
+
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                                         "Audio Codec Compare [%s:%d:%u:%d:%u:%d] is saved as a near-match\n",
                                                                                          imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000, bit_rate, imp->number_of_channels);
 
                                                        near_matches[nm_idx].codec_idx = i;
@@ -4910,10 +4910,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                matches[m_idx].map = map;
                                                m_idx++;
 
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
-                                                                                 "Audio Codec Compare [%s:%d:%u:%d:%u:%d] ++++ is saved as a match\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                                 "Audio Codec Compare [%s:%d:%u:%d:%u:%d] ++++ is saved as a match\n",
                                                                                  imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000, bit_rate, imp->number_of_channels);
-                                               
+
                                                if (m_idx >= MAX_MATCHES) {
                                                        break;
                                                }
@@ -4947,20 +4947,20 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
 
                                        near_rate = near_matches[j].rate;
                                        near_match = near_matches[j].imp;
-                                       near_map = near_matches[j].map;                                 
-                                       
+                                       near_map = near_matches[j].map;
+
                                        switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui%dc", near_match->iananame, near_rate ? near_rate : near_match->samples_per_second,
                                                                        codec_ms, near_match->number_of_channels);
-                                       
+
                                        prefs[0] = tmp;
                                        num = switch_loadable_module_get_codecs_sorted(search, fmtp, 1, prefs, 1);
-                               
+
                                        if (num) {
                                                timp = search[0];
                                        } else {
                                                timp = near_match;
                                        }
-                               
+
                                        if (!maxptime || timp->microseconds_per_packet / 1000 <= maxptime) {
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Substituting codec %s@%ui@%uh@%dc\n",
                                                                                  timp->iananame, timp->microseconds_per_packet / 1000, timp->actual_samples_per_second, timp->number_of_channels);
@@ -4976,7 +4976,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        }
                                }
                        }
-                       
+
                        if (m_idx) {
                                int j;
 
@@ -4988,12 +4988,12 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                a_engine->codec_negotiated = 1;
 
                                for(j = 0; j < m_idx; j++) {
-                                       payload_map_t *pmap = switch_core_media_add_payload_map(session, 
+                                       payload_map_t *pmap = switch_core_media_add_payload_map(session,
                                                                                                                                                        SWITCH_MEDIA_TYPE_AUDIO,
                                                                                                                                                        matches[j].map->rm_encoding,
                                                                                                                                                        matches[j].imp->modname,
                                                                                                                                                        matches[j].map->rm_fmtp,
-                                                                                                                                                       sdp_type, 
+                                                                                                                                                       sdp_type,
                                                                                                                                                        matches[j].map->rm_pt,
                                                                                                                                                        matches[j].imp->samples_per_second,
                                                                                                                                                        matches[j].imp->microseconds_per_packet / 1000,
@@ -5002,7 +5002,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
 
                                        mimp = matches[j].imp;
                                        mmap = matches[j].map;
-                       
+
                                        if (j == 0) {
                                                a_engine->cur_payload_map = pmap;
                                                a_engine->cur_payload_map->current = 1;
@@ -5010,7 +5010,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                        switch_rtp_set_default_payload(a_engine->rtp_session, pmap->pt);
                                                }
                                        }
-                                               
+
                                        pmap->rm_encoding = switch_core_session_strdup(session, (char *) mmap->rm_encoding);
                                        pmap->iananame = switch_core_session_strdup(session, (char *) mimp->iananame);
                                        pmap->recv_pt = (switch_payload_t) mmap->rm_pt;
@@ -5022,7 +5022,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        pmap->codec_ms = mimp->microseconds_per_packet / 1000;
                                        pmap->bitrate = mimp->bits_per_second;
                                        pmap->channels = mmap->rm_params ? atoi(mmap->rm_params) : 1;
-                                               
+
                                        if (!strcasecmp((char *) mmap->rm_encoding, "opus")) {
                                                if (pmap->channels == 1) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Invalid SDP for opus.  Don't ask.. but it needs a /2\n");
@@ -5038,21 +5038,21 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        } else {
                                                pmap->adv_channels = pmap->channels;
                                        }
-                                               
+
                                        pmap->remote_sdp_ip = switch_core_session_strdup(session, (char *) connection->c_address);
                                        pmap->remote_sdp_port = (switch_port_t) m->m_port;
                                        pmap->rm_fmtp = switch_core_session_strdup(session, (char *) mmap->rm_fmtp);
-                                               
+
                                        smh->negotiated_codecs[smh->num_negotiated_codecs++] = mimp;
                                        pmap->recv_pt = (switch_payload_t)mmap->rm_pt;
-                                               
+
                                }
                        }
 
                        if (match) {
                                char tmp[50];
                                //const char *mirror = switch_channel_get_variable(session->channel, "rtp_mirror_remote_audio_codec_payload");
-                                               
+
 
                                switch_snprintf(tmp, sizeof(tmp), "%d", a_engine->cur_payload_map->remote_sdp_port);
                                switch_channel_set_variable(session->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, a_engine->cur_payload_map->remote_sdp_ip);
@@ -5070,7 +5070,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                }
                                        }
                                        switch_mutex_unlock(smh->sdp_mutex);
-                                       
+
                                        smh->mparams->te  = (switch_payload_t) ++pl;
                                }
 
@@ -5080,8 +5080,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                switch_channel_set_variable(session->channel, "rtp_audio_recv_pt", tmp);
 
                                if (a_engine->read_impl.iananame) {
-                                       if (!switch_core_codec_ready(&a_engine->read_codec) || 
-                                               ((strcasecmp(matches[0].imp->iananame, a_engine->read_impl.iananame) || 
+                                       if (!switch_core_codec_ready(&a_engine->read_codec) ||
+                                               ((strcasecmp(matches[0].imp->iananame, a_engine->read_impl.iananame) ||
                                                  matches[0].imp->microseconds_per_packet != a_engine->read_impl.microseconds_per_packet ||
                                                  matches[0].imp->samples_per_second != a_engine->read_impl.samples_per_second
                                                  ))) {
@@ -5098,7 +5098,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                got_audio = 0;
                                        } else {
                                                got_audio = 1;
-                                       }                               
+                                       }
                                }
 
                        }
@@ -5142,17 +5142,17 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                best_te_rate = 8000;
                        }
 
-                       if (!best_te && (switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF) || 
+                       if (!best_te && (switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF) ||
                                                         switch_channel_test_flag(session->channel, CF_LIBERAL_DTMF))) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                                  "No 2833 in SDP. Liberal DTMF mode adding %d as telephone-event.\n", smh->mparams->te);
                                best_te = smh->mparams->te;
                        }
 
                        if (best_te) {
                                smh->mparams->te_rate = best_te_rate;
-                               
-                               if (smh->mparams->dtmf_type == DTMF_AUTO || smh->mparams->dtmf_type == DTMF_2833 || 
+
+                               if (smh->mparams->dtmf_type == DTMF_AUTO || smh->mparams->dtmf_type == DTMF_2833 ||
                                        switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF)) {
                                        if (sdp_type == SDP_TYPE_REQUEST) {
                                                smh->mparams->te = smh->mparams->recv_te = (switch_payload_t) best_te;
@@ -5164,7 +5164,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                smh->mparams->dtmf_type = DTMF_2833;
                                        }
                                }
-                               
+
                                if (a_engine->rtp_session) {
                                        switch_rtp_set_telephony_event(a_engine->rtp_session, smh->mparams->te);
                                        switch_channel_set_variable_printf(session->channel, "rtp_2833_send_payload", "%d", smh->mparams->te);
@@ -5172,8 +5172,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        switch_channel_set_variable_printf(session->channel, "rtp_2833_recv_payload", "%d", smh->mparams->recv_te);
                                }
 
-                               
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Set 2833 dtmf send payload to %u recv payload to %u\n", 
+
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Set 2833 dtmf send payload to %u recv payload to %u\n",
                                                                  switch_channel_get_name(session->channel), smh->mparams->te, smh->mparams->recv_te);
 
 
@@ -5190,7 +5190,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        smh->mparams->recv_te = smh->mparams->te = 0;
                                }
                        }
-                       
+
                } else if (!got_text && m->m_type == sdp_media_text && m->m_port) {
                        sdp_rtpmap_t *map;
                        payload_map_t *red_pmap = NULL;
@@ -5201,7 +5201,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        if (m->m_connections) {
                                connection = m->m_connections;
                        }
-                       
+
                        if (!connection) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot find a c= line in the sdp at media or session level!\n");
                                match = 0;
@@ -5213,7 +5213,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        switch_channel_set_flag(session->channel, CF_TEXT_POSSIBLE);
 
                        got_text++;
-                       
+
                        for (map = m->m_rtpmaps; map; map = map->rm_next) {
                                payload_map_t *pmap;
 
@@ -5235,10 +5235,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                if (map->rm_fmtp) {
                                        pmap->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
                                }
-                               
+
 
                                t_engine->cur_payload_map = pmap;
-                               
+
                                if (!strcasecmp(map->rm_encoding, "red")) {
                                        red_pmap = pmap;
                                }
@@ -5249,11 +5249,11 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        for (attr = m->m_attributes; attr; attr = attr->a_next) {
                                if (!strcasecmp(attr->a_name, "rtcp") && attr->a_value) {
                                        switch_channel_set_variable(session->channel, "sip_remote_text_rtcp_port", attr->a_value);
-                                       
+
                                } else if (!got_text_crypto && !strcasecmp(attr->a_name, "crypto") && !zstr(attr->a_value)) {
                                        int crypto_tag;
-                                               
-                                       if (!(smh->mparams->ndlb & SM_NDLB_ALLOW_CRYPTO_IN_AVP) && 
+
+                                       if (!(smh->mparams->ndlb & SM_NDLB_ALLOW_CRYPTO_IN_AVP) &&
                                                !switch_true(switch_channel_get_variable(session->channel, "rtp_allow_crypto_in_avp"))) {
                                                if (m->m_proto != sdp_proto_srtp && !got_webrtc) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "a=crypto in RTP/AVP, refer to rfc3711\n");
@@ -5261,14 +5261,14 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                        goto done;
                                                }
                                        }
-                                               
+
                                        crypto = attr->a_value;
                                        crypto_tag = atoi(crypto);
-                                               
-                                       got_text_crypto = switch_core_session_check_incoming_crypto(session, 
-                                                                                                                                                               "rtp_has_text_crypto", 
+
+                                       got_text_crypto = switch_core_session_check_incoming_crypto(session,
+                                                                                                                                                               "rtp_has_text_crypto",
                                                                                                                                                                SWITCH_MEDIA_TYPE_TEXT, crypto, crypto_tag, sdp_type);
-                                       
+
                                }
                        }
 
@@ -5302,15 +5302,15 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        m_idx = 0;
                        memset(matches, 0, sizeof(matches[0]) * MAX_MATCHES);
                        memset(near_matches, 0, sizeof(near_matches[0]) * MAX_MATCHES);
-                       
+
                        switch_channel_set_variable(session->channel, "video_possible", "true");
                        switch_channel_set_flag(session->channel, CF_VIDEO_SDP_RECVD);
-                       
+
                        connection = sdp->sdp_connection;
                        if (m->m_connections) {
                                connection = m->m_connections;
                        }
-                       
+
                        if (!connection) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot find a c= line in the sdp at media or session level!\n");
                                match = 0;
@@ -5322,7 +5322,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                        if (sdp_type == SDP_TYPE_REQUEST) {
                                sdp_bandwidth_t *bw;
                                int tias = 0;
-                               
+
                                for (bw = m->m_bandwidths; bw; bw = bw->b_next) {
                                        if (bw->b_modifier == sdp_bw_as && !tias) {
                                                v_engine->sdp_bw = bw->b_value;
@@ -5376,7 +5376,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                if (switch_stristr("fir", attr->a_value)) {
                                                        v_engine->fir++;
                                                }
-                                                       
+
                                                if (switch_stristr("pli", attr->a_value)) {
                                                        v_engine->pli++;
                                                }
@@ -5388,7 +5388,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                if (switch_stristr("tmmbr", attr->a_value)) {
                                                        v_engine->tmmbr++;
                                                }
-                                                       
+
                                                rtcp_auto_video = 1;
                                                smh->mparams->rtcp_video_interval_msec = SWITCH_RTCP_VIDEO_INTERVAL_MSEC;
                                        }
@@ -5401,8 +5401,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        got_video_rtcp = 1;
                                } else if (!got_video_crypto && !strcasecmp(attr->a_name, "crypto") && !zstr(attr->a_value)) {
                                        int crypto_tag;
-                                               
-                                       if (!(smh->mparams->ndlb & SM_NDLB_ALLOW_CRYPTO_IN_AVP) && 
+
+                                       if (!(smh->mparams->ndlb & SM_NDLB_ALLOW_CRYPTO_IN_AVP) &&
                                                !switch_true(switch_channel_get_variable(session->channel, "rtp_allow_crypto_in_avp"))) {
                                                if (m->m_proto != sdp_proto_srtp && !got_webrtc) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "a=crypto in RTP/AVP, refer to rfc3711\n");
@@ -5410,14 +5410,14 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                        goto done;
                                                }
                                        }
-                                               
+
                                        crypto = attr->a_value;
                                        crypto_tag = atoi(crypto);
-                                               
-                                       got_video_crypto = switch_core_session_check_incoming_crypto(session, 
-                                                                                                                                                                "rtp_has_video_crypto", 
+
+                                       got_video_crypto = switch_core_session_check_incoming_crypto(session,
+                                                                                                                                                                "rtp_has_video_crypto",
                                                                                                                                                                 SWITCH_MEDIA_TYPE_VIDEO, crypto, crypto_tag, sdp_type);
-                                       
+
                                }
                        }
 
@@ -5437,14 +5437,14 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                }
                                        }
                                }
-                               
+
                                if (!(rm_encoding = map->rm_encoding)) {
                                        rm_encoding = "";
                                }
 
                                for (i = 0; i < total_codecs; i++) {
                                        const switch_codec_implementation_t *imp = codec_array[i];
-                                       
+
                                        if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
                                                continue;
                                        }
@@ -5489,7 +5489,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Video Codec Compare [%s:%d] +++ is saved as a match\n",
                                                                                  imp->iananame, map->rm_pt);
 
-                                               m_idx++;                                                
+                                               m_idx++;
                                        }
 
                                        vmatch = 0;
@@ -5529,12 +5529,12 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                v_engine->codec_negotiated = 1;
 
                                for(j = 0; j < m_idx; j++) {
-                                       payload_map_t *pmap = switch_core_media_add_payload_map(session, 
+                                       payload_map_t *pmap = switch_core_media_add_payload_map(session,
                                                                                                                                                        SWITCH_MEDIA_TYPE_VIDEO,
-                                                                                                                                                       matches[j].map->rm_encoding, 
+                                                                                                                                                       matches[j].map->rm_encoding,
                                                                                                                                                        matches[j].imp->modname,
                                                                                                                                                        matches[j].map->rm_fmtp,
-                                                                                                                                                       sdp_type, 
+                                                                                                                                                       sdp_type,
                                                                                                                                                        matches[j].map->rm_pt,
                                                                                                                                                        matches[j].imp->samples_per_second,
                                                                                                                                                        matches[j].imp->microseconds_per_packet / 1000,
@@ -5548,10 +5548,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                        switch_rtp_set_default_payload(v_engine->rtp_session, pmap->pt);
                                                }
                                        }
-                                       
+
                                        mimp = matches[j].imp;
                                        map = matches[j].map;
-                                       
+
                                        pmap->rm_encoding = switch_core_session_strdup(session, (char *) map->rm_encoding);
                                        pmap->recv_pt = (switch_payload_t) map->rm_pt;
                                        pmap->rm_rate = map->rm_rate;
@@ -5561,7 +5561,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        pmap->remote_sdp_ip = switch_core_session_strdup(session, (char *) connection->c_address);
                                        pmap->remote_sdp_port = (switch_port_t) m->m_port;
                                        pmap->rm_fmtp = switch_core_session_strdup(session, (char *) inherit_video_fmtp ? inherit_video_fmtp : map->rm_fmtp);
-                                       smh->negotiated_codecs[smh->num_negotiated_codecs++] = mimp;                                    
+                                       smh->negotiated_codecs[smh->num_negotiated_codecs++] = mimp;
                                                
 #if 0
                                        if (j == 0 && (!switch_true(mirror) && switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND)) {
@@ -5583,7 +5583,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                if (switch_core_codec_ready(&v_engine->read_codec) && strcasecmp(matches[0].imp->iananame, v_engine->read_codec.implementation->iananame)) {
                                        v_engine->reset_codec = 1;
                                }
-                               
+
                                if (switch_core_media_set_video_codec(session, 0) == SWITCH_STATUS_SUCCESS) {
                                        if (check_ice(smh, SWITCH_MEDIA_TYPE_VIDEO, sdp, m) == SWITCH_STATUS_FALSE) {
                                                vmatch = 0;
@@ -5599,7 +5599,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                if (rtcp_auto_audio && !skip_rtcp && !got_audio_rtcp && audio_port) {
                        switch_channel_set_variable_printf(session->channel, "rtp_remote_audio_rtcp_port", "%d", audio_port + 1);
                        a_engine->remote_rtcp_port = audio_port + 1;
-                       
+
                        if (!smh->mparams->rtcp_audio_interval_msec) {
                                smh->mparams->rtcp_audio_interval_msec = SWITCH_RTCP_AUDIO_INTERVAL_MSEC;
                        }
@@ -5613,13 +5613,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                }
        }
 
-       
+
        if (!saw_audio) {
                payload_map_t *pmap;
 
                a_engine->rmode = SWITCH_MEDIA_FLOW_DISABLED;
                switch_channel_set_variable(smh->session->channel, "audio_media_flow", "inactive");
-               
+
 
                pmap = switch_core_media_add_payload_map(session,
                                                                                                 SWITCH_MEDIA_TYPE_AUDIO,
@@ -5673,7 +5673,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
        }
 
  t38_done:
-       
+
        if (parser) {
                sdp_parser_free(parser);
        }
@@ -5690,7 +5690,7 @@ SWITCH_DECLARE(void) switch_core_media_reset_t38(switch_core_session_t *session)
        switch_rtp_engine_t *a_engine;
        switch_media_handle_t *smh;
        switch_channel_t *channel = switch_core_session_get_channel(session);
-       
+
        switch_assert(session);
 
        if (!(smh = session->media_handle)) {
@@ -5727,7 +5727,7 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
        a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
        v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
 
-       
+
        if (switch_core_session_get_partner(session, &b_session) == SWITCH_STATUS_SUCCESS) {
                b_channel = switch_core_session_get_channel(b_session);
        }
@@ -5738,7 +5738,7 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
                        const char *msg = "hold";
                        const char *info;
 
-                       if ((switch_channel_test_flag(session->channel, CF_SLA_BARGE) || switch_channel_test_flag(session->channel, CF_SLA_BARGING)) && 
+                       if ((switch_channel_test_flag(session->channel, CF_SLA_BARGE) || switch_channel_test_flag(session->channel, CF_SLA_BARGING)) &&
                                (!b_channel || switch_channel_test_flag(b_channel, CF_EVENT_LOCK_PRI))) {
                                switch_channel_mark_hold(session->channel, sendonly);
                                switch_channel_set_flag(session->channel, CF_PROTO_HOLD);
@@ -5822,7 +5822,7 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
                                        bypass_after_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_after_hold", SWITCH_FALSE, -1));
                                }
                        }
-                       
+
                        switch_yield(250000);
 
                        if (b_channel && (switch_channel_test_flag(session->channel, CF_BYPASS_MEDIA_AFTER_HOLD) ||
@@ -5896,7 +5896,7 @@ SWITCH_DECLARE(switch_file_handle_t *) switch_core_media_get_video_file(switch_c
                return NULL;
        }
 
-       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];      
+       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
 
 
 
@@ -5939,7 +5939,7 @@ static void switch_core_session_write_blank_video(switch_core_session_t *session
        if (!width) width = 352;
        if (!height) height = 288;
        if (!fps) fps = 15;
-       
+
        if (!(width && height && fps)) {
                return;
        }
@@ -5948,7 +5948,7 @@ static void switch_core_session_write_blank_video(switch_core_session_t *session
        fr.packetlen = buflen;
        fr.data = buf + 12;
        fr.buflen = buflen - 12;
-       
+
 
        blank_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, height, 1);
        switch_color_set_rgb(&bgcolor, "#000000");
@@ -5956,7 +5956,7 @@ static void switch_core_session_write_blank_video(switch_core_session_t *session
 
        frame_ms = (uint32_t) 1000 / fps;
        frames = (uint32_t) ms / frame_ms;
-       
+
 
 
        switch_core_media_gen_key_frame(session);
@@ -5988,7 +5988,7 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
        if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
                return NULL;
        }
-       
+
        if (!(smh = session->media_handle)) {
                return NULL;
        }
@@ -5996,12 +5996,12 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
        switch_core_session_get_partner(session, &b_session);
 
        switch_channel_set_flag(session->channel, CF_VIDEO_WRITING);
-       
+
        if (b_session) {
                switch_channel_set_flag(b_session->channel, CF_VIDEO_BLANK);
        }
 
-       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];      
+       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
 
 
        buf = switch_core_session_alloc(session, buflen);
@@ -6011,7 +6011,7 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
        fr.buflen = buflen - 12;
        switch_core_media_gen_key_frame(session);
 
-       
+
        if (smh->video_write_fh && smh->video_write_fh->mm.source_fps) {
                fps = (int) smh->video_write_fh->mm.source_fps;
        } else {
@@ -6137,7 +6137,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_ses
                return SWITCH_STATUS_FALSE;
        }
 
-       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];      
+       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
 
        switch_core_session_start_video_thread(session);
 
@@ -6153,10 +6153,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_ses
                if (fh && smh->video_read_fh) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "File is already open\n");
                        switch_mutex_unlock(v_engine->mh.file_read_mutex);
-                       return SWITCH_STATUS_FALSE; 
+                       return SWITCH_STATUS_FALSE;
                }
 
-               
+
                if (fh) {
                        switch_channel_set_flag_recursive(session->channel, CF_VIDEO_DECODED_READ);
                        switch_channel_set_flag(session->channel, CF_VIDEO_READ_FILE_ATTACHED);
@@ -6164,7 +6164,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_ses
                        switch_channel_clear_flag_recursive(session->channel, CF_VIDEO_DECODED_READ);
                        switch_core_session_video_reset(session);
                }
-               
+
                if (!fh) {
                        switch_channel_clear_flag(session->channel, CF_VIDEO_READ_FILE_ATTACHED);
                }
@@ -6186,7 +6186,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_ses
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "File is already open\n");
                        smh->video_write_fh = fh;
                        switch_mutex_unlock(v_engine->mh.file_write_mutex);
-                       return SWITCH_STATUS_SUCCESS; 
+                       return SWITCH_STATUS_SUCCESS;
                }
 
                if (fh) {
@@ -6219,17 +6219,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_ses
                        smh->video_write_thread = NULL;
                        switch_core_session_write_blank_video(session, 500);
                }
-               
+
                smh->video_write_fh = fh;
 
                switch_mutex_unlock(v_engine->mh.file_write_mutex);
        }
 
        if (!fh) switch_channel_video_sync(session->channel);
-       
+
        switch_core_session_wake_video_thread(session);
 
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -6268,7 +6268,7 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram
 
                if (a_engine && a_engine->write_fb && !(flags & SWITCH_IO_FLAG_QUEUED)) {
                        switch_frame_t *dupframe = NULL;
-                       
+
                        if (switch_frame_buffer_dup(a_engine->write_fb, frame, &dupframe) == SWITCH_STATUS_SUCCESS) {
                                switch_frame_buffer_push(a_engine->write_fb, dupframe);
                                dupframe = NULL;
@@ -6290,7 +6290,7 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram
                        if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
                                continue;
                        }
-                       
+
                        if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) {
                                continue;
                        }
@@ -6298,7 +6298,7 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram
                                prune++;
                                continue;
                        }
-                       
+
                        if (bp->ready) {
                                if (switch_test_flag(bp, SMBF_TAP_NATIVE_WRITE)) {
                                        if (bp->callback) {
@@ -6308,7 +6308,7 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram
                                        }
                                }
                        }
-                       
+
                        if ((bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) || ok == SWITCH_FALSE) {
                                switch_set_flag(bp, SMBF_PRUNE);
                                prune++;
@@ -6364,28 +6364,28 @@ static void *SWITCH_THREAD_FUNC audio_write_thread(switch_thread_t *thread, void
                                                   write_impl.samples_per_packet, switch_core_session_get_pool(session));
 
        mh->up = 1;
-       
+
        switch_frame_buffer_create(&a_engine->write_fb, 500);
 
        while(switch_channel_up_nosig(session->channel) && mh->up == 1) {
                void *pop;
 
-               if (session->write_impl.microseconds_per_packet != write_impl.microseconds_per_packet || 
+               if (session->write_impl.microseconds_per_packet != write_impl.microseconds_per_packet ||
                        session->write_impl.samples_per_packet != write_impl.samples_per_packet) {
 
-                       
+
                        write_impl = session->write_impl;
                        switch_core_timer_destroy(&timer);
                        switch_core_timer_init(&timer, "soft", write_impl.microseconds_per_packet / 1000,
                                                                   write_impl.samples_per_packet, switch_core_session_get_pool(session));
-                       
+
                }
-               
+
                switch_core_timer_next(&timer);
 
                if (switch_frame_buffer_trypop(a_engine->write_fb, &pop) == SWITCH_STATUS_SUCCESS && pop) {
                        switch_frame_t *frame = (switch_frame_t *)pop;
-                       
+
                        if ((switch_size_t)pop == 1) {
                                break;
                        }
@@ -6434,7 +6434,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_start_audio_write_thread(swi
        a_engine->mh.session = session;
        switch_threadattr_create(&thd_attr, pool);
        switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-       
+
        switch_thread_cond_create(&a_engine->mh.cond, pool);
        switch_mutex_init(&a_engine->mh.cond_mutex, SWITCH_MUTEX_NESTED, pool);
        switch_thread_create(&a_engine->media_thread, thd_attr, audio_write_thread, &a_engine->mh, switch_core_session_get_pool(session));
@@ -6467,7 +6467,7 @@ static void *SWITCH_THREAD_FUNC text_helper_thread(switch_thread_t *thread, void
 
        cr_frame.data = CR;
        cr_frame.datalen = 3;
-       
+
        t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT];
        t_engine->thread_id = switch_thread_self();
 
@@ -6492,7 +6492,7 @@ static void *SWITCH_THREAD_FUNC text_helper_thread(switch_thread_t *thread, void
                                run = 1;
                        }
                        switch_mutex_unlock(smh->control_mutex);
-                       
+
                        if (run) {
                                t_engine->engine_function(session, t_engine->engine_user_data);
                                switch_mutex_lock(smh->control_mutex);
@@ -6506,7 +6506,7 @@ static void *SWITCH_THREAD_FUNC text_helper_thread(switch_thread_t *thread, void
                if (!switch_channel_test_flag(session->channel, CF_TEXT_PASSIVE)) {
 
                        status = switch_core_session_read_text_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-                       
+
                        if (!SWITCH_READ_ACCEPTABLE(status)) {
                                switch_cond_next();
                                continue;
@@ -6566,7 +6566,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_start_text_thread(switch_cor
        t_engine->mh.session = session;
        switch_threadattr_create(&thd_attr, pool);
        switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-       
+
        switch_thread_cond_create(&t_engine->mh.cond, pool);
        switch_mutex_init(&t_engine->mh.cond_mutex, SWITCH_MUTEX_NESTED, pool);
        //switch_mutex_init(&t_engine->mh.file_read_mutex, SWITCH_MUTEX_NESTED, pool);
@@ -6617,9 +6617,9 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
                        switch_img_fill(blank_img, 0, 0, blank_img->d_w, blank_img->d_h, &bgcolor);
                }
        }
-       
 
-       
+
+
        v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
        v_engine->thread_id = switch_thread_self();
 
@@ -6630,7 +6630,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
 
        switch_core_media_check_dtls(session, SWITCH_MEDIA_TYPE_VIDEO);
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread started. Echo is %s\n", 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread started. Echo is %s\n",
                                          switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off");
        switch_core_session_request_video_refresh(session);
 
@@ -6651,16 +6651,16 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
                        continue;
                }
 
-               if (!switch_channel_test_flag(channel, CF_VIDEO_READY) && 
+               if (!switch_channel_test_flag(channel, CF_VIDEO_READY) &&
                        switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ) && (++xloops > 10 || switch_channel_test_flag(channel, CF_VIDEO_PASSIVE))) {
                        switch_channel_set_flag(channel, CF_VIDEO_READY);
                }
-       
+
                if (switch_channel_test_flag(channel, CF_VIDEO_PASSIVE)) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread paused. Echo is %s\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread paused. Echo is %s\n",
                                                          switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off");
                        switch_thread_cond_wait(mh->cond, mh->cond_mutex);
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread resumed  Echo is %s\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread resumed  Echo is %s\n",
                                                          switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off");
                        switch_core_session_request_video_refresh(session);
                }
@@ -6673,7 +6673,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
                        switch_yield(10000);
                        continue;
                }
-               
+
                if (v_engine->engine_function) {
                        int run = 0;
 
@@ -6702,18 +6702,18 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
                }
 
                vloops++;
-               
+
                send_blank = blank_enabled || switch_channel_test_flag(channel, CF_VIDEO_ECHO);
-               
+
                if (switch_channel_test_flag(channel, CF_VIDEO_READY) && !switch_test_flag(read_frame, SFF_CNG)) {
                        switch_mutex_lock(mh->file_read_mutex);
                        if (smh->video_read_fh && switch_test_flag(smh->video_read_fh, SWITCH_FILE_OPEN) && read_frame->img) {
                                smh->video_read_fh->mm.fps = smh->vid_params.fps;
                                switch_core_file_write_video(smh->video_read_fh, read_frame);
-                       } 
+                       }
                        switch_mutex_unlock(mh->file_read_mutex);
                }
-               
+
                if ((switch_channel_test_flag(channel, CF_VIDEO_WRITING) || session->video_read_callback) && !switch_channel_test_flag(channel, CF_VIDEO_BLANK)) {
                        send_blank = 0;
                }
@@ -6773,7 +6773,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_start_video_thread(switch_co
        v_engine->mh.session = session;
        switch_threadattr_create(&thd_attr, pool);
        switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-       
+
        switch_thread_cond_create(&v_engine->mh.cond, pool);
        switch_mutex_init(&v_engine->mh.cond_mutex, SWITCH_MUTEX_NESTED, pool);
        switch_mutex_init(&v_engine->mh.file_read_mutex, SWITCH_MUTEX_NESTED, pool);
@@ -6825,7 +6825,7 @@ SWITCH_DECLARE(int) switch_core_media_check_engine_function(switch_core_session_
        }
 
        engine = &smh->engines[type];
-       
+
        switch_mutex_lock(smh->control_mutex);
        r = (engine->engine_function_running > 0);
        switch_mutex_unlock(smh->control_mutex);
@@ -6843,7 +6843,7 @@ SWITCH_DECLARE(void) switch_core_media_end_engine_function(switch_core_session_t
        }
 
        engine = &smh->engines[type];
-       
+
        switch_mutex_lock(smh->control_mutex);
        if (engine->engine_function_running > 0) {
                engine->engine_function_running = -1;
@@ -6861,13 +6861,13 @@ SWITCH_DECLARE(switch_bool_t) switch_core_session_in_video_thread(switch_core_se
        switch_media_handle_t *smh;
 
        switch_assert(session);
-       
+
        if (!(smh = session->media_handle)) {
                return SWITCH_FALSE;
        }
 
        v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
-       
+
        return switch_thread_equal(switch_thread_self(), v_engine->thread_id) ? SWITCH_TRUE : SWITCH_FALSE;
 }
 
@@ -6915,7 +6915,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_
        a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
        v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
        t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT];
-       
+
        if (zstr(sdp_str)) {
                sdp_str = smh->mparams->remote_sdp_str;
        }
@@ -6934,7 +6934,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_
 
        if ((p = (char *) switch_stristr("m=image ", sdp_str))) {
                char *tmp = p + 8;
-               
+
                if (tmp && atoi(tmp)) {
                        port_ptr = tmp;
                }
@@ -7038,7 +7038,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_
                                        }
                                }
 
-                               
+
                                if (switch_rtp_set_remote_address(v_engine->rtp_session, v_engine->cur_payload_map->remote_sdp_ip,
                                                                                                  v_engine->cur_payload_map->remote_sdp_port, remote_rtcp_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", err);
@@ -7077,7 +7077,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_
                                        }
                                }
 
-                               
+
                                if (switch_rtp_set_remote_address(t_engine->rtp_session, t_engine->cur_payload_map->remote_sdp_ip,
                                                                                                  t_engine->cur_payload_map->remote_sdp_port, remote_rtcp_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "TEXT RTP REPORTS ERROR: [%s]\n", err);
@@ -7111,7 +7111,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_
                        switch_goto_status(SWITCH_STATUS_BREAK, end);
                } else if (remote_host && ( (strcmp(remote_host, "0.0.0.0") == 0) ||
                                                                        (strcmp(a_engine->cur_payload_map->remote_sdp_ip, "0.0.0.0") == 0))) {
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                          "Remote address changed from [%s] to [%s]. Ignoring...\n",
                                                          a_engine->cur_payload_map->remote_sdp_ip, remote_host);
@@ -7131,7 +7131,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "AUDIO RTP CHANGING DEST TO: [%s:%d]\n",
                                                          a_engine->cur_payload_map->remote_sdp_ip, a_engine->cur_payload_map->remote_sdp_port);
                        if (!switch_media_handle_test_media_flag(smh, SCMF_DISABLE_RTP_AUTOADJ) &&
-                               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) && 
+                               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) &&
                                !switch_channel_test_flag(session->channel, CF_AVPF)) {
                                /* Reactivate the NAT buster flag. */
                                switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
@@ -7153,14 +7153,14 @@ SWITCH_DECLARE(int) switch_core_media_check_nat(switch_media_handle_t *smh, cons
 {
        switch_assert(network_ip);
 
-       return (smh->mparams->extsipip && 
-                       !switch_check_network_list_ip(network_ip, "loopback.auto") && 
+       return (smh->mparams->extsipip &&
+                       !switch_check_network_list_ip(network_ip, "loopback.auto") &&
                        !switch_check_network_list_ip(network_ip, smh->mparams->local_network));
 }
 
 //?
 SWITCH_DECLARE(switch_status_t) switch_core_media_ext_address_lookup(switch_core_session_t *session, char **ip, switch_port_t *port, const char *sourceip)
-                                                                                                                         
+
 {
        char *error = "";
        switch_status_t status = SWITCH_STATUS_FALSE;
@@ -7310,7 +7310,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_choose_port(switch_core_sessio
        }
 
        engine->local_sdp_ip = smh->mparams->rtpip;
-       
+
 
        sdp_port = engine->local_sdp_port;
 
@@ -7320,7 +7320,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_choose_port(switch_core_sessio
                switch_nat_add_mapping(engine->local_sdp_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE);
 
                switch_snprintf(vname, sizeof(vname), "rtp_adv_%s_ip", tstr);
-               
+
                /* Find an IP address to use */
                if (!(use_ip = switch_channel_get_variable(session->channel, vname))
                        && !zstr(smh->mparams->extrtpip)) {
@@ -7377,14 +7377,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_choose_ports(switch_core_sessi
 {
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        switch_media_handle_t *smh;
-       
+
        if (!(smh = session->media_handle)) {
                return SWITCH_STATUS_FALSE;
        }
 
        if (zstr(smh->mparams->rtpip)) {
-               
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no media ip\n", 
+
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no media ip\n",
                                                  switch_channel_get_name(smh->session->channel));
                switch_channel_hangup(smh->session->channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL);
 
@@ -7442,7 +7442,7 @@ SWITCH_DECLARE(void) switch_core_media_deactivate_rtp(switch_core_session_t *ses
        if (v_engine->media_thread) {
                switch_status_t st;
                switch_channel_clear_flag(session->channel, CF_VIDEO_PASSIVE);
-               
+
                v_engine->mh.up = 0;
                switch_thread_join(&st, v_engine->media_thread);
                v_engine->media_thread = NULL;
@@ -7455,7 +7455,7 @@ SWITCH_DECLARE(void) switch_core_media_deactivate_rtp(switch_core_session_t *ses
        }
 
 
-       if (v_engine->local_sdp_port > 0 && !zstr(smh->mparams->remote_ip) && 
+       if (v_engine->local_sdp_port > 0 && !zstr(smh->mparams->remote_ip) &&
                switch_core_media_check_nat(smh, smh->mparams->remote_ip)) {
                switch_nat_del_mapping((switch_port_t) v_engine->local_sdp_port, SWITCH_NAT_UDP);
                switch_nat_del_mapping((switch_port_t) v_engine->local_sdp_port + 1, SWITCH_NAT_UDP);
@@ -7478,7 +7478,7 @@ SWITCH_DECLARE(void) switch_core_media_deactivate_rtp(switch_core_session_t *ses
        }
 
 
-       if (t_engine->local_sdp_port > 0 && !zstr(smh->mparams->remote_ip) && 
+       if (t_engine->local_sdp_port > 0 && !zstr(smh->mparams->remote_ip) &&
                switch_core_media_check_nat(smh, smh->mparams->remote_ip)) {
                switch_nat_del_mapping((switch_port_t) t_engine->local_sdp_port, SWITCH_NAT_UDP);
                switch_nat_del_mapping((switch_port_t) t_engine->local_sdp_port + 1, SWITCH_NAT_UDP);
@@ -7491,7 +7491,7 @@ SWITCH_DECLARE(void) switch_core_media_deactivate_rtp(switch_core_session_t *ses
                switch_rtp_release_port(smh->mparams->rtpip, a_engine->local_sdp_port);
        }
 
-       if (a_engine->local_sdp_port > 0 && !zstr(smh->mparams->remote_ip) && 
+       if (a_engine->local_sdp_port > 0 && !zstr(smh->mparams->remote_ip) &&
                switch_core_media_check_nat(smh, smh->mparams->remote_ip)) {
                switch_nat_del_mapping((switch_port_t) a_engine->local_sdp_port, SWITCH_NAT_UDP);
                switch_nat_del_mapping((switch_port_t) a_engine->local_sdp_port + 1, SWITCH_NAT_UDP);
@@ -7532,7 +7532,7 @@ static void gen_ice(switch_core_session_t *session, switch_media_type_t type, co
                tmp[16] = '\0';
                smh->cname = switch_core_session_strdup(session, tmp);
        }
-       
+
        if (!engine->ice_out.ufrag) {
                switch_stun_random_string(tmp, 16, NULL);
                tmp[16] = '\0';
@@ -7542,7 +7542,7 @@ static void gen_ice(switch_core_session_t *session, switch_media_type_t type, co
        if (!engine->ice_out.pwd) {
                switch_stun_random_string(tmp, 24, NULL);
                tmp[24] = '\0';
-               engine->ice_out.pwd = switch_core_session_strdup(session, tmp); 
+               engine->ice_out.pwd = switch_core_session_strdup(session, tmp);
        }
 
        if (!engine->ice_out.cands[0][0].foundation) {
@@ -7568,7 +7568,7 @@ static void gen_ice(switch_core_session_t *session, switch_media_type_t type, co
 
        engine->ice_out.cands[0][0].generation = "0";
        //add rport stuff later
-       
+
        engine->ice_out.cands[0][0].ready = 1;
 
 
@@ -7577,7 +7577,7 @@ static void gen_ice(switch_core_session_t *session, switch_media_type_t type, co
 SWITCH_DECLARE(void) switch_core_session_wake_video_thread(switch_core_session_t *session)
 {
        switch_media_handle_t *smh;
-       switch_rtp_engine_t *v_engine; 
+       switch_rtp_engine_t *v_engine;
 
        if (!(smh = session->media_handle)) {
                return;
@@ -7611,19 +7611,19 @@ static void check_dtls_reinvite(switch_core_session_t *session, switch_rtp_engin
 
                if (!zstr(engine->local_dtls_fingerprint.str) && switch_rtp_has_dtls() && dtls_ok(session)) {
                        dtls_type_t xtype, dtype = engine->dtls_controller ? DTLS_TYPE_CLIENT : DTLS_TYPE_SERVER;
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "RE-SETTING %s DTLS\n", type2str(engine->type));
-               
+
                        xtype = DTLS_TYPE_RTP;
                        if (engine->rtcp_mux > 0) xtype |= DTLS_TYPE_RTCP;
-                       
+
                        switch_rtp_add_dtls(engine->rtp_session, &engine->local_dtls_fingerprint, &engine->remote_dtls_fingerprint, dtype | xtype);
-               
+
                        if (engine->rtcp_mux < 1) {
                                xtype = DTLS_TYPE_RTCP;
                                switch_rtp_add_dtls(engine->rtp_session, &engine->local_dtls_fingerprint, &engine->remote_dtls_fingerprint, dtype | xtype);
                        }
-               
+
                }
                engine->new_dtls = 0;
        }
@@ -7690,7 +7690,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
 
                        status = SWITCH_STATUS_SUCCESS;
                        goto end;
-               } 
+               }
        }
 
        if ((status = switch_core_media_set_codec(session, 0, smh->mparams->codec_flags)) != SWITCH_STATUS_SUCCESS) {
@@ -7735,7 +7735,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                flags[SWITCH_RTP_FLAG_BYTESWAP]++;
        }
 #endif
-       
+
        if ((flags[SWITCH_RTP_FLAG_BYTESWAP]) && (val = switch_channel_get_variable(session->channel, "rtp_disable_byteswap")) && switch_true(val)) {
                flags[SWITCH_RTP_FLAG_BYTESWAP] = 0;
        }
@@ -7746,7 +7746,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                char *remote_host = switch_rtp_get_remote_host(a_engine->rtp_session);
                switch_port_t remote_port = switch_rtp_get_remote_port(a_engine->rtp_session);
 
-               if (remote_host && remote_port && !strcmp(remote_host, a_engine->cur_payload_map->remote_sdp_ip) && 
+               if (remote_host && remote_port && !strcmp(remote_host, a_engine->cur_payload_map->remote_sdp_ip) &&
                        remote_port == a_engine->cur_payload_map->remote_sdp_port) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio params are unchanged for %s.\n",
                                                          switch_channel_get_name(session->channel));
@@ -7783,7 +7783,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
        if (a_engine->rtp_session && is_reinvite) {
                const char *rport = NULL;
                switch_port_t remote_rtcp_port = a_engine->remote_rtcp_port;
-                               
+
                if (!remote_rtcp_port) {
                        if ((rport = switch_channel_get_variable(session->channel, "rtp_remote_audio_rtcp_port"))) {
                                remote_rtcp_port = (switch_port_t)atoi(rport);
@@ -7859,7 +7859,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
 
        if (switch_channel_up(session->channel)) {
                switch_channel_set_variable(session->channel, "rtp_use_timer_name", timer_name);
-               
+
 
 
                a_engine->rtp_session = switch_rtp_new(a_engine->local_sdp_ip,
@@ -7930,7 +7930,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                if ((val = switch_channel_get_variable(session->channel, "rtp_manual_rtp_bugs"))) {
                        switch_core_media_parse_rtp_bugs(&a_engine->rtp_bugs, val);
                }
-               
+
                //if (switch_channel_test_flag(session->channel, CF_AVPF)) {
                //      smh->mparams->manual_rtp_bugs = RTP_BUG_SEND_LINEAR_TIMESTAMPS;
                //}
@@ -7944,14 +7944,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                          switch_channel_get_name(switch_core_session_get_channel(session)), vad_in ? "in" : "", vad_out ? "out" : "");
                }
 
-               
+
                if (a_engine->ice_in.cands[a_engine->ice_in.chosen[0]][0].ready) {
-                       
+
                        gen_ice(session, SWITCH_MEDIA_TYPE_AUDIO, NULL, 0);
 
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating Audio ICE\n");
 
-                       switch_rtp_activate_ice(a_engine->rtp_session, 
+                       switch_rtp_activate_ice(a_engine->rtp_session,
                                                                        a_engine->ice_in.ufrag,
                                                                        a_engine->ice_out.ufrag,
                                                                        a_engine->ice_out.pwd,
@@ -7961,14 +7961,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                                        ICE_GOOGLE_JINGLE,
                                                                        NULL
 #else
-                                                                       switch_ice_direction(session) == 
+                                                                       switch_ice_direction(session) ==
                                                                        SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
                                                                        &a_engine->ice_in
 #endif
                                                                        );
 
-               
-                       
+
+
                }
 
 
@@ -7980,7 +7980,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                        if (!remote_rtcp_port && rport) {
                                remote_rtcp_port = (switch_port_t)atoi(rport);
                        }
-                       
+
                        if (!strcasecmp(val, "passthru")) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating RTCP PASSTHRU PORT %d\n", remote_rtcp_port);
                                switch_rtp_activate_rtcp(a_engine->rtp_session, -1, remote_rtcp_port, a_engine->rtcp_mux > 0);
@@ -7994,7 +7994,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
 
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Activating RTCP PORT %d\n", remote_rtcp_port);
                                switch_rtp_activate_rtcp(a_engine->rtp_session, interval, remote_rtcp_port, a_engine->rtcp_mux > 0);
-                               
+
                        }
 
                        if (a_engine->ice_in.cands[a_engine->ice_in.chosen[1]][1].ready) {
@@ -8003,8 +8003,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Skipping RTCP ICE (Same as RTP)\n");
                                } else {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating RTCP ICE\n");
-                               
-                                       switch_rtp_activate_ice(a_engine->rtp_session, 
+
+                                       switch_rtp_activate_ice(a_engine->rtp_session,
                                                                                        a_engine->ice_in.ufrag,
                                                                                        a_engine->ice_out.ufrag,
                                                                                        a_engine->ice_out.pwd,
@@ -8014,13 +8014,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                                                        ICE_GOOGLE_JINGLE,
                                                                                        NULL
 #else
-                                                                                       switch_ice_direction(session) == 
+                                                                                       switch_ice_direction(session) ==
                                                                                        SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
                                                                                        &a_engine->ice_in
 #endif
                                                                                );
                                }
-                               
+
                        }
                }
 
@@ -8033,7 +8033,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
 
                        xtype = DTLS_TYPE_RTP;
                        if (a_engine->rtcp_mux > 0 && smh->mparams->rtcp_audio_interval_msec) xtype |= DTLS_TYPE_RTCP;
-               
+
                        switch_rtp_add_dtls(a_engine->rtp_session, &a_engine->local_dtls_fingerprint, &a_engine->remote_dtls_fingerprint, dtype | xtype);
 
                        if (a_engine->rtcp_mux < 1 && smh->mparams->rtcp_audio_interval_msec) {
@@ -8080,7 +8080,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                }
 
                if (smh->mparams->recv_te) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Set 2833 dtmf receive payload to %u\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Set 2833 dtmf receive payload to %u\n",
                                                          switch_channel_get_name(session->channel), smh->mparams->recv_te);
                        switch_rtp_set_telephony_recv_event(a_engine->rtp_session, smh->mparams->recv_te);
                        switch_channel_set_variable_printf(session->channel, "rtp_2833_recv_payload", "%d", smh->mparams->recv_te);
@@ -8103,9 +8103,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
 
                if (smh->mparams->dtmf_delay) {
                        switch_rtp_set_interdigit_delay(a_engine->rtp_session, smh->mparams->dtmf_delay);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                          "%s Set rtp dtmf delay to %u\n", switch_channel_get_name(session->channel), smh->mparams->dtmf_delay);
-                       
+
                }
 
                if (smh->mparams->cng_pt && !switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG)) {
@@ -8129,7 +8129,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                }
 
 
-               
+
        text:
 
                //if (switch_channel_test_flag(session->channel, CF_MSRP)) { // skip RTP RTT
@@ -8143,7 +8143,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                //const char *port = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
                                char *remote_host = switch_rtp_get_remote_host(t_engine->rtp_session);
                                switch_port_t remote_port = switch_rtp_get_remote_port(t_engine->rtp_session);
-                               
+
 
 
                                if (remote_host && remote_port && !strcmp(remote_host, t_engine->cur_payload_map->remote_sdp_ip) && remote_port == t_engine->cur_payload_map->remote_sdp_port) {
@@ -8168,7 +8168,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                        switch_rtp_set_default_payload(t_engine->rtp_session, t_engine->cur_payload_map->pt);
                                }
                        }
-                       
+
                        switch_snprintf(tmp, sizeof(tmp), "%d", t_engine->local_sdp_port);
                        switch_channel_set_variable(session->channel, SWITCH_LOCAL_TEXT_IP_VARIABLE, a_engine->adv_sdp_ip);
                        switch_channel_set_variable(session->channel, SWITCH_LOCAL_TEXT_PORT_VARIABLE, tmp);
@@ -8185,7 +8185,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                remote_rtcp_port = (switch_port_t)atoi(rport);
                                        }
                                }
-                               
+
                                if (switch_rtp_set_remote_address
                                        (t_engine->rtp_session, t_engine->cur_payload_map->remote_sdp_ip, t_engine->cur_payload_map->remote_sdp_port, remote_rtcp_port, SWITCH_TRUE,
                                         &err) != SWITCH_STATUS_SUCCESS) {
@@ -8251,9 +8251,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                        flags[SWITCH_RTP_FLAG_RAW_WRITE]++;
 
                        if (!switch_media_handle_test_media_flag(smh, SCMF_DISABLE_RTP_AUTOADJ) && !switch_channel_test_flag(session->channel, CF_PROXY_MODE) &&
-                               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) && 
+                               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) &&
                                !switch_channel_test_flag(session->channel, CF_AVPF)) {
-                               flags[SWITCH_RTP_FLAG_AUTOADJ]++;                               
+                               flags[SWITCH_RTP_FLAG_AUTOADJ]++;
                        }
 
                        if (switch_channel_test_flag(session->channel, CF_PROXY_MEDIA)) {
@@ -8265,7 +8265,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                        flags[SWITCH_RTP_FLAG_NOBLOCK] = 0;
                        flags[SWITCH_RTP_FLAG_TEXT]++;
                        //flags[SWITCH_RTP_FLAG_VIDEO]++;
-                       
+
                        t_engine->rtp_session = switch_rtp_new(a_engine->local_sdp_ip,
                                                                                                   t_engine->local_sdp_port,
                                                                                                   t_engine->cur_payload_map->remote_sdp_ip,
@@ -8286,7 +8286,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
 
                        if (switch_rtp_ready(t_engine->rtp_session)) {
                                const char *ssrc;
-                               
+
 
                                if (!t_engine->tf) {
                                        switch_rtp_text_factory_create(&t_engine->tf, switch_core_session_get_pool(session));
@@ -8305,18 +8305,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                } else {
                                        switch_rtp_set_ssrc(t_engine->rtp_session, t_engine->ssrc);
                                }
-                               
+
                                if (t_engine->remote_ssrc) {
                                        switch_rtp_set_remote_ssrc(t_engine->rtp_session, t_engine->remote_ssrc);
                                }
 
                                if (t_engine->ice_in.cands[t_engine->ice_in.chosen[0]][0].ready) {
-                                       
+
                                        gen_ice(session, SWITCH_MEDIA_TYPE_TEXT, NULL, 0);
 
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating Text ICE\n");
-                                               
-                                       switch_rtp_activate_ice(t_engine->rtp_session, 
+
+                                       switch_rtp_activate_ice(t_engine->rtp_session,
                                                                                        t_engine->ice_in.ufrag,
                                                                                        t_engine->ice_out.ufrag,
                                                                                        t_engine->ice_out.pwd,
@@ -8326,13 +8326,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                                                        ICE_GOOGLE_JINGLE,
                                                                                        NULL
 #else
-                                                                                       switch_ice_direction(session) == 
+                                                                                       switch_ice_direction(session) ==
                                                                                        SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
                                                                                        &t_engine->ice_in
 #endif
                                                                                        );
-                                               
-                                       
+
+
                                }
 
                                if ((val = switch_channel_get_variable(session->channel, "rtcp_text_interval_msec")) || (val = smh->mparams->rtcp_text_interval_msec)) {
@@ -8355,18 +8355,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO,
                                                                                  "Activating TEXT RTCP PORT %d interval %d mux %d\n", remote_port, interval, t_engine->rtcp_mux);
                                                switch_rtp_activate_rtcp(t_engine->rtp_session, interval, remote_port, t_engine->rtcp_mux > 0);
-                                                       
+
                                        }
-                                       
+
 
                                        if (t_engine->ice_in.cands[t_engine->ice_in.chosen[1]][1].ready) {
-                                               if (t_engine->rtcp_mux > 0 && !strcmp(t_engine->ice_in.cands[t_engine->ice_in.chosen[1]][1].con_addr, 
+                                               if (t_engine->rtcp_mux > 0 && !strcmp(t_engine->ice_in.cands[t_engine->ice_in.chosen[1]][1].con_addr,
                                                                                                                          t_engine->ice_in.cands[t_engine->ice_in.chosen[0]][0].con_addr) &&
                                                        t_engine->ice_in.cands[t_engine->ice_in.chosen[1]][1].con_port == t_engine->ice_in.cands[t_engine->ice_in.chosen[0]][0].con_port) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Skipping TEXT RTCP ICE (Same as TEXT RTP)\n");
                                                } else {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating TEXT RTCP ICE\n");
-                                                       switch_rtp_activate_ice(t_engine->rtp_session, 
+                                                       switch_rtp_activate_ice(t_engine->rtp_session,
                                                                                                        t_engine->ice_in.ufrag,
                                                                                                        t_engine->ice_out.ufrag,
                                                                                                        t_engine->ice_out.pwd,
@@ -8376,43 +8376,43 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                                                                        ICE_GOOGLE_JINGLE,
                                                                                                        NULL
 #else
-                                                                                                       switch_ice_direction(session) == 
+                                                                                                       switch_ice_direction(session) ==
                                                                                                        SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
                                                                                                        &t_engine->ice_in
 #endif
                                                                                                        );
-                                               
-                                               
-                                               
+
+
+
                                                }
-                               
+
                                        }
                                }
-                               
+
                                if (!zstr(t_engine->local_dtls_fingerprint.str) && switch_rtp_has_dtls() && dtls_ok(smh->session)) {
-                                       dtls_type_t xtype, 
+                                       dtls_type_t xtype,
                                                dtype = t_engine->dtls_controller ? DTLS_TYPE_CLIENT : DTLS_TYPE_SERVER;
                                        xtype = DTLS_TYPE_RTP;
                                        if (t_engine->rtcp_mux > 0 && smh->mparams->rtcp_text_interval_msec) xtype |= DTLS_TYPE_RTCP;
-                                       
+
                                        switch_rtp_add_dtls(t_engine->rtp_session, &t_engine->local_dtls_fingerprint, &t_engine->remote_dtls_fingerprint, dtype | xtype);
-                                       
+
                                        if (t_engine->rtcp_mux < 1 && smh->mparams->rtcp_text_interval_msec) {
                                                xtype = DTLS_TYPE_RTCP;
                                                switch_rtp_add_dtls(t_engine->rtp_session, &t_engine->local_dtls_fingerprint, &t_engine->remote_dtls_fingerprint, dtype | xtype);
                                        }
                                }
-                                       
-                                       
+
+
                                if ((val = switch_channel_get_variable(session->channel, "rtp_manual_text_rtp_bugs"))) {
                                        switch_core_media_parse_rtp_bugs(&t_engine->rtp_bugs, val);
                                }
-                               
+
 
                                //if (switch_channel_test_flag(session->channel, CF_AVPF)) {
                                        //smh->mparams->manual_video_rtp_bugs = RTP_BUG_SEND_LINEAR_TIMESTAMPS;
                                //}
-                               
+
                                switch_rtp_intentional_bugs(t_engine->rtp_session, t_engine->rtp_bugs | smh->mparams->manual_text_rtp_bugs);
 
                                //XX
@@ -8424,7 +8424,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
 
                                switch_core_session_apply_crypto(session, SWITCH_MEDIA_TYPE_TEXT);
 
-                               
+
                                if (switch_channel_test_flag(session->channel, CF_ZRTP_PASSTHRU)) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Activating text UDPTL mode\n");
                                        switch_rtp_udptl_mode(t_engine->rtp_session);
@@ -8436,11 +8436,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                goto end;
                        }
                }
-       
+
 
        text_up:
        video:
-       
+
                if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
                        switch_core_media_check_video_codecs(session);
                }
@@ -8452,7 +8452,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                //const char *port = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
                                char *remote_host = switch_rtp_get_remote_host(v_engine->rtp_session);
                                switch_port_t remote_port = switch_rtp_get_remote_port(v_engine->rtp_session);
-                               
+
 
 
                                if (remote_host && remote_port && !strcmp(remote_host, v_engine->cur_payload_map->remote_sdp_ip) && remote_port == v_engine->cur_payload_map->remote_sdp_port) {
@@ -8477,7 +8477,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                        switch_rtp_set_default_payload(v_engine->rtp_session, v_engine->cur_payload_map->pt);
                                }
                        }
-                       
+
                        switch_snprintf(tmp, sizeof(tmp), "%d", v_engine->local_sdp_port);
                        switch_channel_set_variable(session->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, a_engine->adv_sdp_ip);
                        switch_channel_set_variable(session->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE, tmp);
@@ -8494,7 +8494,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                remote_rtcp_port = (switch_port_t)atoi(rport);
                                        }
                                }
-                               
+
                                if (switch_rtp_set_remote_address
                                        (v_engine->rtp_session, v_engine->cur_payload_map->remote_sdp_ip, v_engine->cur_payload_map->remote_sdp_port, remote_rtcp_port, SWITCH_TRUE,
                                         &err) != SWITCH_STATUS_SUCCESS) {
@@ -8560,9 +8560,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                        flags[SWITCH_RTP_FLAG_RAW_WRITE]++;
 
                        if (!switch_media_handle_test_media_flag(smh, SCMF_DISABLE_RTP_AUTOADJ) && !switch_channel_test_flag(session->channel, CF_PROXY_MODE) &&
-                               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) && 
+                               !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) &&
                                !switch_channel_test_flag(session->channel, CF_AVPF)) {
-                               flags[SWITCH_RTP_FLAG_AUTOADJ]++;                               
+                               flags[SWITCH_RTP_FLAG_AUTOADJ]++;
                        }
 
                        if ((val = switch_channel_get_variable(session->channel, "rtp_gen_ts_delta_video")) && switch_true(val)) {
@@ -8578,7 +8578,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                        flags[SWITCH_RTP_FLAG_USE_TIMER] = 0;
                        flags[SWITCH_RTP_FLAG_NOBLOCK] = 0;
                        flags[SWITCH_RTP_FLAG_VIDEO]++;
-                       
+
                        if (v_engine->fir) {
                                flags[SWITCH_RTP_FLAG_FIR]++;
                        }
@@ -8623,11 +8623,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                if (v_engine->pli) {
                                        switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_PLI);
                                }
-                               
+
                                switch_rtp_set_payload_map(v_engine->rtp_session, &v_engine->payload_map);
                                switch_channel_set_flag(session->channel, CF_VIDEO);
                                switch_core_session_start_video_thread(session);
-                               
+
                                switch_rtp_set_video_buffer_size(v_engine->rtp_session, 1, 0);
                                if ((ssrc = switch_channel_get_variable(session->channel, "rtp_use_video_ssrc"))) {
                                        uint32_t ssrc_ul = (uint32_t) strtoul(ssrc, NULL, 10);
@@ -8636,18 +8636,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                } else {
                                        switch_rtp_set_ssrc(v_engine->rtp_session, v_engine->ssrc);
                                }
-                               
+
                                if (v_engine->remote_ssrc) {
                                        switch_rtp_set_remote_ssrc(v_engine->rtp_session, v_engine->remote_ssrc);
                                }
 
                                if (v_engine->ice_in.cands[v_engine->ice_in.chosen[0]][0].ready) {
-                                       
+
                                        gen_ice(session, SWITCH_MEDIA_TYPE_VIDEO, NULL, 0);
 
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating Video ICE\n");
-                                               
-                                       switch_rtp_activate_ice(v_engine->rtp_session, 
+
+                                       switch_rtp_activate_ice(v_engine->rtp_session,
                                                                                        v_engine->ice_in.ufrag,
                                                                                        v_engine->ice_out.ufrag,
                                                                                        v_engine->ice_out.pwd,
@@ -8657,13 +8657,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                                                        ICE_GOOGLE_JINGLE,
                                                                                        NULL
 #else
-                                                                                       switch_ice_direction(session) == 
+                                                                                       switch_ice_direction(session) ==
                                                                                        SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
                                                                                        &v_engine->ice_in
 #endif
                                                                                        );
-                                               
-                                       
+
+
                                }
 
                                if ((val = switch_channel_get_variable(session->channel, "rtcp_video_interval_msec")) || (val = smh->mparams->rtcp_video_interval_msec)) {
@@ -8686,9 +8686,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO,
                                                                                  "Activating VIDEO RTCP PORT %d interval %d mux %d\n", remote_port, interval, v_engine->rtcp_mux);
                                                switch_rtp_activate_rtcp(v_engine->rtp_session, interval, remote_port, v_engine->rtcp_mux > 0);
-                                                       
+
                                        }
-                                       
+
 
                                        if (v_engine->ice_in.cands[v_engine->ice_in.chosen[1]][1].ready) {
 
@@ -8698,7 +8698,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                } else {
 
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating VIDEO RTCP ICE\n");
-                                                       switch_rtp_activate_ice(v_engine->rtp_session, 
+                                                       switch_rtp_activate_ice(v_engine->rtp_session,
                                                                                                        v_engine->ice_in.ufrag,
                                                                                                        v_engine->ice_out.ufrag,
                                                                                                        v_engine->ice_out.pwd,
@@ -8708,42 +8708,42 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
                                                                                                        ICE_GOOGLE_JINGLE,
                                                                                                        NULL
 #else
-                                                                                                       switch_ice_direction(session) == 
+                                                                                                       switch_ice_direction(session) ==
                                                                                                        SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED),
                                                                                                        &v_engine->ice_in
 #endif
                                                                                                        );
-                                               
-                                               
-                                               
+
+
+
                                                }
-                               
+
                                        }
                                }
-                               
+
                                if (!zstr(v_engine->local_dtls_fingerprint.str) && switch_rtp_has_dtls() && dtls_ok(smh->session)) {
-                                       dtls_type_t xtype, 
+                                       dtls_type_t xtype,
                                                dtype = v_engine->dtls_controller ? DTLS_TYPE_CLIENT : DTLS_TYPE_SERVER;
                                        xtype = DTLS_TYPE_RTP;
                                        if (v_engine->rtcp_mux > 0 && smh->mparams->rtcp_video_interval_msec) xtype |= DTLS_TYPE_RTCP;
-                                       
+
                                        switch_rtp_add_dtls(v_engine->rtp_session, &v_engine->local_dtls_fingerprint, &v_engine->remote_dtls_fingerprint, dtype | xtype);
-                                       
+
                                        if (v_engine->rtcp_mux < 1 && smh->mparams->rtcp_video_interval_msec) {
                                                xtype = DTLS_TYPE_RTCP;
                                                switch_rtp_add_dtls(v_engine->rtp_session, &v_engine->local_dtls_fingerprint, &v_engine->remote_dtls_fingerprint, dtype | xtype);
                                        }
                                }
-                                       
-                                       
+
+
                                if ((val = switch_channel_get_variable(session->channel, "rtp_manual_video_rtp_bugs"))) {
                                        switch_core_media_parse_rtp_bugs(&v_engine->rtp_bugs, val);
                                }
-                               
+
                                if (switch_channel_test_flag(session->channel, CF_AVPF)) {
                                        smh->mparams->manual_video_rtp_bugs = RTP_BUG_SEND_LINEAR_TIMESTAMPS;
                                }
-                               
+
                                switch_rtp_intentional_bugs(v_engine->rtp_session, v_engine->rtp_bugs | smh->mparams->manual_video_rtp_bugs);
 
                                //XX
@@ -8755,7 +8755,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
 
                                switch_core_session_apply_crypto(session, SWITCH_MEDIA_TYPE_VIDEO);
 
-                               
+
                                if (switch_channel_test_flag(session->channel, CF_ZRTP_PASSTHRU)) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Activating video UDPTL mode\n");
                                        switch_rtp_udptl_mode(v_engine->rtp_session);
@@ -8818,7 +8818,7 @@ static const char *get_media_profile_name(switch_core_session_t *session, int se
        }
 
        return "RTP/AVP";
-       
+
 }
 
 static char *get_setup(switch_rtp_engine_t *engine, switch_core_session_t *session, switch_sdp_type_t sdp_type)
@@ -8836,9 +8836,9 @@ static char *get_setup(switch_rtp_engine_t *engine, switch_core_session_t *sessi
 
 
 //?
-static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, 
+static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                                           switch_port_t port, const char *family, const char *ip,
-                                          int cur_ptime, const char *append_audio, const char *sr, int use_cng, int cng_type, switch_event_t *map, int secure, 
+                                          int cur_ptime, const char *append_audio, const char *sr, int use_cng, int cng_type, switch_event_t *map, int secure,
                                           switch_sdp_type_t sdp_type)
 {
        int i = 0;
@@ -8858,10 +8858,10 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
 
        a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
 
-       //switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d RTP/%sAVP%s", 
+       //switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d RTP/%sAVP%s",
        //port, secure ? "S" : "", switch_channel_test_flag(session->channel, CF_AVPF) ? "F" : "");
 
-       switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d %s", port, 
+       switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d %s", port,
                                        get_media_profile_name(session, secure || a_engine->crypto_type != CRYPTO_INVALID));
 
        include_external = switch_channel_var_true(session->channel, "include_external_ip");
@@ -8898,7 +8898,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                        already_did[smh->ianacodes[i]] = 1;
                }
 
-               
+
                switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", smh->ianacodes[i]);
        }
 
@@ -8913,17 +8913,17 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                        }
                }
        }
-               
+
        //if (!switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) && cng_type && use_cng) {
                //switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", cng_type);
        //}
-               
+
        switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "\r\n");
 
 
        memset(already_did, 0, sizeof(already_did));
 
-               
+
        for (i = 0; i < smh->mparams->num_codecs; i++) {
                const switch_codec_implementation_t *imp = smh->codecs[i];
                char *fmtp = imp->fmtp;
@@ -8948,12 +8948,12 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                                }
                        }
                }
-               
+
                if (smh->ianacodes[i] < 128) {
                        if (already_did[smh->ianacodes[i]]) {
                                continue;
                        }
-                       
+
                        already_did[smh->ianacodes[i]] = 1;
                }
 
@@ -8979,7 +8979,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
 
                        if (channels > 1) {
                                switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d %s/%d/%d\r\n", smh->ianacodes[i], imp->iananame, rate, channels);
-                                                               
+
                        } else {
                                switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d %s/%d\r\n", smh->ianacodes[i], imp->iananame, rate);
                        }
@@ -8991,25 +8991,25 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
        }
 
 
-       if ((smh->mparams->dtmf_type == DTMF_2833 || switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF) || 
+       if ((smh->mparams->dtmf_type == DTMF_2833 || switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF) ||
                 switch_channel_test_flag(session->channel, CF_LIBERAL_DTMF)) && smh->mparams->te > 95) {
 
                for (i = 0; i < smh->num_rates; i++) {
                        if (switch_channel_test_flag(session->channel, CF_AVPF)) {
-                               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n", 
+                               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n",
                                                                smh->dtmf_ianacodes[i], smh->rates[i]);
                        } else {
-                               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-16\r\n", 
+                               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-16\r\n",
                                                                smh->dtmf_ianacodes[i], smh->rates[i], smh->dtmf_ianacodes[i]);
                        }
                }
        }
 
        if (!zstr(a_engine->local_dtls_fingerprint.type) && secure) {
-               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=fingerprint:%s %s\r\na=setup:%s\r\n", a_engine->local_dtls_fingerprint.type, 
+               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=fingerprint:%s %s\r\na=setup:%s\r\n", a_engine->local_dtls_fingerprint.type,
                                                a_engine->local_dtls_fingerprint.str, get_setup(a_engine, session, sdp_type));
        }
-       
+
        if (smh->mparams->rtcp_audio_interval_msec) {
                if (a_engine->rtcp_mux > 0) {
                        switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtcp-mux\r\n");
@@ -9054,7 +9054,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=ice-pwd:%s\r\n", ice_out->pwd);
 
 
-               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n", 
+               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n",
                                                tmp1, ice_out->cands[0][0].transport, c1,
                                                ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port
                                                );
@@ -9070,7 +9070,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                        strcmp(a_engine->local_sdp_ip, ice_out->cands[0][0].con_addr)
                        && a_engine->local_sdp_port != ice_out->cands[0][0].con_port) {
 
-                       switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n", 
+                       switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
                                                        tmp2, ice_out->cands[0][0].transport, c2,
                                                        ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port,
                                                        a_engine->local_sdp_ip, a_engine->local_sdp_port
@@ -9078,9 +9078,9 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                }
 
                if (a_engine->rtcp_mux < 1 || switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND || switch_channel_test_flag(session->channel, CF_RECOVERING)) {
-                       
 
-                       switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n", 
+
+                       switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n",
                                                        tmp1, ice_out->cands[0][0].transport, c1,
                                                        ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1)
                                                        );
@@ -9095,8 +9095,8 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                        if (!zstr(a_engine->local_sdp_ip) && !zstr(ice_out->cands[0][1].con_addr) && 
                                strcmp(a_engine->local_sdp_ip, ice_out->cands[0][1].con_addr)
                                && a_engine->local_sdp_port != ice_out->cands[0][1].con_port) {
-                               
-                               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n", 
+
+                               switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
                                                                tmp2, ice_out->cands[0][0].transport, c2,
                                                                ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1),
                                                                a_engine->local_sdp_ip, a_engine->local_sdp_port + (a_engine->rtcp_mux > 0 ? 0 : 1)
@@ -9104,8 +9104,8 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                        }
                }
 
-                       
-                               
+
+
 #ifdef GOOGLE_ICE
                switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=ice-options:google-ice\r\n");
 #endif
@@ -9134,7 +9134,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
                                //}
                }
        } else {
-               if (switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG)) { 
+               if (switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG)) {
                        switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=silenceSupp:off - - - -\r\n");
                }
        }
@@ -9146,7 +9146,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
        if (!cur_ptime) {
                cur_ptime = ptime;
        }
-       
+
        if (!noptime && cur_ptime) {
                switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=ptime:%d\r\n", cur_ptime);
        }
@@ -9164,7 +9164,7 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen,
 }
 
 //?
-SWITCH_DECLARE(void) switch_core_media_check_dtmf_type(switch_core_session_t *session) 
+SWITCH_DECLARE(void) switch_core_media_check_dtmf_type(switch_core_session_t *session)
 {
        const char *val;
        switch_media_handle_t *smh;
@@ -9208,7 +9208,7 @@ switch_status_t switch_core_media_sdp_map(const char *r_sdp, switch_event_t **fm
        for (m = sdp->sdp_media; m; m = m->m_next) {
                if (m->m_proto == sdp_proto_rtp) {
                        sdp_rtpmap_t *map;
-                       
+
                        for (map = m->m_rtpmaps; map; map = map->rm_next) {
                                if (map->rm_encoding) {
                                        char buf[25] = "";
@@ -9228,7 +9228,7 @@ switch_status_t switch_core_media_sdp_map(const char *r_sdp, switch_event_t **fm
                                        } else {
                                                switch_snprintf(key, sizeof(key), "%s", map->rm_encoding);
                                        }
-                                       
+
                                        switch_event_add_header_string(*pt, SWITCH_STACK_BOTTOM, key, buf);
 
                                        if (map->rm_fmtp) {
@@ -9238,11 +9238,11 @@ switch_status_t switch_core_media_sdp_map(const char *r_sdp, switch_event_t **fm
                        }
                }
        }
-       
+
        sdp_parser_free(parser);
 
        return SWITCH_STATUS_SUCCESS;
-       
+
 }
 
 //?
@@ -9367,7 +9367,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
        if (is_outbound || switch_channel_test_flag(session->channel, CF_RECOVERING) ||
                switch_channel_test_flag(session->channel, CF_3PCC)) {
-               if (!switch_channel_test_flag(session->channel, CF_AVPF) && 
+               if (!switch_channel_test_flag(session->channel, CF_AVPF) &&
                        switch_true(switch_channel_get_variable(session->channel, "media_webrtc"))) {
                        switch_channel_set_flag(session->channel, CF_AVPF);
                        switch_channel_set_flag(session->channel, CF_ICE);
@@ -9396,7 +9396,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
 
        switch_zmalloc(buf, SDPBUFLEN);
-       
+
        switch_core_media_check_dtmf_type(session);
 
        if (switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) ||
@@ -9406,13 +9406,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                smh->mparams->cng_pt = 0;
        }
 
-       
+
 
 
        if (!smh->payload_space) {
                int i;
 
-               /* it could be 98 but chrome reserves 98 and 99 for some internal stuff even though they should not.  
+               /* it could be 98 but chrome reserves 98 and 99 for some internal stuff even though they should not.
                   Everyone expects dtmf to be at 101 and Its not worth the trouble so we'll start at 102 */
                smh->payload_space = 102;
                memset(smh->rates, 0, sizeof(smh->rates));
@@ -9431,23 +9431,23 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                        if (smh->rates[j] == 0) {
                                                break;
                                        }
-                                       
+
                                        if (smh->rates[j] == smh->codecs[i]->samples_per_second) {
                                                goto do_next;
                                        }
                                }
-                       
+
                                smh->rates[smh->num_rates++] = smh->codecs[i]->samples_per_second;
                        }
-                       
+
                do_next:
                        continue;
                }
-               
+
                if (sdp_type == SDP_TYPE_REQUEST) {
                        switch_core_session_t *orig_session = NULL;
 
-                       switch_core_session_get_partner(session, &orig_session);                        
+                       switch_core_session_get_partner(session, &orig_session);
 
                        for (i = 0; i < smh->mparams->num_codecs; i++) {
                                const switch_codec_implementation_t *imp = smh->codecs[i];
@@ -9463,8 +9463,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                smh->payload_space++;
                                        }
 
-                                       if (orig_session && 
-                                               switch_core_session_get_payload_code(orig_session, 
+                                       if (orig_session &&
+                                               switch_core_session_get_payload_code(orig_session,
                                                                                                                         imp->codec_type == SWITCH_CODEC_TYPE_AUDIO ? SWITCH_MEDIA_TYPE_AUDIO : SWITCH_MEDIA_TYPE_VIDEO,
                                                                                                                         imp->iananame, imp->samples_per_second, smh->fmtp[i], &orig_pt, NULL, &orig_fmtp) == SWITCH_STATUS_SUCCESS) {
 
@@ -9473,7 +9473,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                }
 
                                                smh->ianacodes[i] = orig_pt;
-                                                                                               
+
                                                if (!zstr(orig_fmtp)) {
                                                        smh->fmtps[i] = switch_core_session_strdup(session, orig_fmtp);
                                                }
@@ -9494,7 +9494,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                                                                  imp->number_of_channels,
                                                                                                  SWITCH_FALSE);
                        }
-                       
+
                        for (i = 0; i < smh->num_rates; i++) {
                                if (smh->rates[i] == 8000 || smh->num_rates == 1) {
                                        smh->dtmf_ianacodes[i] = smh->mparams->te;
@@ -9513,7 +9513,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                        smh->cng_ianacodes[i] = (switch_payload_t)smh->payload_space++;
                                }
                        }
-       
+
 
                        if (orig_session) {
                                switch_core_session_rwunlock(orig_session);
@@ -9601,7 +9601,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
        }
 
        smh->session_id++;
-       
+
        if ((smh->mparams->ndlb & SM_NDLB_SENDRECV_IN_SESSION) ||
                ((var_val = switch_channel_get_variable(session->channel, "ndlb_sendrecv_in_session")) && switch_true(var_val))) {
                if (!zstr(sr)) {
@@ -9615,7 +9615,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                        "v=0\r\n"
                                        "o=%s %010u %010u IN %s %s\r\n"
                                        "s=%s\r\n"
-                                       "c=IN %s %s\r\n" 
+                                       "c=IN %s %s\r\n"
                                        "t=0 0\r\n"
                                        "%s",
                                        username, smh->owner_id, smh->session_id, family, ip, username, family, ip, srbuf);
@@ -9631,14 +9631,14 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
        }
 
        if (a_engine->codec_negotiated) {
-               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=audio %d %s", port, 
-                                               get_media_profile_name(session, !a_engine->no_crypto && 
+               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=audio %d %s", port,
+                                               get_media_profile_name(session, !a_engine->no_crypto &&
                                                                                           (switch_channel_test_flag(session->channel, CF_DTLS) || a_engine->crypto_type != CRYPTO_INVALID)));
-                                                                                                                       
-               
+
+
                switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", a_engine->cur_payload_map->pt);
 
-               
+
                if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO)) {
                        switch_mutex_lock(smh->sdp_mutex);
                        for (pmap = a_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) {
@@ -9649,15 +9649,15 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                        switch_mutex_unlock(smh->sdp_mutex);
                }
 
-               if ((smh->mparams->dtmf_type == DTMF_2833 || switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF) || 
+               if ((smh->mparams->dtmf_type == DTMF_2833 || switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF) ||
                         switch_channel_test_flag(session->channel, CF_LIBERAL_DTMF)) && smh->mparams->te > 95) {
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", smh->mparams->te);
                }
-               
+
                if (!switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) && smh->mparams->cng_pt && use_cng) {
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", smh->mparams->cng_pt);
                }
-               
+
                switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "\r\n");
 
 
@@ -9666,12 +9666,12 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                if (!a_engine->cur_payload_map->adv_channels) {
                        a_engine->cur_payload_map->adv_channels = get_channels(a_engine->cur_payload_map->rm_encoding, 1);
                }
-               
+
                if (a_engine->cur_payload_map->adv_channels > 1) {
-                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d/%d\r\n", 
+                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d/%d\r\n",
                                                        a_engine->cur_payload_map->pt, a_engine->cur_payload_map->rm_encoding, rate, a_engine->cur_payload_map->adv_channels);
                } else {
-                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d\r\n", 
+                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d\r\n",
                                                        a_engine->cur_payload_map->pt, a_engine->cur_payload_map->rm_encoding, rate);
                }
 
@@ -9697,15 +9697,15 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                }
 
 
-               if ((smh->mparams->dtmf_type == DTMF_2833 || switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF) || 
+               if ((smh->mparams->dtmf_type == DTMF_2833 || switch_media_handle_test_media_flag(smh, SCMF_LIBERAL_DTMF) ||
                         switch_channel_test_flag(session->channel, CF_LIBERAL_DTMF))
                        && smh->mparams->te > 95) {
 
                        if (switch_channel_test_flag(session->channel, CF_AVPF)) {
-                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n", 
+                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\n",
                                                                smh->mparams->te, smh->mparams->te_rate);
                        } else {
-                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-16\r\n", 
+                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-16\r\n",
                                                                smh->mparams->te, smh->mparams->te_rate, smh->mparams->te);
                        }
                }
@@ -9739,14 +9739,14 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                if (!zstr(sr)) {
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=%s\r\n", sr);
                }
-       
+
 
                if (!zstr(a_engine->local_dtls_fingerprint.type)) {
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fingerprint:%s %s\na=setup:%s\r\n",
-                                                       a_engine->local_dtls_fingerprint.type, 
+                                                       a_engine->local_dtls_fingerprint.type,
                                                        a_engine->local_dtls_fingerprint.str, get_setup(a_engine, session, sdp_type));
                }
-               
+
                if (smh->mparams->rtcp_audio_interval_msec) {
                        if (a_engine->rtcp_mux > 0) {
                                switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtcp-mux\r\n");
@@ -9779,13 +9779,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                        switch_stun_random_string(tmp3, 10, "0123456789");
 
                        ice_out = &a_engine->ice_out;
-                       
-                       
+
+
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-ufrag:%s\r\n", ice_out->ufrag);
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-pwd:%s\r\n", ice_out->pwd);
 
 
-                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n", 
+                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n",
                                                        tmp1, ice_out->cands[0][0].transport, c1,
                                                        ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port
                                                        );
@@ -9801,7 +9801,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                strcmp(a_engine->local_sdp_ip, ice_out->cands[0][0].con_addr)
                                && a_engine->local_sdp_port != ice_out->cands[0][0].con_port) {
 
-                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n", 
+                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
                                                                tmp2, ice_out->cands[0][0].transport, c3,
                                                                ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port,
                                                                a_engine->local_sdp_ip, a_engine->local_sdp_port
@@ -9811,11 +9811,11 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
                        if (a_engine->rtcp_mux < 1 || is_outbound || switch_channel_test_flag(session->channel, CF_RECOVERING)) {
 
-                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n", 
+                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n",
                                                                tmp1, ice_out->cands[0][0].transport, c2,
                                                                ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1)
                                                                );
-                               
+
                                if (include_external && !zstr(smh->mparams->extsipip)) {
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\n",
                                                tmp3, ice_out->cands[0][0].transport, c2,
@@ -9823,12 +9823,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                );
                                }
 
-                               
-                               if (!zstr(a_engine->local_sdp_ip) && !zstr(ice_out->cands[0][0].con_addr) && 
+
+
+                               if (!zstr(a_engine->local_sdp_ip) && !zstr(ice_out->cands[0][0].con_addr) &&
                                        strcmp(a_engine->local_sdp_ip, ice_out->cands[0][0].con_addr)
-                                       && a_engine->local_sdp_port != ice_out->cands[0][0].con_port) {                 
-                                       
-                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n", 
+                                       && a_engine->local_sdp_port != ice_out->cands[0][0].con_port) {
+
+                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
                                                                        tmp2, ice_out->cands[0][0].transport, c4,
                                                                        ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port + (a_engine->rtcp_mux > 0 ? 0 : 1),
                                                                        a_engine->local_sdp_ip, a_engine->local_sdp_port + (a_engine->rtcp_mux > 0 ? 0 : 1)
@@ -9843,7 +9844,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u mslabel:%s\r\n", a_engine->ssrc, smh->msid);
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u label:%sa0\r\n", a_engine->ssrc, smh->msid);
 
-                               
+
 #ifdef GOOGLE_ICE
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-options:google-ice\r\n");
 #endif
@@ -9859,7 +9860,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                if (a_engine->reject_avp) {
                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=audio 0 RTP/AVP 19\r\n");
                }
-               
+
        } else if (smh->mparams->num_codecs) {
                int i;
                int cur_ptime = 0, this_ptime = 0, cng_type = 0;
@@ -9872,14 +9873,14 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                smh->mparams->cng_pt = 0;
                        }
                }
-               
+
                mult = switch_channel_get_variable(session->channel, "sdp_m_per_ptime");
 
                if (switch_channel_test_flag(session->channel, CF_AVPF) || (mult && switch_false(mult))) {
                        char *bp = buf;
                        int both = (switch_channel_test_flag(session->channel, CF_AVPF) || switch_channel_test_flag(session->channel, CF_DTLS)) ? 0 : 1;
 
-                       if ((!a_engine->no_crypto && switch_channel_test_flag(session->channel, CF_SECURE)) || 
+                       if ((!a_engine->no_crypto && switch_channel_test_flag(session->channel, CF_SECURE)) ||
                                switch_channel_test_flag(session->channel, CF_DTLS)) {
                                generate_m(session, buf, SDPBUFLEN, port, family, ip, 0, append_audio, sr, use_cng, cng_type, map, 1, sdp_type);
                                bp = (buf + strlen(buf));
@@ -9898,24 +9899,24 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
                        for (i = 0; i < smh->mparams->num_codecs; i++) {
                                const switch_codec_implementation_t *imp = smh->codecs[i];
-                               
+
                                if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) {
                                        continue;
                                }
-                               
+
                                this_ptime = imp->microseconds_per_packet / 1000;
-                               
+
                                if (!strcasecmp(imp->iananame, "ilbc") || !strcasecmp(imp->iananame, "isac")) {
                                        this_ptime = 20;
                                }
-                               
+
                                if (cur_ptime != this_ptime) {
                                        char *bp = buf;
                                        int both = 1;
 
-                                       cur_ptime = this_ptime;                 
-                                       
-                                       if ((!a_engine->no_crypto && switch_channel_test_flag(session->channel, CF_SECURE)) || 
+                                       cur_ptime = this_ptime;
+
+                                       if ((!a_engine->no_crypto && switch_channel_test_flag(session->channel, CF_SECURE)) ||
                                                switch_channel_test_flag(session->channel, CF_DTLS)) {
                                                generate_m(session, bp, SDPBUFLEN - strlen(buf), port, family, ip, cur_ptime, append_audio, sr, use_cng, cng_type, map, 1, sdp_type);
                                                bp = (buf + strlen(buf));
@@ -9933,7 +9934,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                generate_m(session, bp, SDPBUFLEN - strlen(buf), port, family, ip, cur_ptime, append_audio, sr, use_cng, cng_type, map, 0, sdp_type);
                                        }
                                }
-                               
+
                        }
                }
 
@@ -9955,8 +9956,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
                for (i = 0; i < smh->mparams->num_codecs; i++) {
                        const switch_codec_implementation_t *imp = smh->codecs[i];
-                       
-                       
+
+
                        if (imp->codec_type == SWITCH_CODEC_TYPE_VIDEO) {
                                has_vid = 1;
                                break;
@@ -9969,10 +9970,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
        if (!has_vid) {
                if (switch_channel_test_flag(session->channel, CF_VIDEO_SDP_RECVD)) {
                        switch_channel_clear_flag(session->channel, CF_VIDEO_SDP_RECVD);
-                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=video 0 %s 19\r\n", 
-                                                       get_media_profile_name(session, 
-                                                                                                  (switch_channel_test_flag(session->channel, CF_SECURE) 
-                                                                                                       && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) || 
+                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=video 0 %s 19\r\n",
+                                                       get_media_profile_name(session,
+                                                                                                  (switch_channel_test_flag(session->channel, CF_SECURE)
+                                                                                                       && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) ||
                                                                                                   a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS)));
                }
        } else {
@@ -9982,7 +9983,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                        }
                }
 
-               
+
                if (!v_engine->local_sdp_port) {
                        switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_VIDEO, 0);
                }
@@ -10001,22 +10002,22 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                }
 
 
-                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=video %d %s", 
-                                                               v_port, 
-                                                               get_media_profile_name(session, 
-                                                                                                          (loops == 0 && switch_channel_test_flag(session->channel, CF_SECURE) 
-                                                                                                               && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) || 
+                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=video %d %s",
+                                                               v_port,
+                                                               get_media_profile_name(session,
+                                                                                                          (loops == 0 && switch_channel_test_flag(session->channel, CF_SECURE)
+                                                                                                               && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) ||
                                                                                                           a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS)));
-                       
-                                                       
-                       
+
+
+
 
                                /*****************************/
                                if (v_engine->codec_negotiated) {
                                        payload_map_t *pmap;
                                        switch_core_media_set_video_codec(session, 0);
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", v_engine->cur_payload_map->pt);
-                               
+
                                        if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_VIDEO)) {
                                                switch_mutex_lock(smh->sdp_mutex);
                                                for (pmap = v_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) {
@@ -10032,7 +10033,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                        int already_did[128] = { 0 };
                                        for (i = 0; i < smh->mparams->num_codecs; i++) {
                                                const switch_codec_implementation_t *imp = smh->codecs[i];
-                                       
+
 
                                                if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
                                                        continue;
@@ -10059,7 +10060,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                }
 
                                switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "\r\n");
-                               
+
 
                                if (!(vbw = switch_channel_get_variable(smh->session->channel, "rtp_video_max_bandwidth"))) {
                                        vbw = switch_channel_get_variable(smh->session->channel, "rtp_video_max_bandwidth_in");
@@ -10070,7 +10071,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                }
 
                                bw = switch_parse_bandwidth_string(vbw);
-                               
+
                                if (bw > 0) {
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "b=AS:%d\r\n", bw);
                                        //switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "b=TIAS:%d\r\n", bw);
@@ -10177,7 +10178,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                if (!rate) {
                                                        rate = imp->samples_per_second;
                                                }
-                                       
+
                                                channels = get_channels(imp->iananame, imp->number_of_channels);
 
                                                //if (!strcasecmp(imp->iananame, "VP8")) {
@@ -10195,33 +10196,33 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d\r\n", ianacode, imp->iananame,
                                                                                        imp->samples_per_second);
                                                }
-                                       
+
 
 
                                                if (!zstr(ov_fmtp)) {
                                                        fmtp = (char *) ov_fmtp;
                                                } else {
-                                       
+
                                                        if (map) {
                                                                fmtp = switch_event_get_header(map, imp->iananame);
                                                        }
-                                               
+
                                                        if (!zstr(smh->fmtp[i])) {
                                                                fmtp = smh->fmtp[i];
                                                        } else if (smh->fmtps[i]) {
                                                                fmtp = smh->fmtps[i];
                                                        }
-                                               
+
                                                        if (zstr(fmtp)) fmtp = imp->fmtp;
 
                                                        if (zstr(fmtp)) fmtp = (char *) pass_fmtp;
                                                }
-                                       
+
                                                if (!zstr(fmtp) && strcasecmp(fmtp, "_blank_")) {
                                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %s\r\n", ianacode, fmtp);
                                                }
                                        }
-                               
+
                                }
 
                                if ((is_outbound || switch_channel_test_flag(session->channel, CF_RECOVERING))
@@ -10258,7 +10259,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
 
                                if (v_engine->codec_negotiated) {
-                                       add_fb(buf, SDPBUFLEN, v_engine->cur_payload_map->pt, v_engine->fir || fir, 
+                                       add_fb(buf, SDPBUFLEN, v_engine->cur_payload_map->pt, v_engine->fir || fir,
                                                   v_engine->nack || nack, v_engine->pli || pli, v_engine->tmmbr || tmmbr);
 
                                        if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_VIDEO)) {
@@ -10270,13 +10271,13 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                }
                                                switch_mutex_unlock(smh->sdp_mutex);
                                        }
-                                       
+
                                } else if (smh->mparams->num_codecs) {
                                        int i;
                                        int already_did[128] = { 0 };
                                        for (i = 0; i < smh->mparams->num_codecs; i++) {
                                                const switch_codec_implementation_t *imp = smh->codecs[i];
-                                       
+
 
                                                if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
                                                        continue;
@@ -10296,9 +10297,9 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
                                                add_fb(buf, SDPBUFLEN, smh->ianacodes[i], v_engine->fir || fir, v_engine->nack || nack, v_engine->pli || pli, v_engine->pli || pli);
                                        }
-                                       
+
                                }
-                               
+
                                //switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u\r\n", v_engine->ssrc);
 
                                if (v_engine->ice_out.cands[0][0].ready) {
@@ -10313,7 +10314,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                        uint32_t c2 = c1 - 1;
                                        uint32_t c3 = c1 - 2;
                                        uint32_t c4 = c1 - 3;
-                               
+
                                        tmp1[10] = '\0';
                                        tmp2[10] = '\0';
                                        tmp3[10] = '\0';
@@ -10322,20 +10323,20 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                        switch_stun_random_string(tmp3, 10, "0123456789");
 
                                        ice_out = &v_engine->ice_out;
-                                       
-                                       
+
+
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u cname:%s\r\n", v_engine->ssrc, smh->cname);
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u msid:%s v0\r\n", v_engine->ssrc, smh->msid);
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u mslabel:%s\r\n", v_engine->ssrc, smh->msid);
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u label:%sv0\r\n", v_engine->ssrc, smh->msid);
-                               
 
-                               
+
+
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-ufrag:%s\r\n", ice_out->ufrag);
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-pwd:%s\r\n", ice_out->pwd);
 
 
-                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n", 
+                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n",
                                                                        tmp1, ice_out->cands[0][0].transport, c1,
                                                                        ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port
                                                                        );
@@ -10351,7 +10352,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                strcmp(v_engine->local_sdp_ip, ice_out->cands[0][0].con_addr)
                                                && v_engine->local_sdp_port != ice_out->cands[0][0].con_port) {
 
-                                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n", 
+                                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
                                                                                tmp2, ice_out->cands[0][0].transport, c3,
                                                                                ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port,
                                                                                v_engine->local_sdp_ip, v_engine->local_sdp_port
@@ -10361,11 +10362,11 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
                                        if (v_engine->rtcp_mux < 1 || is_outbound || switch_channel_test_flag(session->channel, CF_RECOVERING)) {
 
-                                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n", 
+                                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n",
                                                                                tmp1, ice_out->cands[0][0].transport, c2,
                                                                                ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port + (v_engine->rtcp_mux > 0 ? 0 : 1)
                                                                                );
-                                       
+
                                        if (include_external && !zstr(smh->mparams->extsipip)) {
                                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\n",
                                                                tmp3, ice_out->cands[0][0].transport, c2,
@@ -10377,8 +10378,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                if (!zstr(v_engine->local_sdp_ip) && !zstr(ice_out->cands[0][1].con_addr) && 
                                                        strcmp(v_engine->local_sdp_ip, ice_out->cands[0][1].con_addr)
                                                        && v_engine->local_sdp_port != ice_out->cands[0][1].con_port) {
-                                               
-                                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx generation 0\r\n", 
+
+                                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx generation 0\r\n",
                                                                                        tmp2, ice_out->cands[0][0].transport, c4,
                                                                                        ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port + (v_engine->rtcp_mux > 0 ? 0 : 1),
                                                                                        v_engine->local_sdp_ip, v_engine->local_sdp_port + (v_engine->rtcp_mux > 0 ? 0 : 1)
@@ -10386,8 +10387,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                }
                                        }
 
-                       
-                               
+
+
 #ifdef GOOGLE_ICE
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-options:google-ice\r\n");
 #endif
@@ -10395,14 +10396,14 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
                                }
 
-                               
+
 
                                if (loops == 0 && switch_channel_test_flag(session->channel, CF_SECURE) && !switch_channel_test_flag(session->channel, CF_DTLS)) {
                                        int i;
-                               
+
                                        for (i = 0; smh->crypto_suite_order[i] != CRYPTO_INVALID; i++) {
                                                switch_rtp_crypto_key_type_t j = SUITES[smh->crypto_suite_order[i]].type;
-                                       
+
                                                if ((a_engine->crypto_type == j || a_engine->crypto_type == CRYPTO_INVALID) && !zstr(a_engine->ssec[j].local_crypto_key)) {
                                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=crypto:%s\r\n", v_engine->ssec[j].local_crypto_key);
                                                }
@@ -10417,8 +10418,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                }
 
 
-                               if (switch_channel_test_flag(session->channel, CF_DTLS) || 
-                                       !switch_channel_test_flag(session->channel, CF_SECURE) || 
+                               if (switch_channel_test_flag(session->channel, CF_DTLS) ||
+                                       !switch_channel_test_flag(session->channel, CF_SECURE) ||
                                        smh->crypto_mode == CRYPTO_MODE_MANDATORY || smh->crypto_mode == CRYPTO_MODE_FORBIDDEN) {
                                        break;
                                }
@@ -10438,7 +10439,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                if (!want_msrps) {
                        want_msrps = switch_channel_test_flag(session->channel, CF_WANT_MSRPS);
                }
-       
+
                if (want_msrp || want_msrps) {
                        smh->msrp_session = switch_msrp_session_new(switch_core_session_get_pool(session), switch_core_session_get_uuid(session), want_msrps);
 
@@ -10456,7 +10457,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                        switch_core_session_start_text_thread(session);
                }
        }
-       
+
        if (smh->msrp_session) {
                switch_msrp_session_t *msrp_session = smh->msrp_session;
 
@@ -10513,20 +10514,20 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                        "a=sendonly\na=file-selector:%s\n", file_selector);
                        }
                }
-       } 
+       }
 
        // RTP TEXT
 
        if (sdp_type == SDP_TYPE_RESPONSE && !switch_channel_test_flag(session->channel, CF_RTT)) {
                if (switch_channel_test_flag(session->channel, CF_TEXT_SDP_RECVD)) {
                        switch_channel_clear_flag(session->channel, CF_TEXT_SDP_RECVD);
-                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=text 0 %s 19\r\n", 
-                                                       get_media_profile_name(session, 
-                                                                                                  (switch_channel_test_flag(session->channel, CF_SECURE) 
-                                                                                                       && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) || 
+                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=text 0 %s 19\r\n",
+                                                       get_media_profile_name(session,
+                                                                                                  (switch_channel_test_flag(session->channel, CF_SECURE)
+                                                                                                       && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) ||
                                                                                                   a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS)));
                }
-       } else if ((switch_channel_test_flag(session->channel, CF_WANT_RTT) || switch_channel_test_flag(session->channel, CF_RTT) || 
+       } else if ((switch_channel_test_flag(session->channel, CF_WANT_RTT) || switch_channel_test_flag(session->channel, CF_RTT) ||
                                switch_channel_var_true(session->channel, "rtp_enable_text")) &&
                           switch_channel_test_cap(session->channel, CC_RTP_RTT)) {
                t_engine->t140_pt = 0;
@@ -10569,7 +10570,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                        }
                }
 
-               
+
                if (!t_engine->local_sdp_port) {
                        switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_TEXT, 0);
                }
@@ -10584,17 +10585,17 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                }
 
 
-                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=text %d %s", 
-                                                               t_port, 
-                                                               get_media_profile_name(session, 
-                                                                                                          (loops == 0 && switch_channel_test_flag(session->channel, CF_SECURE) 
-                                                                                                               && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) || 
+                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=text %d %s",
+                                                               t_port,
+                                                               get_media_profile_name(session,
+                                                                                                          (loops == 0 && switch_channel_test_flag(session->channel, CF_SECURE)
+                                                                                                               && switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) ||
                                                                                                           a_engine->crypto_type != CRYPTO_INVALID || switch_channel_test_flag(session->channel, CF_DTLS)));
-                       
-                                                       
+
+
                                /*****************************/
                                if (t_engine->codec_negotiated) {
-                                       
+
                                        switch_mutex_lock(smh->sdp_mutex);
                                        for (pmap = t_engine->payload_map; pmap && pmap->allocated; pmap = pmap->next) {
 
@@ -10603,7 +10604,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                }
 
                                                switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", pmap->pt);
-                                               
+
                                        }
                                        switch_mutex_unlock(smh->sdp_mutex);
                                }
@@ -10617,7 +10618,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                if (pmap->type != SWITCH_MEDIA_TYPE_TEXT || !pmap->negotiated) {
                                                        continue;
                                                }
-                                       
+
                                                if (!strcasecmp(pmap->iananame, "t140")) {
                                                        t_engine->t140_pt = pmap->pt;
                                                }
@@ -10625,10 +10626,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                if (!strcasecmp(pmap->iananame, "red")) {
                                                        t_engine->red_pt = pmap->pt;
                                                }
-                                               
+
                                                switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%ld\r\n",
                                                                                pmap->pt, pmap->iananame, pmap->rate);
-                                               
+
                                        }
                                        switch_mutex_unlock(smh->sdp_mutex);
 
@@ -10637,7 +10638,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %d/%d/%d\r\n", t_engine->red_pt, t_engine->t140_pt, t_engine->t140_pt, t_engine->t140_pt);
                                        }
 
-                                       
+
                                        if (t_engine->smode == SWITCH_MEDIA_FLOW_SENDONLY) {
                                                switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "%s", "a=sendonly\r\n");
                                        } else if (t_engine->smode == SWITCH_MEDIA_FLOW_RECVONLY) {
@@ -10653,7 +10654,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
 
                                if (!zstr(t_engine->local_dtls_fingerprint.type)) {
-                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fingerprint:%s %s\na=setup:%s\r\n", t_engine->local_dtls_fingerprint.type, 
+                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fingerprint:%s %s\na=setup:%s\r\n", t_engine->local_dtls_fingerprint.type,
                                                                        t_engine->local_dtls_fingerprint.str, get_setup(t_engine, session, sdp_type));
                                }
 
@@ -10668,7 +10669,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                }
 
                                //switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u\r\n", t_engine->ssrc);
-                               
+
                                if (t_engine->ice_out.cands[0][0].ready) {
                                        char tmp1[11] = "";
                                        char tmp2[11] = "";
@@ -10680,36 +10681,36 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                        uint32_t c2 = c1 - 1;
                                        uint32_t c3 = c1 - 2;
                                        uint32_t c4 = c1 - 3;
-                               
+
                                        tmp1[10] = '\0';
                                        tmp2[10] = '\0';
                                        switch_stun_random_string(tmp1, 10, "0123456789");
                                        switch_stun_random_string(tmp2, 10, "0123456789");
 
                                        ice_out = &t_engine->ice_out;
-                                       
-                                       
+
+
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u cname:%s\r\n", t_engine->ssrc, smh->cname);
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u msid:%s v0\r\n", t_engine->ssrc, smh->msid);
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u mslabel:%s\r\n", t_engine->ssrc, smh->msid);
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u label:%sv0\r\n", t_engine->ssrc, smh->msid);
-                               
 
-                               
+
+
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-ufrag:%s\r\n", ice_out->ufrag);
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-pwd:%s\r\n", ice_out->pwd);
 
 
-                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n", 
+                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n",
                                                                        tmp1, ice_out->cands[0][0].transport, c1,
                                                                        ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port
                                                                        );
 
-                                       if (!zstr(t_engine->local_sdp_ip) && !zstr(ice_out->cands[0][0].con_addr) && 
+                                       if (!zstr(t_engine->local_sdp_ip) && !zstr(ice_out->cands[0][0].con_addr) &&
                                                strcmp(t_engine->local_sdp_ip, ice_out->cands[0][0].con_addr)
                                                && t_engine->local_sdp_port != ice_out->cands[0][0].con_port) {
 
-                                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n", 
+                                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
                                                                                tmp2, ice_out->cands[0][0].transport, c3,
                                                                                ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port,
                                                                                t_engine->local_sdp_ip, t_engine->local_sdp_port
@@ -10719,17 +10720,17 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
                                        if (t_engine->rtcp_mux < 1 || is_outbound || switch_channel_test_flag(session->channel, CF_RECOVERING)) {
 
-                                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n", 
+                                               switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n",
                                                                                tmp1, ice_out->cands[0][0].transport, c2,
                                                                                ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port + (t_engine->rtcp_mux > 0 ? 0 : 1)
                                                                                );
-                                       
-                                       
-                                               if (!zstr(t_engine->local_sdp_ip) && !zstr(ice_out->cands[0][1].con_addr) && 
+
+
+                                               if (!zstr(t_engine->local_sdp_ip) && !zstr(ice_out->cands[0][1].con_addr) &&
                                                        strcmp(t_engine->local_sdp_ip, ice_out->cands[0][1].con_addr)
                                                        && t_engine->local_sdp_port != ice_out->cands[0][1].con_port) {
-                                               
-                                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx generation 0\r\n", 
+
+                                                       switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx generation 0\r\n",
                                                                                        tmp2, ice_out->cands[0][0].transport, c4,
                                                                                        ice_out->cands[0][0].con_addr, ice_out->cands[0][0].con_port + (t_engine->rtcp_mux > 0 ? 0 : 1),
                                                                                        t_engine->local_sdp_ip, t_engine->local_sdp_port + (t_engine->rtcp_mux > 0 ? 0 : 1)
@@ -10737,21 +10738,21 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                                }
                                        }
 
-                       
-                               
+
+
 #ifdef GOOGLE_ICE
                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-options:google-ice\r\n");
 #endif
                                }
 
-                               
+
 
                                if (loops == 0 && switch_channel_test_flag(session->channel, CF_SECURE) && !switch_channel_test_flag(session->channel, CF_DTLS)) {
                                        int i;
-                               
+
                                        for (i = 0; smh->crypto_suite_order[i] != CRYPTO_INVALID; i++) {
                                                switch_rtp_crypto_key_type_t j = SUITES[smh->crypto_suite_order[i]].type;
-                                       
+
                                                if ((t_engine->crypto_type == j || t_engine->crypto_type == CRYPTO_INVALID) && !zstr(t_engine->ssec[j].local_crypto_key)) {
                                                        switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=crypto:%s\r\n", t_engine->ssec[j].local_crypto_key);
                                                }
@@ -10766,8 +10767,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                }
 
 
-                               if (switch_channel_test_flag(session->channel, CF_DTLS) || 
-                                       !switch_channel_test_flag(session->channel, CF_SECURE) || 
+                               if (switch_channel_test_flag(session->channel, CF_DTLS) ||
+                                       !switch_channel_test_flag(session->channel, CF_SECURE) ||
                                        smh->crypto_mode == CRYPTO_MODE_MANDATORY || smh->crypto_mode == CRYPTO_MODE_FORBIDDEN) {
                                        break;
                                }
@@ -10779,7 +10780,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
        if (map) {
                switch_event_destroy(&map);
        }
-       
+
        if (ptmap) {
                switch_event_destroy(&ptmap);
        }
@@ -10864,7 +10865,7 @@ SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t
        const char *username;
        const char *bit_removal_on = "a=T38FaxFillBitRemoval\r\n";
        const char *bit_removal_off = "";
-       
+
        const char *mmr_on = "a=T38FaxTranscodingMMR\r\n";
        const char *mmr_off = "";
 
@@ -10892,7 +10893,7 @@ SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t
        username = smh->mparams->sdp_username;
 
        var = switch_channel_get_variable(session->channel, "t38_broken_boolean");
-       
+
        broken_boolean = switch_true(var);
 
 
@@ -10945,7 +10946,7 @@ SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t
        };
 
 
-       
+
 
        if (broken_boolean) {
                bit_removal_on = "a=T38FaxFillBitRemoval:1\r\n";
@@ -11099,7 +11100,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session)
                        q += 7;
                        strncpy(q, strchr(a_engine->adv_sdp_ip, ':') ? "6 " : "4 ", 2);
                        p +=2;
-                       q +=2;                  
+                       q +=2;
                        strncpy(q, a_engine->adv_sdp_ip, strlen(a_engine->adv_sdp_ip));
                        q += strlen(a_engine->adv_sdp_ip);
 
@@ -11227,7 +11228,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session)
                                v_engine->cur_payload_map = pmap;
 
                                switch_snprintf(vport_buf, sizeof(vport_buf), "%u", v_engine->adv_sdp_port);
-                               
+
                                if (switch_channel_media_ready(session->channel) && !switch_rtp_ready(v_engine->rtp_session)) {
                                        switch_channel_set_flag(session->channel, CF_VIDEO_POSSIBLE);
                                        switch_channel_set_flag(session->channel, CF_REINVITE);
@@ -11290,7 +11291,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session)
                                t_engine->cur_payload_map = pmap;
 
                                switch_snprintf(tport_buf, sizeof(tport_buf), "%u", t_engine->adv_sdp_port);
-                               
+
                                if (switch_channel_media_ready(session->channel) && !switch_rtp_ready(t_engine->rtp_session)) {
                                        switch_channel_set_flag(session->channel, CF_TEXT_POSSIBLE);
                                        switch_channel_set_flag(session->channel, CF_REINVITE);
@@ -11451,7 +11452,7 @@ SWITCH_DECLARE(void) switch_core_media_start_udptl(switch_core_session_t *sessio
 SWITCH_DECLARE(void) switch_core_media_hard_mute(switch_core_session_t *session, switch_bool_t on)
 {
        switch_core_session_message_t msg = { 0 };
-       
+
        msg.from = __FILE__;
 
        msg.message_id = SWITCH_MESSAGE_INDICATE_HARD_MUTE;
@@ -11464,11 +11465,11 @@ static int check_engine(switch_rtp_engine_t *engine)
        dtls_state_t dtls_state = switch_rtp_dtls_state(engine->rtp_session, DTLS_TYPE_RTP);
        int flags = 0;
        switch_status_t status;
-       
+
        if (dtls_state == DS_READY || dtls_state >= DS_FAIL) return 0;
 
        status = switch_rtp_zerocopy_read_frame(engine->rtp_session, &engine->read_frame, flags);
-       
+
        if (!SWITCH_READ_ACCEPTABLE(status)) {
                return 0;
        }
@@ -11495,7 +11496,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_media_check_dtls(switch_core_session_t
        if (!switch_channel_test_flag(session->channel, CF_DTLS)) {
                return SWITCH_TRUE;
        }
-       
+
        engine = &smh->engines[type];
 
        if (engine->rmode == SWITCH_MEDIA_FLOW_DISABLED) {
@@ -11505,11 +11506,11 @@ SWITCH_DECLARE(switch_bool_t) switch_core_media_check_dtls(switch_core_session_t
        do {
                if (engine->rtp_session) checking = check_engine(engine);
        } while (switch_channel_ready(session->channel) && checking);
-       
+
        if (!checking) {
                return SWITCH_TRUE;
        }
-       
+
        return SWITCH_FALSE;
 }
 
@@ -11531,10 +11532,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_outgoing_bitrate(switch_co
        engine = &smh->engines[type];
 
        if (switch_core_codec_ready(&engine->write_codec)) {
-               status = switch_core_codec_control(&engine->write_codec, SCC_VIDEO_BANDWIDTH, 
+               status = switch_core_codec_control(&engine->write_codec, SCC_VIDEO_BANDWIDTH,
                                                                                   SCCT_INT, &bitrate, SCCT_NONE, NULL, NULL, NULL);
        }
-       
+
        return status;
 }
 
@@ -11589,13 +11590,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
                                switch_channel_audio_sync(session->channel);
                                switch_rtp_reset_jb(a_engine->rtp_session);
                        }
-                       
+
                        if (switch_channel_test_flag(session->channel, CF_CONFERENCE)) {
                                switch_channel_set_flag(session->channel, CF_CONFERENCE_RESET_MEDIA);
                        }
                }
                break;
-               
+
        case SWITCH_MESSAGE_INDICATE_HOLD:
                {
                        if (a_engine && a_engine->rtp_session) {
@@ -11650,7 +11651,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
        case SWITCH_MESSAGE_INDICATE_HARD_MUTE:
                if (a_engine->rtp_session) {
                        if (session->bugs && msg->numeric_arg) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                                                                  "%s has a media bug, hard mute not allowed.\n", switch_channel_get_name(session->channel));
                        } else {
                                if (msg->numeric_arg) {
@@ -11659,7 +11660,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
                                        switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_MUTE);
                                }
 
-                               rtp_flush_read_buffer(a_engine->rtp_session, SWITCH_RTP_FLUSH_ONCE);                            
+                               rtp_flush_read_buffer(a_engine->rtp_session, SWITCH_RTP_FLUSH_ONCE);
                        }
                }
 
@@ -11685,7 +11686,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
                {
                        switch_rtp_engine_t *engine = &smh->engines[msg->numeric_reply];
                        uint32_t level = (uint32_t) msg->numeric_arg;
-                       
+
                        if (engine->rtp_session) {
                                switch_core_codec_control(&engine->read_codec, SCC_DEBUG, SCCT_INT, (void *)&level, SCCT_NONE, NULL, NULL, NULL);
                                switch_core_codec_control(&engine->write_codec, SCC_DEBUG, SCCT_INT, (void *)&level, SCCT_NONE, NULL, NULL, NULL);
@@ -11713,16 +11714,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
 
                        if (engine->rtp_session) {
                                if (iotype == SWITCH_IO_READ) {
-                                       switch_core_codec_control(&engine->read_codec, SCC_CODEC_SPECIFIC, 
-                                                                                         SCCT_STRING, (void *)msg->string_array_arg[2], 
+                                       switch_core_codec_control(&engine->read_codec, SCC_CODEC_SPECIFIC,
+                                                                                         SCCT_STRING, (void *)msg->string_array_arg[2],
                                                                                          SCCT_STRING, (void *)msg->string_array_arg[3], &reply_type, &reply);
                                } else {
-                                       switch_core_codec_control(&engine->write_codec, SCC_CODEC_SPECIFIC, 
-                                                                                         SCCT_STRING, (void *)msg->string_array_arg[2], 
+                                       switch_core_codec_control(&engine->write_codec, SCC_CODEC_SPECIFIC,
+                                                                                         SCCT_STRING, (void *)msg->string_array_arg[2],
                                                                                          SCCT_STRING, (void *)msg->string_array_arg[3], &reply_type, &reply);
                                }
-                               
-                               
+
+
                                if (reply_type == SCCT_STRING) {
                                        msg->string_array_arg[4] = (char *)reply;
                                }
@@ -11782,17 +11783,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
                        if (switch_rtp_ready(a_engine->rtp_session)) {
                                const char *val;
                                int ok = 0;
-                               
+
                                if (!switch_channel_test_flag(session->channel, CF_VIDEO) &&
                                        (!(val = switch_channel_get_variable(session->channel, "rtp_jitter_buffer_during_bridge")) || switch_false(val))) {
                                        if (switch_channel_test_flag(session->channel, CF_JITTERBUFFER) && switch_channel_test_cap_partner(session->channel, CC_FS_RTP)) {
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
-                                                                                 "%s PAUSE Jitterbuffer\n", switch_channel_get_name(session->channel));                                        
+                                                                                 "%s PAUSE Jitterbuffer\n", switch_channel_get_name(session->channel));
                                                switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_TRUE);
                                                switch_set_flag(smh, SMF_JB_PAUSED);
                                        }
                                }
-                               
+
                                if (switch_channel_test_flag(session->channel, CF_PASS_RFC2833) && switch_channel_test_flag_partner(session->channel, CF_FS_RTP)) {
                                        switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
@@ -11826,38 +11827,38 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
                                                ok = smh->media_flags[SCMF_RTP_AUTOFLUSH_DURING_BRIDGE];
                                        }
                                }
-                               
+
                                if (ok) {
                                        rtp_flush_read_buffer(a_engine->rtp_session, SWITCH_RTP_FLUSH_STICK);
                                        switch_channel_set_flag(session->channel, CF_AUTOFLUSH_DURING_BRIDGE);
                                } else {
                                        rtp_flush_read_buffer(a_engine->rtp_session, SWITCH_RTP_FLUSH_ONCE);
                                }
-                               
+
                        }
                }
                goto end;
        case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
                if (switch_rtp_ready(a_engine->rtp_session)) {
-                       
+
                        if (switch_test_flag(smh, SMF_JB_PAUSED)) {
                                switch_clear_flag(smh, SMF_JB_PAUSED);
                                if (switch_channel_test_flag(session->channel, CF_JITTERBUFFER)) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
-                                                                         "%s RESUME Jitterbuffer\n", switch_channel_get_name(session->channel));                                       
+                                                                         "%s RESUME Jitterbuffer\n", switch_channel_get_name(session->channel));
                                        switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_FALSE);
                                }
                        }
-                       
+
 
                        if (switch_rtp_test_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s deactivate passthru 2833 mode.\n",
                                                                  switch_channel_get_name(session->channel));
                                switch_rtp_clear_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
                        }
-                       
+
                        if (switch_channel_test_flag(session->channel, CF_NOTIMER_DURING_BRIDGE)) {
-                               if (!switch_rtp_test_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_UDPTL) && 
+                               if (!switch_rtp_test_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_UDPTL) &&
                                        !switch_rtp_test_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
                                        switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
                                        //switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
@@ -11893,7 +11894,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
 
                        a_engine->codec_negotiated = 0;
                        v_engine->codec_negotiated = 0;
-                       
+
                        if (session->track_duration) {
                                switch_core_session_enable_heartbeat(session, session->track_duration);
                        }
@@ -11902,7 +11903,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
 
        case SWITCH_MESSAGE_INDICATE_3P_NOMEDIA:
                switch_channel_set_flag(session->channel, CF_PROXY_MODE);
-               switch_core_media_set_local_sdp(session, NULL, SWITCH_FALSE); 
+               switch_core_media_set_local_sdp(session, NULL, SWITCH_FALSE);
                break;
        case SWITCH_MESSAGE_INDICATE_NOMEDIA:
                {
@@ -11972,7 +11973,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
                                if (*msg->string_arg == '=') {
                                        switch_channel_set_variable(session->channel, "codec_string", msg->string_arg);
                                } else {
-                                       switch_channel_set_variable_printf(session->channel, 
+                                       switch_channel_set_variable_printf(session->channel,
                                                                                                           "codec_string", "=%s", switch_channel_get_variable(session->channel, "ep_codec_string"));
                                }
 
@@ -12005,7 +12006,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
                                        }
 
                                        rtp_flush_read_buffer(a_engine->rtp_session, SWITCH_RTP_FLUSH_UNSTICK);
-                                       
+
                                } else {
                                        if (switch_test_flag(smh, SMF_JB_PAUSED)) {
                                                switch_clear_flag(smh, SMF_JB_PAUSED);
@@ -12028,7 +12029,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
 
                }
 
-               
+
        default:
                break;
        }
@@ -12125,7 +12126,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_ready(switch_core_session_t *session,
 
        if (!(smh = session->media_handle)) {
                return 0;
-       }       
+       }
 
        return switch_rtp_ready(smh->engines[type].rtp_session);
 }
@@ -12143,7 +12144,7 @@ SWITCH_DECLARE(void) switch_core_media_set_rtp_flag(switch_core_session_t *sessi
 
        if (switch_rtp_ready(smh->engines[type].rtp_session)) {
                switch_rtp_set_flag(smh->engines[type].rtp_session, flag);
-       }       
+       }
 }
 
 //?
@@ -12159,7 +12160,7 @@ SWITCH_DECLARE(void) switch_core_media_clear_rtp_flag(switch_core_session_t *ses
 
        if (switch_rtp_ready(smh->engines[type].rtp_session)) {
                switch_rtp_clear_flag(smh->engines[type].rtp_session, flag);
-       }       
+       }
 }
 
 //?
@@ -12171,7 +12172,7 @@ SWITCH_DECLARE(void) switch_core_media_set_telephony_event(switch_core_session_t
 
        if (!(smh = session->media_handle)) {
                return;
-       }       
+       }
 
        if (switch_rtp_ready(smh->engines[type].rtp_session)) {
                switch_rtp_set_telephony_event(smh->engines[type].rtp_session, te);
@@ -12304,18 +12305,18 @@ static void add_audio_codec(sdp_rtpmap_t *map, const switch_codec_implementation
        char ratestr[20] = "";
        char bitstr[20] = "";
        switch_codec_fmtp_t codec_fmtp = { 0 };
-                                               
+
        if (!codec_ms) {
                codec_ms = switch_default_ptime(map->rm_encoding, map->rm_pt);
        }
 
        map_channels = map->rm_params ? atoi(map->rm_params) : 1;
        map_bit_rate = switch_known_bitrate((switch_payload_t)map->rm_pt);
-                               
+
        if (!ptime && !strcasecmp(map->rm_encoding, "g723")) {
                ptime = codec_ms = 30;
        }
-                               
+
        if (zstr(map->rm_fmtp)) {
                if (!strcasecmp(map->rm_encoding, "ilbc")) {
                        ptime = codec_ms = 30;
@@ -12387,7 +12388,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
        if ((var = switch_channel_get_variable(channel, "ep_codec_prefer_sdp")) && switch_true(var)) {
                prefer_sdp = 1;
        }
-               
+
        if (!zstr(codec_string)) {
                char *tmp_codec_string;
                if ((tmp_codec_string = strdup(codec_string))) {
@@ -12418,7 +12419,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
 
        for (m = sdp->sdp_media; m; m = m->m_next) {
                ptime = dptime;
-               
+
                if ((m->m_type == sdp_media_audio || m->m_type == sdp_media_video) && m->m_port) {
                        for (map = m->m_rtpmaps; map; map = map->rm_next) {
                                for (attr = m->m_attributes; attr; attr = attr->a_next) {
@@ -12430,7 +12431,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
                                                break;
                                        }
                                }
-                               switch_core_media_add_payload_map(session, 
+                               switch_core_media_add_payload_map(session,
                                                                                                  m->m_type == sdp_media_audio ? SWITCH_MEDIA_TYPE_AUDIO : SWITCH_MEDIA_TYPE_VIDEO,
                                                                                                  map->rm_encoding,
                                                                                                  NULL,
@@ -12495,7 +12496,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
                                                if (match) {
                                                        add_audio_codec(map, imp, ptime, buf, sizeof(buf));
                                                }
-                                       
+
                                        }
                                }
 
@@ -12642,7 +12643,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_chosen(switch_core_sessi
        if (!(smh = session->media_handle)) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        engine = &smh->engines[type];
 
        if (engine->cur_payload_map->iananame) {
@@ -12723,7 +12724,7 @@ SWITCH_DECLARE(void) switch_core_session_stop_media(switch_core_session_t *sessi
 
        smh->owner_id = 0;
        smh->session_id = 0;
-       
+
        a_engine->local_dtls_fingerprint.len = 0;
        v_engine->local_dtls_fingerprint.len = 0;
        t_engine->local_dtls_fingerprint.len = 0;
@@ -12758,7 +12759,7 @@ SWITCH_DECLARE(void) switch_core_media_check_outgoing_proxy(switch_core_session_
        }
 
        r_sdp = switch_channel_get_variable(o_session->channel, SWITCH_R_SDP_VARIABLE);
-       
+
        a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
        v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
        t_engine = &smh->engines[SWITCH_MEDIA_TYPE_TEXT];
@@ -12767,7 +12768,7 @@ SWITCH_DECLARE(void) switch_core_media_check_outgoing_proxy(switch_core_session_
 
        clear_pmaps(a_engine);
        clear_pmaps(v_engine);
-       
+
        pmap = switch_core_media_add_payload_map(session,
                                                                                         SWITCH_MEDIA_TYPE_AUDIO,
                                                                                         "PROXY",
@@ -12795,7 +12796,7 @@ SWITCH_DECLARE(void) switch_core_media_check_outgoing_proxy(switch_core_session_
                                                                                                 90000,
                                                                                                 1,
                                                                                                 SWITCH_TRUE);
-               
+
                v_engine->cur_payload_map = pmap;
 
                switch_channel_set_flag(session->channel, CF_VIDEO);
@@ -12816,7 +12817,7 @@ SWITCH_DECLARE(void) switch_core_media_check_outgoing_proxy(switch_core_session_
                                                                                                 1000,
                                                                                                 1,
                                                                                                 SWITCH_TRUE);
-               
+
                t_engine->cur_payload_map = pmap;
 
                switch_channel_set_flag(session->channel, CF_HAS_TEXT);
@@ -12832,7 +12833,7 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s
        const char *a_ip;
        const char *r_ip;
        const char *r_port;
-       const char *tmp;        
+       const char *tmp;
        switch_rtp_engine_t *a_engine, *v_engine;
        switch_media_handle_t *smh;
 
@@ -12841,7 +12842,7 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s
        if (!(smh = session->media_handle)) {
                return;
        }
-       
+
        ip = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
        port = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
 
@@ -12871,7 +12872,7 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s
                const char *vtmp = switch_channel_get_variable(session->channel, "rtp_last_video_codec_string");
                switch_channel_set_variable_printf(session->channel, "rtp_use_codec_string", "%s%s%s", tmp, vtmp ? "," : "", vtmp ? vtmp : "");
        }
-       
+
        if ((tmp = switch_channel_get_variable(session->channel, "rtp_use_codec_string"))) {
                char *tmp_codec_string = switch_core_session_strdup(smh->session, tmp);
                smh->codec_order_last = switch_separate_string(tmp_codec_string, ',', smh->codec_order, SWITCH_MAX_CODECS);
@@ -12908,7 +12909,7 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s
        }
 
        switch_core_media_set_codec(session, 0, smh->mparams->codec_flags);
-       
+
        a_engine->adv_sdp_ip = smh->mparams->extrtpip = (char *) ip;
        a_engine->adv_sdp_port = a_engine->local_sdp_port = (switch_port_t)atoi(port);
        a_engine->codec_negotiated = 1;
@@ -12931,7 +12932,7 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s
                if ((tmp = switch_channel_get_variable(session->channel, "rtp_use_video_pt"))) {
                        v_engine->cur_payload_map->pt = (switch_payload_t)atoi(tmp);
                }
-               
+
                if ((tmp = switch_channel_get_variable(session->channel, "rtp_video_recv_pt"))) {
                        v_engine->cur_payload_map->recv_pt = (switch_payload_t)atoi(tmp);
                }
@@ -12983,16 +12984,16 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s
                switch_core_media_add_crypto(&a_engine->ssec[a_engine->crypto_type], a_engine->ssec[a_engine->crypto_type].local_crypto_key, SWITCH_RTP_CRYPTO_SEND);
                switch_core_media_add_crypto(&a_engine->ssec[a_engine->crypto_type], a_engine->ssec[a_engine->crypto_type].remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
                switch_channel_set_flag(smh->session->channel, CF_SECURE);
-               
+
                switch_rtp_add_crypto_key(a_engine->rtp_session, SWITCH_RTP_CRYPTO_SEND, idx,
                                                                  a_engine->crypto_type,
-                                                                 a_engine->ssec[a_engine->crypto_type].local_raw_key, 
+                                                                 a_engine->ssec[a_engine->crypto_type].local_raw_key,
                                                                  SUITES[a_engine->crypto_type].keylen);
-               
-               switch_rtp_add_crypto_key(a_engine->rtp_session, SWITCH_RTP_CRYPTO_RECV, 
+
+               switch_rtp_add_crypto_key(a_engine->rtp_session, SWITCH_RTP_CRYPTO_RECV,
                                                                  a_engine->ssec[a_engine->crypto_type].crypto_tag,
-                                                                 a_engine->crypto_type, 
-                                                                 a_engine->ssec[a_engine->crypto_type].remote_raw_key, 
+                                                                 a_engine->crypto_type,
+                                                                 a_engine->ssec[a_engine->crypto_type].remote_raw_key,
                                                                  SUITES[a_engine->crypto_type].keylen);
        }
 
@@ -13007,7 +13008,7 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s
 
 SWITCH_DECLARE(void) switch_core_media_init(void)
 {
-       switch_core_gen_certs(DTLS_SRTP_FNAME ".pem");  
+       switch_core_gen_certs(DTLS_SRTP_FNAME ".pem");
 
        video_globals.cpu_count = switch_core_cpu_count();
        video_globals.cur_cpu = 0;
@@ -13062,7 +13063,7 @@ static int payload_number(const char *name)
 static int find_pt(const char *sdp, const char *name)
 {
        const char *p;
-       
+
        if ((p = switch_stristr(name, sdp))) {
                if (p < end_of_p(sdp) && *(p+strlen(name)) == '/' && *(p-1) == ' ') {
                        p -= 2;
@@ -13097,10 +13098,10 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
        int tst;
        end++;
 
-       
+
        if (remove || only) {
                pt = payload_number(arg);
-               
+
                if (pt < 0) {
                        pt = find_pt(sdp_str, arg);
                }
@@ -13136,15 +13137,15 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
                                        while(*i != ' ' && i < end) {
                                                *o++ = *i++;
                                        }
-                                       
+
                                        *o++ = *i++;
                                }
-                                       
+
                                if (slash && switch_is_leading_number(i)) {
 
-                                       
+
                                        number = atoi(i);
-                                               
+
                                        while(i < end && ((*i > 47 && *i < 58) || *i == ' ')) {
 
                                                if (remove)  {
@@ -13157,11 +13158,11 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
                                                        *o++ = *i;
                                                }
                                                i++;
-                                                       
+
                                                if (*i == ' ') {
                                                        break;
                                                }
-                                                       
+
                                        }
 
                                        if (remove)  {
@@ -13179,7 +13180,7 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
 
                while (i < end && !strncasecmp(i, "a=rtpmap:", 9)) {
                        const char *t = i + 9;
-                               
+
                        number = atoi(t);
 
                        if (remove)  {
@@ -13201,7 +13202,7 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
 
                while (i < end && !strncasecmp(i, "a=fmtp:", 7)) {
                        const char *t = i + 7;
-                               
+
                        number = atoi(t);
 
                        if (remove)  {
@@ -13231,7 +13232,7 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
        }
 
        *o = '\0';
-       
+
        return new_sdp;
 }
 
@@ -13268,11 +13269,11 @@ SWITCH_DECLARE(char *) switch_core_media_process_sdp_filter(const char *sdp, con
                        }
 
 
-                       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, 
-                                                         "%s Filter command %s(%s)\nFROM:\n==========\n%s\nTO:\n==========\n%s\n\n", 
+                       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG,
+                                                         "%s Filter command %s(%s)\nFROM:\n==========\n%s\nTO:\n==========\n%s\n\n",
                                                          switch_channel_get_name(channel),
                                                          command, arg, patched_sdp ? patched_sdp : sdp, tmp_sdp);
-                       
+
 
                        if (tmp_sdp) {
                                switch_safe_free(patched_sdp);
@@ -13296,7 +13297,7 @@ SWITCH_DECLARE(switch_timer_t *) switch_core_media_get_timer(switch_core_session
        if (!(smh = session->media_handle)) {
                return NULL;
        }
-       
+
        if (!(engine = &smh->engines[mtype])) {
                return NULL;
        }
@@ -13311,11 +13312,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_request_video_refresh(switch
        switch_media_handle_t *smh = NULL;
 
        switch_assert(session);
-       
+
        if (!(smh = session->media_handle)) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if (switch_channel_test_flag(channel, CF_VIDEO)) {
                switch_core_session_message_t msg = { 0 };
                switch_time_t now = switch_micro_time_now();
@@ -13347,16 +13348,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_and_request_video_refre
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_session_t *session,
                                                                                                                                switch_media_type_t mtype,
                                                                                                                                switch_io_type_t iotype,
-                                                                                                                               switch_codec_control_command_t cmd, 
+                                                                                                                               switch_codec_control_command_t cmd,
                                                                                                                                switch_codec_control_type_t ctype,
                                                                                                                                void *cmd_data,
                                                                                                                                switch_codec_control_type_t atype,
                                                                                                                                void *cmd_arg,
                                                                                                                                switch_codec_control_type_t *rtype,
-                                                                                                                               void **ret_data) 
+                                                                                                                               void **ret_data)
 {
        switch_rtp_engine_t *engine = NULL;
        switch_media_handle_t *smh = NULL;
@@ -13367,7 +13368,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
        if (!(smh = session->media_handle)) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if (!(engine = &smh->engines[mtype])) {
                return SWITCH_STATUS_NOTIMPL;
        }
@@ -13395,8 +13396,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
        return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_bool_t) switch_core_media_codec_get_cap(switch_core_session_t *session, 
-                                                                                                                               switch_media_type_t mtype, 
+SWITCH_DECLARE(switch_bool_t) switch_core_media_codec_get_cap(switch_core_session_t *session,
+                                                                                                                               switch_media_type_t mtype,
                                                                                                                                switch_codec_flag_t flag) {
        switch_rtp_engine_t *engine = NULL;
        switch_media_handle_t *smh = NULL;
@@ -13413,7 +13414,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_media_codec_get_cap(switch_core_sessio
        }
 
        codec = &engine->write_codec;
-       
+
        if (!switch_core_codec_ready(codec)) {
                return SWITCH_FALSE;
        }
@@ -13425,7 +13426,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_media_codec_get_cap(switch_core_sessio
        return SWITCH_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_write_encoded_video_frame(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_write_encoded_video_frame(switch_core_session_t *session,
                                                                                                                                                switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
 {
        switch_io_event_hook_video_write_frame_t *ptr;
@@ -13467,7 +13468,7 @@ SWITCH_DECLARE(void) switch_core_session_video_reinit(switch_core_session_t *ses
        smh->video_init = 0;
        smh->video_last_key_time = 0;
        switch_core_session_send_and_request_video_refresh(session);
-       
+
        type = 1;
        switch_core_media_codec_control(session, SWITCH_MEDIA_TYPE_VIDEO, SWITCH_IO_READ, SCC_VIDEO_RESET, SCCT_INT, (void *)&type, SCCT_NONE, NULL, NULL, NULL);
        switch_core_session_request_video_refresh(session);
@@ -13519,10 +13520,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                return SWITCH_STATUS_SUCCESS;
        }
 
-       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];      
+       v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
        if (smh->write_mutex[SWITCH_MEDIA_TYPE_VIDEO] && switch_mutex_trylock(smh->write_mutex[SWITCH_MEDIA_TYPE_VIDEO]) != SWITCH_STATUS_SUCCESS) {
                /* return CNG, another thread is already writing  */
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being written to for %s\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being written to for %s\n",
                                                  switch_channel_get_name(session->channel), type2str(SWITCH_MEDIA_TYPE_VIDEO));
                return SWITCH_STATUS_INUSE;
        }
@@ -13535,12 +13536,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                }
 
                smh->video_last_key_time = now;
-       }       
+       }
 
        if (smh->mparams->video_key_freq && (now - smh->video_last_key_time) > smh->mparams->video_key_freq) {
                switch_core_media_gen_key_frame(smh->session);
                smh->video_last_key_time = now;
-       }       
+       }
 
        if (!img) {
                switch_status_t vstatus;
@@ -13548,7 +13549,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                if (!switch_rtp_test_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_GEN_TS_MANUAL)) {
                        switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_GEN_TS_DELTA);
                }
-               
+
                vstatus = switch_core_session_write_encoded_video_frame(session, frame, flags, stream_id);
                switch_goto_status(vstatus, done);
        } else {
@@ -13559,15 +13560,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
 
 
        /* When desired, scale video to match the input signal (if output is bigger) */
-       if (switch_channel_test_flag(session->channel, CF_VIDEO_READY) && smh->vid_params.width && 
-               switch_channel_test_flag(session->channel, CF_VIDEO_MIRROR_INPUT) && 
+       if (switch_channel_test_flag(session->channel, CF_VIDEO_READY) && smh->vid_params.width &&
+               switch_channel_test_flag(session->channel, CF_VIDEO_MIRROR_INPUT) &&
                ((smh->vid_params.width != img->d_w) || (smh->vid_params.height != img->d_h))) {
 
                switch_img_letterbox(img, &dup_img, smh->vid_params.width, smh->vid_params.height, "#000000f");
 
                img = dup_img;
        }
-       
+
        if (session->bugs) {
                switch_media_bug_t *bp;
                int prune = 0;
@@ -13580,19 +13581,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                        if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
                                continue;
                        }
-               
+
                        if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) {
                                continue;
                        }
-               
+
                        if (switch_test_flag(bp, SMBF_PRUNE)) {
                                prune++;
                                continue;
                        }
-               
+
                        if (bp->ready && switch_test_flag(bp, SMBF_WRITE_VIDEO_STREAM)) {
                                switch_image_t *dimg = NULL;
-                               
+
                                switch_img_copy(img, &dimg);
                                switch_queue_push(bp->write_video_queue, dimg);
 
@@ -13603,7 +13604,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
 
                        }
 
-                       if (bp->ready && img && 
+                       if (bp->ready && img &&
                                (switch_test_flag(bp, SMBF_WRITE_VIDEO_PING) || (switch_core_media_bug_test_flag(bp, SMBF_SPY_VIDEO_STREAM) && !patched))) {
                                switch_frame_t bug_frame = { 0 };
 
@@ -13622,7 +13623,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                                        switch_core_media_bug_patch_spy_frame(bp, img, SWITCH_RW_WRITE);
                                }
 
-                               
+
                        }
 
                        if (ok == SWITCH_FALSE) {
@@ -13637,7 +13638,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                if (prune) {
                        switch_core_media_bug_prune(session);
                }
-               
+
        }
 
        write_frame = *frame;
@@ -13647,7 +13648,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
        if (!switch_test_flag(frame, SFF_USE_VIDEO_TIMESTAMP)) {
 
                if (!(timer = switch_core_media_get_timer(session, SWITCH_MEDIA_TYPE_VIDEO))) {
-                       
+
                        if (!smh->video_timer.timer_interface) {
                                switch_core_timer_init(&smh->video_timer, "soft", 1, 90, switch_core_session_get_pool(session));
                        }
@@ -13664,11 +13665,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
        do {
                frame->datalen = SWITCH_DEFAULT_VIDEO_SIZE;
                encode_status = switch_core_codec_encode_video(codec, frame);
-               
+
                if (encode_status == SWITCH_STATUS_SUCCESS || encode_status == SWITCH_STATUS_MORE_DATA) {
 
                        switch_assert((encode_status == SWITCH_STATUS_SUCCESS && frame->m) || !frame->m);
-                       
+
                        if (frame->flags & SFF_PICTURE_RESET) {
                                switch_core_session_video_reinit(session);
                                frame->flags &= ~SFF_PICTURE_RESET;
@@ -13679,7 +13680,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
                        switch_set_flag(frame, SFF_RAW_RTP_PARSE_FRAME);
                        status = switch_core_session_write_encoded_video_frame(session, frame, flags, stream_id);
                }
-               
+
        } while(status == SWITCH_STATUS_SUCCESS && encode_status == SWITCH_STATUS_MORE_DATA);
 
  done:
@@ -13689,7 +13690,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
        }
 
        switch_img_free(&dup_img);
-       
+
        return status;
 }
 
@@ -13704,7 +13705,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_wait_for_video_input_params(
        if (!(smh = session->media_handle)) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if (!switch_channel_test_flag(session->channel, CF_VIDEO_DECODED_READ)) {
                return SWITCH_STATUS_GENERR;;
        }
@@ -13716,12 +13717,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_wait_for_video_input_params(
        }
 
        switch_core_session_get_read_impl(session, &read_impl);
-               
+
        while(switch_channel_ready(session->channel) && timeout_ms > 0) {
                switch_frame_t *read_frame;
                switch_status_t status;
-               
-               if (video_globals.synced && 
+
+               if (video_globals.synced &&
                        switch_channel_test_flag(session->channel, CF_VIDEO_READY) && smh->vid_params.width && smh->vid_params.height && smh->vid_params.fps) {
                        return SWITCH_STATUS_SUCCESS;
                }
@@ -13737,7 +13738,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_wait_for_video_input_params(
        }
 
        return SWITCH_STATUS_TIMEOUT;
-       
+
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
@@ -13748,7 +13749,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
        uint32_t loops = 0;
        switch_media_handle_t *smh;
        int patchers = 0;
-               
+
        switch_assert(session != NULL);
 
        if (!(smh = session->media_handle)) {
@@ -13792,12 +13793,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
        if (!(*frame)) {
                goto done;
        }
-       
+
        if (switch_channel_test_flag(session->channel, CF_VIDEO_DEBUG_READ)) {
                if (switch_test_flag((*frame), SFF_CNG)) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "VIDEO: CNG\n");
                } else {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
                                                          "VIDEO: seq: %d ts: %u len: %4d %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x mark: %d\n",
                                                          (*frame)->seq, (*frame)->timestamp, (*frame)->datalen,
                                                          *((uint8_t *)(*frame)->data), *((uint8_t *)(*frame)->data + 1),
@@ -13821,9 +13822,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
                (*frame)->img = NULL;
 
                decode_status = switch_core_codec_decode_video((*frame)->codec, *frame);
-               
+
                if ((*frame)->img && switch_channel_test_flag(session->channel, CF_VIDEO_DEBUG_READ)) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "IMAGE %dx%d %dx%d\n", 
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "IMAGE %dx%d %dx%d\n",
                                                          (*frame)->img->w, (*frame)->img->h, (*frame)->img->d_w, (*frame)->img->d_h);
                }
 
@@ -13853,7 +13854,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
 
                if (decode_status == SWITCH_STATUS_MORE_DATA || !(*frame)->img) {
                        goto top;
-               }               
+               }
        }
 
        if (!switch_channel_test_flag(session->channel, CF_VIDEO_READY) && *frame) {
@@ -13898,9 +13899,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
                                }
                        }
 
-                       if (bp->ready && (*frame) && (*frame)->img && 
+                       if (bp->ready && (*frame) && (*frame)->img &&
                                (switch_test_flag(bp, SMBF_READ_VIDEO_PING) || (switch_core_media_bug_test_flag(bp, SMBF_SPY_VIDEO_STREAM) && !patched))) {
-                               
+
 
                                if (bp->callback && switch_test_flag(bp, SMBF_READ_VIDEO_PING)) {
                                        if (switch_test_flag(bp, SMBF_READ_VIDEO_PATCH)) {
@@ -13926,7 +13927,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
                                prune++;
                        }
                }
-               
+
                switch_thread_rwlock_unlock(session->bug_rwlock);
 
                if (prune) {
@@ -13950,7 +13951,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_callback(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_callback(switch_core_session_t *session,
                                                                                                                                                        switch_core_video_thread_callback_func_t func, void *user_data)
 {
        switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -13999,7 +14000,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_video_read_callback(switch_c
 
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_text_read_callback(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_text_read_callback(switch_core_session_t *session,
                                                                                                                                                        switch_core_text_thread_callback_func_t func, void *user_data)
 {
        switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -14098,7 +14099,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_text_frame(switch_core_
        if (!(*frame)) {
                goto done;
        }
-       
+
        now = switch_micro_time_now();
 
        if (switch_test_flag((*frame), SFF_CNG)) {
@@ -14119,16 +14120,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_text_frame(switch_core_
                                switch_set_flag((*frame), SFF_TEXT_LINE_BREAK);
                                break;
                        }
-                       
+
                        if (*p == 0xE2 && *(p+1) == 0x80 && *(p+2) == 0xA8) {
                                switch_set_flag((*frame), SFF_TEXT_LINE_BREAK);
                                break;
                        }
-                       
+
                        p++;
                }
        }
-       
+
        if ((*frame)->data && (*frame)->datalen && !((*frame)->flags & SFF_CNG)) {
                if (!session->text_buffer) {
                        switch_mutex_init(&session->text_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
@@ -14162,7 +14163,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_text_frame(switch_core_
                                int bytes = 0;
 
                                if ((*frame)) {
-                                       switch_size_t inuse = 0;                                
+                                       switch_size_t inuse = 0;
 
                                        if ((*frame)->data && (*frame)->datalen && !((*frame)->flags & SFF_CNG)) {
                                                switch_mutex_lock(session->text_mutex);
@@ -14172,45 +14173,45 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_text_frame(switch_core_
 
                                        inuse = switch_buffer_inuse(bp->text_buffer);
 
-                                       if (zstr(bp->text_framedata) && inuse && 
+                                       if (zstr(bp->text_framedata) && inuse &&
                                                (switch_channel_test_flag(session->channel, CF_TEXT_IDLE) || switch_test_flag((*frame), SFF_TEXT_LINE_BREAK))) {
 
                                                if (inuse + 1 > bp->text_framesize) {
                                                        void *tmp = malloc(inuse + 1024);
                                                        memcpy(tmp, bp->text_framedata, bp->text_framesize);
-                                                       
+
                                                        switch_assert(tmp);
-                                                       
+
                                                        bp->text_framesize = inuse + 1024;
-                                                       
+
                                                        free(bp->text_framedata);
                                                        bp->text_framedata = tmp;
-                                                       
+
                                                }
-                                       
+
 
                                                bytes = switch_buffer_read(bp->text_buffer, bp->text_framedata, inuse);
-                                               *(bp->text_framedata + bytes) = '\0'; 
+                                               *(bp->text_framedata + bytes) = '\0';
 
                                                ok = bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_TEXT);
                                                bp->text_framedata[0] = '\0';
                                        } else ok = SWITCH_TRUE;
                                }
                        }
-                       
+
                        if (ok == SWITCH_FALSE) {
                                switch_set_flag(bp, SMBF_PRUNE);
                                prune++;
                        }
                }
-               
+
                switch_thread_rwlock_unlock(session->bug_rwlock);
 
                if (prune) {
                        switch_core_media_bug_prune(session);
                }
        }
-       
+
        if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) {         
                if ((switch_channel_test_flag(session->channel, CF_QUEUE_TEXT_EVENTS) || switch_channel_test_flag(session->channel, CF_FIRE_TEXT_EVENTS)) && 
                        (*frame)->datalen && !switch_test_flag((*frame), SFF_CNG)) {
@@ -14226,8 +14227,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_text_frame(switch_core_
                                        switch_buffer_create_dynamic(&session->text_line_buffer, 512, 1024, 0);
                                }
                                switch_buffer_write(session->text_line_buffer, (*frame)->data, (*frame)->datalen);
-                               
-                               
+
+
                                if (switch_channel_test_flag(session->channel, CF_TEXT_IDLE) || switch_test_flag((*frame), SFF_TEXT_LINE_BREAK)) {
                                        switch_buffer_write(session->text_line_buffer, eof, 1);
                                        data = switch_buffer_get_head_pointer(session->text_line_buffer);
@@ -14283,7 +14284,7 @@ static void build_red_packet(switch_rtp_engine_t *t_engine)
        uint16_t *u16;
 
        pos = t_engine->tf->red_pos + 1;
-       
+
        if (pos == t_engine->tf->red_max) pos = 0;
 
        for (;;) {
@@ -14304,23 +14305,23 @@ static void build_red_packet(switch_rtp_engine_t *t_engine)
                        buf++;//3
                        *buf += (len & 0x300) >> 8;
                        buf++;//4
-                       *buf = len & 0xff;                      
+                       *buf = len & 0xff;
                }
 
                buf++;
 
                if (pos == t_engine->tf->red_pos) break;
-               
+
 
                pos++;
 
                if (pos == t_engine->tf->red_max) pos = 0;
        }
 
-       
+
        plen = ((loops - 1) * 4) + 1;
        pos = t_engine->tf->red_pos + 1;
-       
+
        if (pos == t_engine->tf->red_max) pos = 0;
 
        for (;;) {
@@ -14364,7 +14365,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core
        if (switch_channel_down(session->channel)) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if (switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_TEXT) == SWITCH_MEDIA_FLOW_RECVONLY || switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_TEXT) == SWITCH_MEDIA_FLOW_INACTIVE) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG3, "Writing text to RECVONLY/INACTIVE session\n");
                return SWITCH_STATUS_SUCCESS;
@@ -14376,7 +14377,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core
 
        if (smh->write_mutex[SWITCH_MEDIA_TYPE_TEXT] && switch_mutex_trylock(smh->write_mutex[SWITCH_MEDIA_TYPE_TEXT]) != SWITCH_STATUS_SUCCESS) {
                /* return CNG, another thread is already writing  */
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being written to for %s\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being written to for %s\n",
                                                  switch_channel_get_name(session->channel), type2str(SWITCH_MEDIA_TYPE_TEXT));
                goto done;
        }
@@ -14404,7 +14405,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core
 
                        if (t_engine->tf->write_empty > TEXT_PERIOD_TIMEOUT / TEXT_TIMER_MS) {
                                int pos;
-                       
+
                                for(pos = 0; pos < t_engine->tf->red_max; pos++) {
                                        t_engine->tf->red_ts[pos] = 0;
                                        t_engine->tf->red_buf[pos][0] = '\0';
@@ -14413,12 +14414,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core
 
                                frame->m = 1;
                                t_engine->tf->write_empty = 0;
-                       
+
                        } else {
                                frame->m = 0;
                        }
 
-                       t_engine->tf->red_buflen[t_engine->tf->red_pos] = 
+                       t_engine->tf->red_buflen[t_engine->tf->red_pos] =
                                switch_buffer_read(t_engine->tf->write_buffer, t_engine->tf->red_buf[t_engine->tf->red_pos], RED_PACKET_SIZE);
 
                        *(t_engine->tf->red_buf[t_engine->tf->red_pos] + t_engine->tf->red_buflen[t_engine->tf->red_pos]) = '\0';
@@ -14483,12 +14484,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_printf(switch_core_session_t
 
        frame.data = data;
        frame.datalen = strlen(data);
-       
+
        switch_core_session_write_text_frame(session, &frame, 0, 0);
 
        frame.data = CR;
        frame.datalen = 3;
-       
+
        switch_core_session_write_text_frame(session, &frame, 0, 0);
 
        switch_safe_free(data);
@@ -14576,7 +14577,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
        switch_mutex_lock(session->codec_write_mutex);
 
        if (!(frame->codec && frame->codec->implementation)) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has received a bad frame with no codec!\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has received a bad frame with no codec!\n",
                                                  switch_channel_get_name(session->channel));
                switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                switch_mutex_unlock(session->codec_write_mutex);
@@ -14596,7 +14597,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
        switch_mutex_lock(frame->codec->mutex);
 
        if (!(switch_core_codec_ready(session->write_codec) && switch_core_codec_ready(frame->codec))) goto error;
-       
+
        if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) {
                if (session->write_impl.codec_id == frame->codec->implementation->codec_id ||
                        session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) {
@@ -14646,7 +14647,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
                        switch_set_flag(other_session, SSF_WRITE_CODEC_RESET);
                        switch_core_session_rwunlock(other_session);
                }
-               
+
                switch_clear_flag(session, SSF_WRITE_TRANSCODE);
        }
 
@@ -14685,15 +14686,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
                if (do_resample && status == SWITCH_STATUS_SUCCESS) {
                        status = SWITCH_STATUS_RESAMPLE;
                }
-               
+
                /* mux or demux to match */
                if (session->write_impl.number_of_channels != frame->codec->implementation->number_of_channels) {
                        uint32_t rlen = session->raw_write_frame.datalen / 2 / frame->codec->implementation->number_of_channels;
-                       switch_mux_channels((int16_t *) session->raw_write_frame.data, rlen, 
+                       switch_mux_channels((int16_t *) session->raw_write_frame.data, rlen,
                                                                frame->codec->implementation->number_of_channels, session->write_impl.number_of_channels);
                        session->raw_write_frame.datalen = rlen * 2 * session->write_impl.number_of_channels;
                }
-               
+
                switch (status) {
                case SWITCH_STATUS_RESAMPLE:
                        resample++;
@@ -14774,7 +14775,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
                        goto error;
                }
        }
-       
+
 
 
        if (session->write_resampler) {
@@ -14785,14 +14786,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
 
                        if (switch_resample_calc_buffer_size(session->write_resampler->to_rate, session->write_resampler->from_rate,
                                                                                                 write_frame->datalen / 2 / session->write_resampler->channels) > SWITCH_RECOMMENDED_BUFFER_SIZE) {
-                               
+
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s not enough buffer space for required resample operation!\n",
                                                                  switch_channel_get_name(session->channel));
                                switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                switch_mutex_unlock(session->resample_mutex);
                                goto error;
                        }
-               
+
 
                        switch_resample_process(session->write_resampler, data, write_frame->datalen / 2 / session->write_resampler->channels);
 
@@ -14840,7 +14841,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
                                switch_mutex_lock(bp->write_mutex);
                                switch_buffer_write(bp->raw_write_buffer, write_frame->data, write_frame->datalen);
                                switch_mutex_unlock(bp->write_mutex);
-                               
+
                                if (bp->callback) {
                                        ok = bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_WRITE);
                                }
@@ -15038,7 +15039,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
                                                        status = switch_resample_create(&session->write_resampler,
                                                                                                                        frame->codec->implementation->actual_samples_per_second,
                                                                                                                        session->write_impl.actual_samples_per_second,
-                                                                                                                       session->write_impl.decoded_bytes_per_packet, SWITCH_RESAMPLE_QUALITY, 
+                                                                                                                       session->write_impl.decoded_bytes_per_packet, SWITCH_RESAMPLE_QUALITY,
                                                                                                                        session->write_impl.number_of_channels);
                                                }
                                                switch_mutex_unlock(session->resample_mutex);
@@ -15052,7 +15053,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
                                                        msg.numeric_arg = 1;
                                                        msg.message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
                                                        switch_core_session_receive_message(session, &msg);
-                                                       
+
 
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Activating write resampler\n");
                                                }
@@ -15074,7 +15075,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
                                                int ok = 0;
 
                                                switch_mutex_lock(session->resample_mutex);
-                                               if (session->write_resampler) {                                 
+                                               if (session->write_resampler) {
                                                        switch_resample_destroy(&session->write_resampler);
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Deactivating write resampler\n");
                                                        ok = 1;
index b5f6a865496912f3f29aef0ec4db7f4bbe0c856a..df461ccf377db85195dc52a2148dfc226389aaa4 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -208,10 +208,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
        }
 
        if ((!bug->raw_read_buffer && (!bug->raw_write_buffer || !switch_test_flag(bug, SMBF_WRITE_STREAM)))) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR,
                                "%s Buffer Error (raw_read_buffer=%p, raw_write_buffer=%p, read=%s, write=%s)\n",
                                switch_channel_get_name(bug->session->channel),
-                               (void *)bug->raw_read_buffer, (void *)bug->raw_write_buffer, 
+                               (void *)bug->raw_read_buffer, (void *)bug->raw_write_buffer,
                                switch_test_flag(bug, SMBF_READ_STREAM) ? "yes" : "no",
                                switch_test_flag(bug, SMBF_WRITE_STREAM) ? "yes" : "no");
                return SWITCH_STATUS_FALSE;
@@ -241,7 +241,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
        } else {
                uint32_t frame_size;
                switch_codec_implementation_t read_impl = { 0 };
-               
+
                switch_core_session_get_read_impl(bug->session, &read_impl);
                frame_size = read_impl.decoded_bytes_per_packet;
                bug->record_frame_size = frame_size;
@@ -290,7 +290,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
        if (do_write && do_write > SWITCH_RECOMMENDED_BUFFER_SIZE) {
                do_write = 1280;
        }
-       
+
        if (do_read) {
                switch_mutex_lock(bug->read_mutex);
                frame->datalen = (uint32_t) switch_buffer_read(bug->raw_read_buffer, frame->data, do_read);
@@ -359,7 +359,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
        } else {
                for (x = 0; x < blen; x++) {
                        int32_t w = 0, r = 0, z = 0;
-                       
+
                        if (x < rlen) {
                                r = (int32_t) * (fp + x);
                        }
@@ -367,7 +367,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
                        if (x < wlen) {
                                w = (int32_t) * (dp + x);
                        }
-                       
+
                        z = w + r;
 
                        if (z > SWITCH_SMAX || z < SWITCH_SMIN) {
@@ -431,7 +431,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med
                        switch_queue_create(&bug->spy_video_queue[i], SWITCH_CORE_QUEUE_LEN, switch_core_session_get_pool(bug->session));
                }
        }
-       
+
        spy_q = bug->spy_video_queue[rw];
 
        while(switch_queue_size(spy_q) > 0) {
@@ -461,7 +461,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med
                                if ((float)w/h == aspect169) {
                                        if ((float)bug->spy_img[rw]->d_w / bug->spy_img[rw]->d_h == aspect169) {
                                                spy_tmp = switch_img_copy_rect(bug->spy_img[rw], bug->spy_img[rw]->d_w / 4, 0, bug->spy_img[rw]->d_w / 2, bug->spy_img[rw]->d_h);
-                                               
+
                                        } else {
                                                switch_img_copy(bug->spy_img[rw], &spy_tmp);
                                        }
@@ -507,10 +507,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med
 
                                spyw = (int) (float)w * scaler;
                                spyh = (int) (float)h * scaler;
-                               
+
                                if (bug->spy_img[rw]->d_w != spyw || bug->spy_img[rw]->d_h != spyh) {
                                        switch_image_t *tmp_img = NULL;
-                                       
+
                                        switch_img_scale(bug->spy_img[rw], &tmp_img, spyw, spyh);
                                        switch_img_free(&bug->spy_img[rw]);
                                        bug->spy_img[rw] = tmp_img;
@@ -535,7 +535,7 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void *
        void *pop;
        uint8_t *buf;
        switch_size_t buflen = SWITCH_RTP_MAX_BUF_LEN;
-       switch_frame_t frame = { 0 };   
+       switch_frame_t frame = { 0 };
 
        buf = switch_core_session_alloc(bug->session, buflen);
        frame.packet = buf;
@@ -560,16 +560,16 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void *
                switch_status_t status;
                int w = 0, h = 0, ok = 1;
 
-               
+
                if ((status = switch_queue_pop(main_q, &pop)) == SWITCH_STATUS_SUCCESS) {
                        switch_img_free(&img);
-                       
+
                        if (!pop) {
                                goto end;
                        }
 
                        img = (switch_image_t *) pop;
-                       
+
                        w = img->d_w;
                        h = img->d_h;
 
@@ -586,15 +586,15 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void *
                                if (other_img) {
                                        if (other_img->d_w != w || other_img->d_h != h) {
                                                switch_image_t *tmp_img = NULL;
-                                               
+
                                                switch_img_scale(other_img, &tmp_img, w, h);
                                                switch_img_free(&other_img);
                                                other_img = tmp_img;
                                        }
                                }
-                               
+
                                w *= 2;
-                               
+
                                if (!IMG || IMG->d_h != h || IMG->d_w != w) {
                                        switch_img_free(&IMG);
                                        IMG = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, w, h, 1);
@@ -672,8 +672,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
                                                                                                                  const char *function,
                                                                                                                  const char *target,
                                                                                                                  switch_media_bug_callback_t callback,
-                                                                                                                 void *user_data, time_t stop_time, 
-                                                                                                                 switch_media_bug_flag_t flags, 
+                                                                                                                 void *user_data, time_t stop_time,
+                                                                                                                 switch_media_bug_flag_t flags,
                                                                                                                  switch_media_bug_t **new_bug)
 {
        switch_media_bug_t *bug, *bp;
@@ -690,12 +690,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
                                if (!zstr(bp->function) && !strcasecmp(function, bp->function)) {
                                        punt = 1;
                                        break;
-                               } 
+                               }
                        }
                        switch_thread_rwlock_unlock(session->bug_rwlock);
                }
        }
-       
+
        if (punt) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Only one bug of this type allowed!\n");
                return SWITCH_STATUS_GENERR;
@@ -763,7 +763,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
        if (target) {
                bug->target = switch_core_session_strdup(session, target);
        }
-       
+
        bug->stop_time = stop_time;
        bytes = bug->read_impl.decoded_bytes_per_packet;
 
@@ -801,7 +801,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
                switch_buffer_create_dynamic(&bug->text_buffer, 512, 1024, 0);
                switch_zmalloc(bug->text_framedata, 1024);
                bug->text_framesize = 1024;
-               
+
        }
 
        if ((switch_test_flag(bug, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bug, SMBF_WRITE_VIDEO_STREAM))) {
@@ -816,7 +816,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
                }
        }
 
-       
+
        if (bug->callback) {
                switch_bool_t result = bug->callback(bug, bug->user_data, SWITCH_ABC_TYPE_INIT);
                if (result == SWITCH_FALSE) {
@@ -834,7 +834,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
                switch_memory_pool_t *pool = switch_core_session_get_pool(session);
                switch_threadattr_create(&thd_attr, pool);
                switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-               switch_thread_create(&bug->video_bug_thread, thd_attr, video_bug_thread, bug, pool);            
+               switch_thread_create(&bug->video_bug_thread, thd_attr, video_bug_thread, bug, pool);
 
        }
 
@@ -846,7 +846,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
        for(bp = session->bugs; bp; bp = bp->next) {
                if (bp->ready && !switch_test_flag(bp, SMBF_TAP_NATIVE_READ) && !switch_test_flag(bp, SMBF_TAP_NATIVE_WRITE)) {
                        tap_only = 0;
-               }       
+               }
        }
 
        switch_thread_rwlock_unlock(session->bug_rwlock);
@@ -901,7 +901,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch
                const char *save_stereo = switch_channel_get_variable(new_channel, "record_stereo");
                const char *orig_stereo = switch_channel_get_variable(orig_channel, "record_stereo");
                const char *new_stereo = orig_stereo;
-               
+
                switch_thread_rwlock_wrlock(orig_session->bug_rwlock);
                switch_channel_set_variable(new_channel, "RECORD_MIN_SEC", "0");
                switch_channel_set_variable(new_channel, "record_append", "true");
@@ -935,7 +935,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_core_session_t *orig_session, switch_core_session_t *new_session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_core_session_t *orig_session, switch_core_session_t *new_session,
                                                                                                                                                switch_media_bug_callback_t callback, void * (*user_data_dup_func) (switch_core_session_t *, void *))
 {
        switch_media_bug_t *new_bug = NULL, *cur = NULL, *bp = NULL, *last = NULL;
@@ -946,7 +946,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_c
        while (bp) {
                cur = bp;
                bp = bp->next;
-               
+
                if (cur->callback == callback) {
                        if (last) {
                                last->next = cur->next;
@@ -1057,7 +1057,7 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_patch_video(switch_core_session_t
        return x;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session,
                                                                                                                           const char *function, switch_media_bug_exec_cb_t cb, void *user_data)
 {
        switch_media_bug_t *bp;
@@ -1089,12 +1089,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess
                switch_thread_rwlock_rdlock(session->bug_rwlock);
                for (bp = session->bugs; bp; bp = bp->next) {
                        int thread_locked = (bp->thread_id && bp->thread_id == switch_thread_self());
-                       stream->write_function(stream, 
+                       stream->write_function(stream,
                                                                   " <media-bug>\n"
                                                                   "  <function>%s</function>\n"
                                                                   "  <target>%s</target>\n"
                                                                   "  <thread-locked>%d</thread-locked>\n"
-                                                                  " </media-bug>\n", 
+                                                                  " </media-bug>\n",
                                                                   bp->function, bp->target, thread_locked);
 
                }
@@ -1102,7 +1102,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess
        }
 
        stream->write_function(stream, "</media-bugs>\n");
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1114,13 +1114,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(switch
        if (session->bugs) {
                switch_thread_rwlock_wrlock(session->bug_rwlock);
                for (bp = session->bugs; bp; bp = bp->next) {
-                       if (!switch_test_flag(session, SSF_DESTROYABLE) && 
+                       if (!switch_test_flag(session, SSF_DESTROYABLE) &&
                                ((bp->thread_id && bp->thread_id != switch_thread_self()) || switch_test_flag(bp, SMBF_LOCK))) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "BUG is thread locked skipping.\n");
                                last = bp;
                                continue;
                        }
-                       
+
                        if (!zstr(function) && strcmp(bp->function, function)) {
                                last = bp;
                                continue;
@@ -1196,7 +1196,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(switch_media_bug_t *
                        if (bp->read_video_queue) {
                                switch_queue_push(bp->read_video_queue, NULL);
                        }
-                       
+
                        if (bp->write_video_queue) {
                                switch_queue_push(bp->write_video_queue, NULL);
                        }
@@ -1248,10 +1248,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session
                for(bp2 = session->bugs; bp2; bp2 = bp2->next) {
                        if (bp2->ready && !switch_test_flag(bp2, SMBF_TAP_NATIVE_READ) && !switch_test_flag(bp2, SMBF_TAP_NATIVE_WRITE)) {
                                tap_only = 0;
-                       }       
+                       }
                }
        }
-       
+
        if (tap_only) {
                switch_set_flag(session, SSF_MEDIA_BUG_TAP_ONLY);
        } else {
@@ -1263,7 +1263,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session
        if (bp) {
                status = switch_core_media_bug_close(&bp);
        }
-       
+
        return status;
 }
 
@@ -1305,7 +1305,7 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *sess
                ttl++;
                goto top;
        }
-       
+
        return ttl;
 }
 
index 90fa1fc96d9627e94fd497d3e3c59b7091746716..9e4bc12964a17bfe93472d828de0fecd5b08cf7b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -84,7 +84,7 @@ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(switch_core_session_t *
 
 #ifdef DEBUG_ALLOC
        if (memory > DEBUG_ALLOC_CUTOFF)
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Session Allocate %s %d\n", 
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Session Allocate %s %d\n",
                                                  (void *) session->pool, (void *) session, apr_pool_tag(session->pool, NULL), (int) memory);
 #endif
 
@@ -117,7 +117,7 @@ SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(switch_size_t memory,
 #endif
 
 #ifdef DEBUG_ALLOC
-       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n", 
+       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n",
                                          (void *)memory_manager.memory_pool, apr_pool_tag(memory_manager.memory_pool, NULL), (int) memory);
 #endif
 
@@ -159,7 +159,7 @@ SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(const char *todup, c
        switch_assert(duped != NULL);
 
 #ifdef DEBUG_ALLOC
-       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n", 
+       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n",
                                          (void *) memory_manager.memory_pool, apr_pool_tag(memory_manager.memory_pool, NULL), (int) len);
 #endif
 
@@ -252,7 +252,7 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(switch_core_session_t
 #ifdef DEBUG_ALLOC
        len = strlen(todup);
        if (len > DEBUG_ALLOC_CUTOFF)
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Sess Strdup Allocate %s %ld\n", 
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Sess Strdup Allocate %s %ld\n",
                                                  (void *) session->pool, (void *)session, apr_pool_tag(session->pool, NULL), strlen(todup));
 #endif
 
@@ -291,7 +291,7 @@ SWITCH_DECLARE(char *) switch_core_perform_strdup(switch_memory_pool_t *pool, co
 
 #ifdef DEBUG_ALLOC
        if (len > DEBUG_ALLOC_CUTOFF)
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Strdup Allocate %s %d\n", 
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Strdup Allocate %s %d\n",
                                                  (void *) pool, apr_pool_tag(pool, NULL), (int)len);
 #endif
 
@@ -462,7 +462,7 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(switch_memory_pool_t *pool, swi
 
 #ifdef DEBUG_ALLOC
        if (memory > DEBUG_ALLOC_CUTOFF)
-               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Allocate %s %d\n", 
+               switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Allocate %s %d\n",
                                                  (void *) pool, apr_pool_tag(pool, NULL), (int) memory);
        /*switch_assert(memory < 20000); */
 #endif
@@ -531,7 +531,7 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
 #endif
 
 #ifdef DEBUG_ALLOC
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);   
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
 #endif
                                apr_pool_destroy(pop);
 #ifdef USE_MEM_LOCK
@@ -540,7 +540,7 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
 #else
                                apr_pool_mutex_set(pop, NULL);
 #ifdef DEBUG_ALLOC
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);   
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
 #endif
                                apr_pool_clear(pop);
                                if (switch_queue_trypush(memory_manager.pool_recycle_queue, pop) != SWITCH_STATUS_SUCCESS) {
@@ -548,7 +548,7 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
                                        switch_mutex_lock(memory_manager.mem_lock);
 #endif
 #ifdef DEBUG_ALLOC
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);   
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
 #endif
                                        apr_pool_destroy(pop);
 #ifdef USE_MEM_LOCK
@@ -607,8 +607,8 @@ void switch_core_memory_stop(void)
 
        memory_manager.pool_thread_running = 0;
        switch_thread_join(&st, pool_thread_p);
-       
-       
+
+
        while (switch_queue_trypop(memory_manager.pool_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
                apr_pool_destroy(pop);
        }
index 9a88e1013dcafd9166071b81acc81d2deae7e2d3..5c440537ee3c17003850567b3b5be25153a30fea 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -71,7 +71,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(const char *ip, s
        odd = switch_test_flag(alloc, SPF_ODD);
 
        alloc->flags |= runtime.port_alloc_flags;
-       
+
 
        if (!(even && odd)) {
                if (even) {
@@ -125,7 +125,7 @@ static switch_bool_t test_port(switch_core_port_allocator_t *alloc, int family,
        if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
                return SWITCH_FALSE;
        }
-       
+
        if (switch_sockaddr_info_get(&local_addr, alloc->ip, SWITCH_UNSPEC, port, 0, pool) == SWITCH_STATUS_SUCCESS) {
                if (switch_socket_create(&sock, family, type, 0, pool) == SWITCH_STATUS_SUCCESS) {
                        if (switch_socket_bind(sock, local_addr) == SWITCH_STATUS_SUCCESS) {
@@ -134,9 +134,9 @@ static switch_bool_t test_port(switch_core_port_allocator_t *alloc, int family,
                        switch_socket_close(sock);
                }
        }
-       
+
        switch_core_destroy_memory_pool(&pool);
-       
+
        return r;
 }
 
index 056f08425a01ca1381e653622c1a89529424fced..61c9ca45b990e5b7a45dce2c9e8ab75522ae0633 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
index 95aa65794b97e2e08d09e3103ffded0b67e78741..a810cc45cdcf994884e19c11b80249c99ec83a19 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -57,7 +57,7 @@ SWITCH_DECLARE(switch_ivr_dmachine_t *) switch_core_session_get_dmachine(switch_
 {
        int i = (int) target;
 
-       if (i == 0 || i == 1) { 
+       if (i == 0 || i == 1) {
                return session->dmachine[i];
        }
 
@@ -85,7 +85,7 @@ SWITCH_DECLARE(void) switch_core_session_soft_unlock(switch_core_session_t *sess
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_codec_slin(switch_core_session_t *session, switch_slin_data_t *data)
-                                                                                                       
+
 {
        switch_codec_implementation_t read_impl = { 0 };
        int interval;
@@ -321,7 +321,7 @@ SWITCH_DECLARE(switch_console_callback_match_t *) switch_core_session_findall_ma
                if ((session = switch_core_session_locate(np->str))) {
                        const char *this_val;
                        if (switch_channel_up_nosig(session->channel) &&
-                               (this_val = switch_channel_get_variable_dup(session->channel, var_name, SWITCH_FALSE, -1)) && 
+                               (this_val = switch_channel_get_variable_dup(session->channel, var_name, SWITCH_FALSE, -1)) &&
                                (!var_val || (like && switch_stristr(like, var_val)) || !strcmp(this_val, var_val))) {
                                switch_console_push_match(&my_matches, (const char *) np->str);
                        }
@@ -342,9 +342,9 @@ SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_i
        switch_core_session_t *session;
        switch_memory_pool_t *pool;
        struct str_node *head = NULL, *np;
-       
+
        switch_core_new_memory_pool(&pool);
-       
+
        switch_mutex_lock(runtime.session_hash_mutex);
        for (hi = switch_core_hash_first(session_manager.session_table); hi; hi = switch_core_hash_next(&hi)) {
                switch_core_hash_this(hi, NULL, NULL, &val);
@@ -401,7 +401,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
        }
        switch_mutex_unlock(runtime.session_hash_mutex);
 
-       for(np = head; np; np = np->next) { 
+       for(np = head; np; np = np->next) {
                if ((session = switch_core_session_locate(np->str))) {
                        switch_channel_hangup(session->channel, cause);
                        switch_core_session_rwunlock(session);
@@ -683,7 +683,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
                                switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_CODEC_VARIABLE, ep);
                        }
 
-                       
+
                        if (switch_channel_test_flag(channel, CF_MSRPS) || switch_channel_test_flag(channel, CF_WANT_MSRPS)) {
                                switch_channel_set_flag(peer_channel, CF_WANT_MSRPS);
                        } else if (switch_channel_test_flag(channel, CF_MSRP) || switch_channel_test_flag(channel, CF_WANT_MSRP)) {
@@ -849,7 +849,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
        if ((status = switch_core_session_read_lock_hangup(session)) != SWITCH_STATUS_SUCCESS) {
                return status;
        }
-       
+
        if (!message->_file) {
                message->_file = file;
        }
@@ -884,7 +884,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
 
                if (zstr(message->string_array_arg[0]) && !zstr(message->string_arg)) {
                        arg = switch_core_session_strdup(session, message->string_arg);
-                       switch_separate_string(arg, '|', (char **)message->string_array_arg, 2);                        
+                       switch_separate_string(arg, '|', (char **)message->string_array_arg, 2);
                }
 
                if (!zstr(message->string_array_arg[0])) {
@@ -894,7 +894,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
                if (!zstr(message->string_array_arg[1])) {
                        switch_channel_set_variable(session->channel, "last_sent_callee_id_number", message->string_array_arg[1]);
                }
-               
+
 
                if (switch_true(switch_channel_get_variable(session->channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE))) {
                        switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line,
@@ -909,7 +909,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
                switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line,
                                                  switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG, "%s skip receive message [%s] (channel is hungup already)\n",
                                                  switch_channel_get_name(session->channel), message_names[message->message_id]);
-       
+
        } else {
                if (session->media_handle) {
                        status = switch_core_media_receive_message(session, message);
@@ -937,7 +937,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
                        switch_channel_clear_flag(session->channel, CF_CONFIRM_BLIND_TRANSFER);
 
                        if (!zstr(uuid) && (other_session = switch_core_session_locate(uuid))) {
-                               switch_core_session_message_t msg = { 0 };                      
+                               switch_core_session_message_t msg = { 0 };
                                msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE;
                                msg.from = __FILE__;
                                msg.numeric_arg = 1;
@@ -1130,7 +1130,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_signal_data(switch_cor
                switch_core_session_wake_session_thread(session);
 
        }
-       
+
        return status;
 }
 
@@ -1431,7 +1431,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_wake_session_thread(switch_c
  top:
 
        status = switch_mutex_trylock(session->mutex);
-       
+
        if (status == SWITCH_STATUS_SUCCESS) {
                switch_thread_cond_signal(session->cond);
                switch_mutex_unlock(session->mutex);
@@ -1594,7 +1594,7 @@ SWITCH_STANDARD_SCHED_FUNC(sch_heartbeat_callback)
        switch_event_t *event;
        switch_core_session_t *session;
        char *uuid = task->cmd_arg;
-       switch_core_session_message_t msg = { 0 }; 
+       switch_core_session_message_t msg = { 0 };
 
        if ((session = switch_core_session_locate(uuid))) {
                switch_event_create(&event, SWITCH_EVENT_SESSION_HEARTBEAT);
@@ -1752,7 +1752,7 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_worker(switch_th
                if (check_status == SWITCH_STATUS_SUCCESS) {
                        switch_thread_data_t *td = (switch_thread_data_t *) pop;
 
-#ifdef DEBUG_THREAD_POOL                       
+#ifdef DEBUG_THREAD_POOL
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Worker Thread %ld Processing\n", (long) (intptr_t) thread);
 #endif
                        td->func(thread, td->obj);
@@ -1808,11 +1808,11 @@ static void thread_launch_failure(void)
                                                  "Artoo reduces the max sessions to %d thus, saving the switch from certain doom.\n", sess_count - 10);
 
        }
-       
+
        switch_mutex_unlock(session_manager.mutex);
 }
 
-static switch_status_t check_queue(void) 
+static switch_status_t check_queue(void)
 {
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_mutex_lock(session_manager.mutex);
@@ -1828,7 +1828,7 @@ static switch_status_t check_queue(void)
                switch_threadattr_t *thd_attr;
                switch_memory_pool_t *pool;
                switch_thread_pool_node_t *node;
-               
+
                switch_core_new_memory_pool(&pool);
                node = switch_core_alloc(pool, sizeof(*node));
                node->pool = pool;
@@ -1869,7 +1869,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_pool_launch_thread(switch_thread_d
        status = switch_queue_push(session_manager.thread_queue, td);
        check_queue();
 
-       return status;  
+       return status;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_core_session_t *session)
@@ -1902,7 +1902,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_se
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_thread_t *thread;
        switch_threadattr_t *thd_attr;
-       
+
        if (switch_test_flag(session, SSF_THREAD_RUNNING) || switch_test_flag(session, SSF_THREAD_STARTED)) {
                status = SWITCH_STATUS_INUSE;
                goto end;
@@ -1912,7 +1912,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_se
        if (switch_test_flag((&runtime), SCF_SESSION_THREAD_POOL)) {
                return switch_core_session_thread_pool_launch(session);
        }
-       
+
        switch_mutex_lock(session->mutex);
 
        if (switch_test_flag(session, SSF_THREAD_RUNNING)) {
@@ -1932,7 +1932,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_se
                        status = SWITCH_STATUS_SUCCESS;
                } else {
                        switch_clear_flag(session, SSF_THREAD_RUNNING);
-                       switch_clear_flag(session, SSF_THREAD_STARTED); 
+                       switch_clear_flag(session, SSF_THREAD_STARTED);
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Cannot create thread!\n");
                        thread_launch_failure();
                }
@@ -1948,7 +1948,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_se
 SWITCH_DECLARE(const char *) switch_core_session_get_text_buffer(switch_core_session_t *session)
 {
        const char *buf = NULL;
-       
+
        if (session->text_buffer) {
                switch_mutex_lock(session->text_mutex);
                buf = (const char *)switch_core_session_strdup(session, (const char *) switch_buffer_get_head_pointer(session->text_buffer));
@@ -2186,7 +2186,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e
                        }
                }
        }
-       
+
        if ((callflow = switch_xml_child(xml, "callflow"))) {
                if ((tag2 = switch_xml_child(callflow, "caller_profile"))) {
                        switch_caller_profile_t *caller_profile;
@@ -2338,7 +2338,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
                count = session_manager.session_count;
                sps = --runtime.sps;
                switch_mutex_unlock(runtime.throttle_mutex);
-               
+
                if (sps <= 0) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error! %d\n", session_manager.session_count);
                        UNPROTECT_INTERFACE(endpoint_interface);
@@ -2594,7 +2594,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(sw
 {
        switch_event_t *execute_event;
        char *ap, *arp;
-       
+
        if (!arg && strstr(app, "::")) {
                ap = switch_core_session_strdup(session, app);
                app = ap;
@@ -2604,7 +2604,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(sw
                        arg = arp + 2;
                }
        }
-       
+
        if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
                switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute");
                switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", app);
@@ -2612,14 +2612,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(sw
                if (arg) {
                        switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", arg);
                }
-               
+
                if (!switch_channel_test_flag(session->channel, CF_PROXY_MODE)) {
                        switch_channel_set_flag(session->channel, CF_BLOCK_BROADCAST_UNTIL_MEDIA);
                }
 
                switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true");
                switch_core_session_queue_private_event(session, &execute_event, SWITCH_FALSE);
-               
+
                return SWITCH_STATUS_SUCCESS;
        }
 
@@ -2653,21 +2653,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flag
                        *p++ = '0';
                        arg = p;
 
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s ASYNC CALL CONVERTED TO INLINE %s(%s)\n", 
-                                                         switch_channel_get_name(session->channel), app, switch_str_nil(arg));                 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s ASYNC CALL CONVERTED TO INLINE %s(%s)\n",
+                                                         switch_channel_get_name(session->channel), app, switch_str_nil(arg));
                }
-               
+
                if ((application_interface = switch_loadable_module_get_application_interface(app)) == 0) {
                        return SWITCH_STATUS_FALSE;
                }
 
                if (switch_test_flag(application_interface, SAF_ZOMBIE_EXEC)) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s ZOMBIE EXEC %s(%s)\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s ZOMBIE EXEC %s(%s)\n",
                                                          switch_channel_get_name(session->channel), app, switch_str_nil(arg));
                        goto exec;
                }
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                  "%s Channel is hungup and application '%s' does not have the zombie_exec flag.\n",
                                                  switch_channel_get_name(session->channel), app);
 
@@ -2720,15 +2720,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flag
                        } while(!ready && sanity);
 
                        if (!ready) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                                                                  "Cannot execute app '%s' media required on an outbound channel that does not have media established\n", app);
                                switch_goto_status(SWITCH_STATUS_FALSE, done);
                        }
                }
        }
 
-       if (switch_channel_text_only(session->channel) && 
-               !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA) && 
+       if (switch_channel_text_only(session->channel) &&
+               !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA) &&
                !switch_test_flag(application_interface, SAF_SUPPORT_TEXT_ONLY)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Application %s does not support text-only mode on channel %s!\n",
                                                  app, switch_channel_get_name(session->channel));
@@ -2780,7 +2780,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
        if (expanded && *expanded == '%' && (*(expanded+1) == '[' || *(expanded+2) == '[')) {
                char *p, *dup;
                switch_event_t *ovars = NULL;
-               
+
                p = expanded + 1;
 
                if (*p != '[') {
@@ -2789,7 +2789,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
                }
 
                dup = strdup(p);
-               
+
                if (expanded != arg) {
                        switch_safe_free(expanded);
                }
@@ -2801,7 +2801,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
                scope = 1;
        }
 
-       
+
        if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "EXECUTE %s %s(%s)\n",
                                          switch_channel_get_name(session->channel), app, switch_str_nil(expanded));
index 95403dbf42a47f023a74960e1c85d36f9c8e9238..91d7fa9f78435f0e85e7e8312644ec20a5c2193d 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -274,7 +274,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle
                switch_mux_channels((int16_t *) data, rlen, 1, sh->channels);
                *datalen = rlen * 2 * sh->channels;
        }
-       
+
        return status;
 
 }
index b323c85e41beb09a284c7041beb9e75d9cc0cc93..e5c493e8030f53109390cc78676430b5147f9017 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -129,7 +129,7 @@ static void del_handle(switch_cache_db_handle_t *dbh)
                        sql_manager.total_handles--;
                        break;
                }
-               
+
                last = dbh_ptr;
        }
        switch_mutex_unlock(sql_manager.dbh_mutex);
@@ -143,7 +143,7 @@ static switch_cache_db_handle_t *get_handle(const char *db_str, const char *user
 
        hash = switch_ci_hashfunc_default(db_str, &hlen);
        thread_hash = switch_ci_hashfunc_default(thread_str, &hlen);
-       
+
        switch_mutex_lock(sql_manager.dbh_mutex);
 
        for (dbh_ptr = sql_manager.handle_pool; dbh_ptr; dbh_ptr = dbh_ptr->next) {
@@ -155,14 +155,14 @@ static switch_cache_db_handle_t *get_handle(const char *db_str, const char *user
 
        if (!r) {
                for (dbh_ptr = sql_manager.handle_pool; dbh_ptr; dbh_ptr = dbh_ptr->next) {
-                       if (dbh_ptr->hash == hash && (dbh_ptr->type != SCDB_TYPE_PGSQL || !dbh_ptr->use_count) && !switch_test_flag(dbh_ptr, CDF_PRUNE) && 
+                       if (dbh_ptr->hash == hash && (dbh_ptr->type != SCDB_TYPE_PGSQL || !dbh_ptr->use_count) && !switch_test_flag(dbh_ptr, CDF_PRUNE) &&
                                switch_mutex_trylock(dbh_ptr->mutex) == SWITCH_STATUS_SUCCESS) {
                                r = dbh_ptr;
                                break;
                        }
-               }       
+               }
        }
-       
+
        if (r) {
                r->use_count++;
                r->total_used_count++;
@@ -175,7 +175,7 @@ static switch_cache_db_handle_t *get_handle(const char *db_str, const char *user
        switch_mutex_unlock(sql_manager.dbh_mutex);
 
        return r;
-       
+
 }
 
 /*!
@@ -185,7 +185,7 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t
 {
        switch_status_t r;
        char *dsn;
-       
+
        if (!sql_manager.manage) {
                return SWITCH_STATUS_FALSE;
        }
@@ -201,7 +201,7 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t
        if ((r = _switch_cache_db_get_db_handle_dsn(dbh, dsn, file, func, line)) != SWITCH_STATUS_SUCCESS) {
                *dbh = NULL;
        }
-       
+
        return r;
 }
 
@@ -260,7 +260,7 @@ static void sql_close(time_t prune)
                } else {
                        if (!prune) {
                                if (!sanity) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SANITY CHECK FAILED!  Handle %s (%s;%s) was not properly released.\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SANITY CHECK FAILED!  Handle %s (%s;%s) was not properly released.\n",
                                                                          dbh->name, dbh->creator, dbh->last_user);
                                } else {
                                        locked++;
@@ -268,7 +268,7 @@ static void sql_close(time_t prune)
                        }
                        continue;
                }
-               
+
        }
 
        if (locked) {
@@ -312,7 +312,7 @@ SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t
                (*dbh)->last_used = switch_epoch_time_now(NULL);
 
                (*dbh)->io_mutex = NULL;
-               
+
                if ((*dbh)->use_count) {
                        if (--(*dbh)->use_count == 0) {
                                (*dbh)->thread_hash = 1;
@@ -332,7 +332,7 @@ SWITCH_DECLARE(void) switch_cache_db_dismiss_db_handle(switch_cache_db_handle_t
 }
 
 
-SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_db_handle_t **dbh, const char *dsn, 
+SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_db_handle_t **dbh, const char *dsn,
                                                                                                                                   const char *file, const char *func, int line)
 {
        switch_cache_db_connection_options_t connection_options = { {0} };
@@ -356,13 +356,13 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_
                } else {
                        switch_set_string(tmp, dsn+7);
                }
-               
+
                connection_options.odbc_options.dsn = tmp;
 
                if ((p = strchr(tmp, ':'))) {
                        *p++ = '\0';
                        connection_options.odbc_options.user = p;
-                       
+
                        if ((p = strchr(connection_options.odbc_options.user, ':'))) {
                                *p++ = '\0';
                                connection_options.odbc_options.pass = p;
@@ -401,13 +401,13 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
 
        while(runtime.max_db_handles && sql_manager.total_handles >= runtime.max_db_handles && sql_manager.total_used_handles >= sql_manager.total_handles) {
                if (!waiting++) {
-                       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING, "Max handles %u exceeded, blocking....\n", 
+                       switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING, "Max handles %u exceeded, blocking....\n",
                                                          runtime.max_db_handles);
                }
 
                switch_yield(yield_len);
                total_yield += yield_len;
-               
+
                if (runtime.db_handle_timeout && total_yield > runtime.db_handle_timeout) {
                        switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Error connecting\n");
                        *dbh = NULL;
@@ -451,7 +451,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
                snprintf(db_str, sizeof(db_str) - 1, "db=\"%s\",type=\"%s\"", db_name, db_type);
        }
        snprintf(db_callsite_str, sizeof(db_callsite_str) - 1, "%s:%d", file, line);
-       snprintf(thread_str, sizeof(thread_str) - 1, "thread=\"%lu\"",  (unsigned long) (intptr_t) self); 
+       snprintf(thread_str, sizeof(thread_str) - 1, "thread=\"%lu\"",  (unsigned long) (intptr_t) self);
 
        if ((new_dbh = get_handle(db_str, db_callsite_str, thread_str))) {
                switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG10,
@@ -530,7 +530,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
        if (new_dbh) {
                new_dbh->last_used = switch_epoch_time_now(NULL);
        }
-       
+
        *dbh = new_dbh;
 
        return *dbh ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
@@ -544,7 +544,7 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t
        char *tmp = NULL;
        char *type = NULL;
        switch_mutex_t *io_mutex = dbh->io_mutex;
-       
+
        if (io_mutex) switch_mutex_lock(io_mutex);
 
        if (err) {
@@ -816,7 +816,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_
                switch_cache_db_execute_sql_real(dbh, sql, &errmsg);
                if (io_mutex) switch_mutex_unlock(io_mutex);
 
-               
+
                if (errmsg) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR [%s]\n", errmsg);
                        switch_safe_free(errmsg);
@@ -831,12 +831,12 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_
                        break;
                }
        }
-       
+
        return status;
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans_full(switch_cache_db_handle_t *dbh, 
+SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans_full(switch_cache_db_handle_t *dbh,
                                                                                                                                                          char *sql, uint32_t retries,
                                                                                                                                                          const char *pre_trans_execute,
                                                                                                                                                          const char *post_trans_execute,
@@ -879,7 +879,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans_full(sw
                case SCDB_TYPE_ODBC:
                        {
                                switch_odbc_status_t result;
-                               
+
                                if ((result = switch_odbc_SQLSetAutoCommitAttr(dbh->native_handle.odbc_dbh, 0)) != SWITCH_ODBC_SUCCESS) {
                                        char tmp[100];
                                        switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to Set AutoCommit Off", result);
@@ -890,7 +890,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans_full(sw
                case SCDB_TYPE_PGSQL:
                        {
                                switch_pgsql_status_t result;
-                               
+
                                if ((result = switch_pgsql_SQLSetAutoCommitAttr(dbh->native_handle.pgsql_dbh, 0)) != SWITCH_PGSQL_SUCCESS) {
                                        char tmp[100];
                                        switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to Set AutoCommit Off", result);
@@ -933,7 +933,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans_full(sw
 
                                goto again;
                        }
-                       
+
                        switch_yield(100000);
 
                        if (begin_retries == 0) {
@@ -1035,7 +1035,7 @@ static int helper_callback(void *pArg, int argc, char **argv, char **columnNames
        r = h->callback(h->pdata, event);
 
        switch_event_destroy(&event);
-       
+
        return r;
 }
 
@@ -1056,7 +1056,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback(switc
 
        h.callback = callback;
        h.pdata = pdata;
-       
+
        switch (dbh->type) {
        case SCDB_TYPE_PGSQL:
                {
@@ -1111,7 +1111,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback_err(s
 
        h.callback = callback;
        h.pdata = pdata;
-       
+
        switch (dbh->type) {
        case SCDB_TYPE_PGSQL:
                {
@@ -1384,7 +1384,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_db_thread(switch_thread_t *threa
 
        while (sql_manager.db_thread_running == 1) {
                if (++sec == SQL_CACHE_TIMEOUT) {
-                       sql_close(switch_epoch_time_now(NULL));         
+                       sql_close(switch_epoch_time_now(NULL));
                        sec = 0;
                }
 
@@ -1432,7 +1432,7 @@ static int qm_wake(switch_sql_queue_manager_t *qm)
        int tries = 0;
 
  top:
-       
+
        status = switch_mutex_trylock(qm->cond_mutex);
 
        if (status == SWITCH_STATUS_SUCCESS) {
@@ -1504,9 +1504,9 @@ static void *SWITCH_THREAD_FUNC sql_in_thread (switch_thread_t *thread, void *ob
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", job->sql, err);
                switch_safe_free(err);
        }
-       
+
        switch_cache_db_release_db_handle(&dbh);
-       
+
        if (pool) {
                switch_core_destroy_memory_pool(&pool);
        }
@@ -1517,8 +1517,8 @@ static void *SWITCH_THREAD_FUNC sql_in_thread (switch_thread_t *thread, void *ob
 static switch_thread_data_t *new_job(switch_sql_queue_manager_t *qm, const char *sql,
                                                                         switch_core_db_callback_func_t callback,
                                                                         switch_core_db_err_callback_func_t err_callback,
-                                                                        switch_core_db_event_callback_func_t event_callback, 
-                                                                        switch_core_db_err_callback_func_t event_err_callback, 
+                                                                        switch_core_db_event_callback_func_t event_callback,
+                                                                        switch_core_db_err_callback_func_t event_err_callback,
                                                                         void *pdata)
 {
        switch_memory_pool_t *pool;
@@ -1550,10 +1550,10 @@ static switch_thread_data_t *new_job(switch_sql_queue_manager_t *qm, const char
 }
 
 
-SWITCH_DECLARE(void) switch_sql_queue_manager_execute_sql_callback(switch_sql_queue_manager_t *qm, 
+SWITCH_DECLARE(void) switch_sql_queue_manager_execute_sql_callback(switch_sql_queue_manager_t *qm,
                                                                                                                                   const char *sql, switch_core_db_callback_func_t callback, void *pdata)
 {
-       
+
        switch_thread_data_t *td;
        if ((td = new_job(qm, sql, callback, NULL, NULL, NULL, pdata))) {
                switch_thread_pool_launch_thread(&td);
@@ -1564,17 +1564,17 @@ SWITCH_DECLARE(void) switch_sql_queue_manager_execute_sql_callback_err(switch_sq
                                                                                                                                           switch_core_db_callback_func_t callback,
                                                                                                                                           switch_core_db_err_callback_func_t err_callback, void *pdata)
 {
-       
+
        switch_thread_data_t *td;
        if ((td = new_job(qm, sql, callback, err_callback, NULL, NULL, pdata))) {
                switch_thread_pool_launch_thread(&td);
        }
 }
 
-SWITCH_DECLARE(void) switch_sql_queue_manager_execute_sql_event_callback(switch_sql_queue_manager_t *qm, 
+SWITCH_DECLARE(void) switch_sql_queue_manager_execute_sql_event_callback(switch_sql_queue_manager_t *qm,
                                                                                                                                                 const char *sql, switch_core_db_event_callback_func_t callback, void *pdata)
 {
-       
+
        switch_thread_data_t *td;
        if ((td = new_job(qm, sql, NULL, NULL, callback, NULL, pdata))) {
                switch_thread_pool_launch_thread(&td);
@@ -1586,7 +1586,7 @@ SWITCH_DECLARE(void) switch_sql_queue_manager_execute_sql_event_callback_err(swi
                                                                                                                                                         switch_core_db_err_callback_func_t err_callback,
                                                                                                                                                         void *pdata)
 {
-       
+
        switch_thread_data_t *td;
        if ((td = new_job(qm, sql, NULL, NULL, callback, err_callback, pdata))) {
                switch_thread_pool_launch_thread(&td);
@@ -1768,7 +1768,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push(switch_sql_queue_m
                        }
                }
        } while(status != SWITCH_STATUS_SUCCESS);
-       
+
        qm_wake(qm);
 
        return SWITCH_STATUS_SUCCESS;
@@ -1789,7 +1789,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
        }
 
        if (switch_cache_db_get_db_handle_dsn(&dbh, qm->dsn) == SWITCH_STATUS_SUCCESS) {
-               switch_cache_db_execute_sql(dbh, (char *)sql, NULL);            
+               switch_cache_db_execute_sql(dbh, (char *)sql, NULL);
                switch_cache_db_release_db_handle(&dbh);
        }
 
@@ -1850,7 +1850,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
 
 
 SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_init_name(const char *name,
-                                                                                                                                  switch_sql_queue_manager_t **qmp, 
+                                                                                                                                  switch_sql_queue_manager_t **qmp,
                                                                                                                                   uint32_t numq, const char *dsn, uint32_t max_trans,
                                                                                                                                   const char *pre_trans_execute,
                                                                                                                                   const char *post_trans_execute,
@@ -1876,7 +1876,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_init_name(const char *n
        switch_mutex_init(&qm->cond2_mutex, SWITCH_MUTEX_NESTED, qm->pool);
        switch_mutex_init(&qm->mutex, SWITCH_MUTEX_NESTED, qm->pool);
        switch_thread_cond_create(&qm->cond, qm->pool);
-       
+
        qm->sql_queue = switch_core_alloc(qm->pool, sizeof(switch_queue_t *) * numq);
        qm->written = switch_core_alloc(qm->pool, sizeof(uint32_t) * numq);
        qm->pre_written = switch_core_alloc(qm->pool, sizeof(uint32_t) * numq);
@@ -1932,7 +1932,7 @@ static uint32_t do_trans(switch_sql_queue_manager_t *qm)
        case SCDB_TYPE_ODBC:
                {
                        switch_odbc_status_t result;
-                       
+
                        if ((result = switch_odbc_SQLSetAutoCommitAttr(qm->event_db->native_handle.odbc_dbh, 0)) != SWITCH_ODBC_SUCCESS) {
                                char tmp[100];
                                switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to Set AutoCommit Off", result);
@@ -1943,7 +1943,7 @@ static uint32_t do_trans(switch_sql_queue_manager_t *qm)
        case SCDB_TYPE_PGSQL:
                {
                        switch_pgsql_status_t result;
-                       
+
                        if ((result = switch_pgsql_SQLSetAutoCommitAttr(qm->event_db->native_handle.pgsql_dbh, 0)) != SWITCH_PGSQL_SUCCESS) {
                                char tmp[100];
                                switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to Set AutoCommit Off", result);
@@ -2106,26 +2106,26 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
                        if (!qm_ttl(qm)) {
                                goto check;
                        }
-                       written = do_trans(qm);                 
+                       written = do_trans(qm);
                        iterations += written;
                } while(written == qm->max_trans);
-               
+
                if (switch_test_flag((&runtime), SCF_DEBUG_SQL)) {
                        char line[128] = "";
                        switch_size_t l;
-                       
+
                        switch_snprintf(line, sizeof(line), "%s RUN QUEUE [", qm->name);
-                       
+
                        for (i = 0; i < qm->numq; i++) {
                                l = strlen(line);
                                switch_snprintf(line + l, sizeof(line) - l, "%d%s", switch_queue_size(qm->sql_queue[i]), i == qm->numq - 1 ? "" : "|");
                        }
-                       
+
                        l = strlen(line);
                        switch_snprintf(line + l, sizeof(line) - l, "]--[%d]\n", iterations);
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s", line);
-                       
+
                }
 
        check:
@@ -2154,7 +2154,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
        switch_cache_db_release_db_handle(&qm->event_db);
 
        qm->thread_running = 0;
-       
+
        return NULL;
 }
 
@@ -2175,7 +2175,7 @@ static char *parse_presence_data_cols(switch_event_t *event)
        }
 
        data_copy = strdup(data);
-       
+
        col_count = switch_split(data_copy, ':', cols);
 
        SWITCH_STANDARD_STREAM(stream);
@@ -2199,9 +2199,9 @@ static char *parse_presence_data_cols(switch_event_t *event)
        }
 
        switch_safe_free(data_copy);
-       
+
        return r;
-       
+
 }
 
 
@@ -2288,7 +2288,7 @@ static void core_event_handler(switch_event_t *event)
        case SWITCH_EVENT_CHANNEL_DESTROY:
                {
                        const char *uuid = switch_event_get_header(event, "unique-id");
-                       
+
                        if (uuid) {
                                new_sql() = switch_mprintf("delete from channels where uuid='%q'",
                                                                                   uuid);
@@ -2349,7 +2349,7 @@ static void core_event_handler(switch_event_t *event)
        case SWITCH_EVENT_CHANNEL_HOLD:
        case SWITCH_EVENT_CHANNEL_UNHOLD:
        case SWITCH_EVENT_CHANNEL_EXECUTE: {
-               
+
                new_sql() = switch_mprintf("update channels set application='%q',application_data='%q',"
                                                                   "presence_id='%q',presence_data='%q',accountcode='%q' where uuid='%q'",
                                                                   switch_event_get_header_nil(event, "application"),
@@ -2460,7 +2460,7 @@ static void core_event_handler(switch_event_t *event)
                                                                                           extra_cols,
                                                                                           switch_event_get_header_nil(event, "unique-id"));
                                        free(extra_cols);
-                                       
+
                                } else {
                                        new_sql() = switch_mprintf("update channels set state='%q' where uuid='%q'",
                                                                                           switch_event_get_header_nil(event, "channel-state"),
@@ -2539,11 +2539,11 @@ static void core_event_handler(switch_event_t *event)
                        if (uuid && (extra_cols = parse_presence_data_cols(event))) {
                                new_sql() = switch_mprintf("update channels set %s where uuid='%q'", extra_cols, uuid);
                                switch_safe_free(extra_cols);
-                       } 
+                       }
 
                        new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%q' or uuid='%q'",
                                                                           switch_event_get_header_nil(event, "channel-call-uuid"), a_uuid, b_uuid);
-                       
+
 
                        new_sql() = switch_mprintf("insert into calls (call_uuid,call_created,call_created_epoch,"
                                                                           "caller_uuid,callee_uuid,hostname) "
@@ -2565,11 +2565,11 @@ static void core_event_handler(switch_event_t *event)
                        if (uuid && (extra_cols = parse_presence_data_cols(event))) {
                                new_sql() = switch_mprintf("update channels set %s where uuid='%q'", extra_cols, uuid);
                                switch_safe_free(extra_cols);
-                       } 
+                       }
 
                        new_sql() = switch_mprintf("update channels set call_uuid=uuid where call_uuid='%q'",
                                                                           switch_event_get_header_nil(event, "channel-call-uuid"));
-                       
+
                        new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q')",
                                                                           cuuid, cuuid);
                        break;
@@ -2651,7 +2651,7 @@ static void core_event_handler(switch_event_t *event)
 
        if (sql_idx) {
                int i = 0;
-               
+
 
                for (i = 0; i < sql_idx; i++) {
                        if (switch_stristr("update channels", sql[i]) || switch_stristr("delete from channels", sql[i])) {
@@ -2786,7 +2786,7 @@ static char create_registrations_sql[] =
        "   metadata VARCHAR(256)\n"
        ");\n";
 
-       
+
 
 
 static char detailed_calls_sql[] =
@@ -2908,7 +2908,7 @@ static char basic_calls_sql[] =
        "b.cid_num as b_cid_num,"
        "b.ip_addr as b_ip_addr,"
        "b.dest as b_dest,"
-       
+
        "b.presence_id as b_presence_id,"
        "b.presence_data as b_presence_data,"
        "b.accountcode as b_accountcode,"
@@ -2957,7 +2957,7 @@ SWITCH_DECLARE(void) switch_core_recovery_flush(const char *technology, const ch
                switch_cache_db_execute_sql(dbh, sql, NULL);
                switch_safe_free(sql);
        }
-       
+
        switch_cache_db_release_db_handle(&dbh);
 }
 
@@ -2972,7 +2972,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
        if (argc < 4) {
                return 0;
        }
-       
+
        if (!(xml = switch_xml_parse_str_dynamic(argv[4], SWITCH_TRUE))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XML ERROR\n");
                return 0;
@@ -2997,7 +2997,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
                        const char *cbname;
 
                        switch_channel_set_flag(session->channel, CF_RECOVERING);
-                       
+
 
                        if (switch_channel_get_partner_uuid(channel)) {
                                switch_channel_set_flag(channel, CF_RECOVERING_BRIDGE);
@@ -3007,15 +3007,15 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
 
                        if ((cbname = switch_channel_get_variable(channel, "secondary_recovery_module"))) {
                                switch_core_recover_callback_t recover_callback;
-                               
+
                                if ((recover_callback = switch_core_get_secondary_recover_callback(cbname))) {
                                        r = recover_callback(session);
                                }
                        }
-                       
-                       
+
+
                }
-               
+
                if (r > 0) {
 
                        if (!switch_channel_test_flag(channel, CF_RECOVERING_BRIDGE)) {
@@ -3039,12 +3039,12 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
                        }
 
                        switch_channel_set_state(channel, CS_INIT);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE,
                                                          "Resurrecting fallen channel %s\n", switch_channel_get_name(channel));
                        switch_core_session_thread_launch(session);
 
                        *rp = (*rp) + 1;
-                       
+
                }
 
        } else {
@@ -3062,7 +3062,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
 }
 
 SWITCH_DECLARE(int) switch_core_recovery_recover(const char *technology, const char *profile_name)
-                                                                                                 
+
 {
        char *sql = NULL;
        char *errmsg = NULL;
@@ -3080,14 +3080,14 @@ SWITCH_DECLARE(int) switch_core_recovery_recover(const char *technology, const c
        }
 
        if (zstr(technology)) {
-               
+
                if (zstr(profile_name)) {
                        sql = switch_mprintf("select technology, profile_name, hostname, uuid, metadata "
-                                                                "from recovery where runtime_uuid!='%q'", 
+                                                                "from recovery where runtime_uuid!='%q'",
                                                                 switch_core_get_uuid());
                } else {
                        sql = switch_mprintf("select technology, profile_name, hostname, uuid, metadata "
-                                                                "from recovery where runtime_uuid!='%q' and profile_name='%q'", 
+                                                                "from recovery where runtime_uuid!='%q' and profile_name='%q'",
                                                                 switch_core_get_uuid(), profile_name);
                }
 
@@ -3095,18 +3095,18 @@ SWITCH_DECLARE(int) switch_core_recovery_recover(const char *technology, const c
 
                if (zstr(profile_name)) {
                        sql = switch_mprintf("select technology, profile_name, hostname, uuid, metadata "
-                                                                "from recovery where technology='%q' and runtime_uuid!='%q'", 
+                                                                "from recovery where technology='%q' and runtime_uuid!='%q'",
                                                                 technology, switch_core_get_uuid());
                } else {
                        sql = switch_mprintf("select technology, profile_name, hostname, uuid, metadata "
-                                                                "from recovery where technology='%q' and runtime_uuid!='%q' and profile_name='%q'", 
+                                                                "from recovery where technology='%q' and runtime_uuid!='%q' and profile_name='%q'",
                                                                 technology, switch_core_get_uuid(), profile_name);
                }
        }
 
 
        switch_cache_db_execute_sql_callback(dbh, sql, recover_callback, &r, &errmsg);
-       
+
        if (errmsg) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg);
                switch_safe_free(errmsg);
@@ -3116,18 +3116,18 @@ SWITCH_DECLARE(int) switch_core_recovery_recover(const char *technology, const c
 
        if (zstr(technology)) {
                if (zstr(profile_name)) {
-                       sql = switch_mprintf("delete from recovery where runtime_uuid!='%q'", 
+                       sql = switch_mprintf("delete from recovery where runtime_uuid!='%q'",
                                                                 switch_core_get_uuid());
                } else {
-                       sql = switch_mprintf("delete from recovery where runtime_uuid!='%q' and profile_name='%q'", 
+                       sql = switch_mprintf("delete from recovery where runtime_uuid!='%q' and profile_name='%q'",
                                                                 switch_core_get_uuid(), profile_name);
                }
        } else {
                if (zstr(profile_name)) {
-                       sql = switch_mprintf("delete from recovery where runtime_uuid!='%q' and technology='%q' ", 
+                       sql = switch_mprintf("delete from recovery where runtime_uuid!='%q' and technology='%q' ",
                                                                 switch_core_get_uuid(), technology);
                } else {
-                       sql = switch_mprintf("delete from recovery where runtime_uuid!='%q' and technology='%q' and profile_name='%q'", 
+                       sql = switch_mprintf("delete from recovery where runtime_uuid!='%q' and technology='%q' and profile_name='%q'",
                                                                 switch_core_get_uuid(), technology, profile_name);
                }
        }
@@ -3193,17 +3193,17 @@ SWITCH_DECLARE(void) switch_core_recovery_untrack(switch_core_session_t *session
 
                if (force) {
                        sql = switch_mprintf("delete from recovery where uuid='%q'", switch_core_session_get_uuid(session));
-                       
+
                } else {
                        sql = switch_mprintf("delete from recovery where runtime_uuid='%q' and uuid='%q'",
                                                                 switch_core_get_uuid(), switch_core_session_get_uuid(session));
                }
 
                switch_sql_queue_manager_push(sql_manager.qm, sql, 3, SWITCH_FALSE);
-               
+
                switch_channel_clear_flag(channel, CF_TRACKED);
        }
-       
+
 }
 
 SWITCH_DECLARE(void) switch_core_recovery_track(switch_core_session_t *session)
@@ -3241,7 +3241,7 @@ SWITCH_DECLARE(void) switch_core_recovery_track(switch_core_session_t *session)
                } else {
                        sql = switch_mprintf("insert into recovery (runtime_uuid, technology, profile_name, hostname, uuid, metadata) "
                                                                 "values ('%q','%q','%q','%q','%q','%q')",
-                                                                switch_core_get_uuid(), switch_str_nil(technology), 
+                                                                switch_core_get_uuid(), switch_str_nil(technology),
                                                                 switch_str_nil(profile_name), switch_core_get_switchname(), switch_core_session_get_uuid(session), xml_cdr_text);
                }
 
@@ -3249,14 +3249,14 @@ SWITCH_DECLARE(void) switch_core_recovery_track(switch_core_session_t *session)
 
                switch_safe_free(xml_cdr_text);
                switch_channel_set_flag(channel, CF_TRACKED);
-               
+
        }
-       
+
 }
 
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires, 
+SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires,
                                                                                                                         const char *network_ip, const char *network_port, const char *network_proto,
                                                                                                                         const char *metadata)
 {
@@ -3267,10 +3267,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c
        }
 
        if (runtime.multiple_registrations) {
-               sql = switch_mprintf("delete from registrations where hostname='%q' and (url='%q' or token='%q')", 
+               sql = switch_mprintf("delete from registrations where hostname='%q' and (url='%q' or token='%q')",
                                                         switch_core_get_switchname(), url, switch_str_nil(token));
        } else {
-               sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'", 
+               sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'",
                                                         user, realm, switch_core_get_switchname());
        }
 
@@ -3305,9 +3305,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c
                                                         );
        }
 
-       
+
        switch_sql_queue_manager_push(sql_manager.qm, sql, 0, SWITCH_FALSE);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -3334,7 +3334,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c
 
 SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force)
 {
-       
+
        char *sql;
        time_t now;
 
@@ -3369,7 +3369,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
 
        if (!sql_manager.manage) goto skip;
 
- top:  
+ top:
 
        /* Activate SQL database */
        if (switch_core_db_handle(&sql_manager.dbh) != SWITCH_STATUS_SUCCESS) {
@@ -3430,7 +3430,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
        switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from aliases", "DROP TABLE aliases", create_alias_sql);
        switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from complete", "DROP TABLE complete", create_complete_sql);
        switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from nat", "DROP TABLE nat", create_nat_sql);
-       switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user=''", 
+       switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user=''",
                                                                  "DROP TABLE registrations", create_registrations_sql);
 
        switch_cache_db_test_reactive(sql_manager.dbh, "select metadata from registrations", NULL, "ALTER TABLE registrations ADD COLUMN metadata VARCHAR(256)");
@@ -3457,11 +3457,11 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
                        switch_cache_db_test_reactive(sql_manager.dbh, "select * from basic_calls where sent_callee_name=''", "DROP VIEW basic_calls", basic_calls_sql);
                        switch_cache_db_test_reactive(sql_manager.dbh, "select * from detailed_calls where sent_callee_name=''", "DROP VIEW detailed_calls", detailed_calls_sql);
                        if (runtime.odbc_dbtype == DBTYPE_DEFAULT) {
-                               switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user=''", 
+                               switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user=''",
                                                                                          "DROP TABLE registrations", create_registrations_sql);
                        } else {
                                char *tmp = switch_string_replace(create_registrations_sql, "url      TEXT", "url      VARCHAR(max)");
-                               switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user=''", 
+                               switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user=''",
                                                                                          "DROP TABLE registrations", tmp);
                                free(tmp);
                        }
@@ -3479,7 +3479,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
                        case SCDB_TYPE_ODBC:
                                {
                                        switch_odbc_status_t result;
-                                       
+
                                        if ((result = switch_odbc_SQLSetAutoCommitAttr(sql_manager.dbh->native_handle.odbc_dbh, 0)) != SWITCH_ODBC_SUCCESS) {
                                                char tmp[100];
                                                switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to Set AutoCommit Off", result);
@@ -3490,7 +3490,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
                        case SCDB_TYPE_PGSQL:
                                {
                                        switch_pgsql_status_t result;
-                                       
+
                                        if ((result = switch_pgsql_SQLSetAutoCommitAttr(sql_manager.dbh->native_handle.pgsql_dbh, 0)) != SWITCH_PGSQL_SUCCESS) {
                                                char tmp[100];
                                                switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to Set AutoCommit Off", result);
@@ -3499,7 +3499,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
                                }
                                break;
                        }
-                       
+
                        switch_cache_db_execute_sql(sql_manager.dbh, "delete from channels where hostname=''", &err);
                        if (!err) {
                                switch_cache_db_execute_sql(sql_manager.dbh, "delete from channels where hostname=''", &err);
@@ -3534,12 +3534,12 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
                                }
                        }
 
-                       
+
                        if (err) {
                                //runtime.odbc_dsn = NULL;
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error [%s]\n", err);
                                //switch_cache_db_release_db_handle(&sql_manager.dbh);
-                               if (switch_stristr("read-only", err)) { 
+                               if (switch_stristr("read-only", err)) {
                                        switch_safe_free(err);
                                } else {
                                        switch_safe_free(err);
@@ -3632,7 +3632,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
                switch_event_bind("core_db", SWITCH_EVENT_CALL_SECURE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL);
                switch_event_bind("core_db", SWITCH_EVENT_NAT, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL);
                switch_event_bind("core_db", SWITCH_EVENT_CODEC, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL);
-#endif 
+#endif
 
                switch_threadattr_create(&thd_attr, sql_manager.memory_pool);
                switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -3674,7 +3674,7 @@ static void switch_core_sqldb_stop_thread(void)
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL is not enabled\n");
        }
-       
+
        switch_mutex_unlock(sql_manager.ctl_mutex);
 }
 
@@ -3782,11 +3782,11 @@ SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream)
                }
 
                count++;
-               
+
                if (dbh->use_count) {
                        used++;
                }
-               
+
                stream->write_function(stream, "%s\n\tType: %s\n\tLast used: %d\n\tTotal used: %ld\n\tFlags: %s, %s(%d)\n"
                                                           "\tCreator: %s\n\tLast User: %s\n",
                                                           cleankey_str,
index a9c3e2321635cbd31d505921d1a93632f19c8f8f..ca362844e03956f647e7ff50f3001295b003321e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
@@ -138,7 +138,7 @@ static void switch_core_standard_on_hangup(switch_core_session_t *session)
                switch_core_recovery_untrack(session, SWITCH_TRUE);
        }
 
-       
+
        if (!switch_channel_test_flag(session->channel, CF_ZOMBIE_EXEC)) {
                return;
        }
@@ -155,8 +155,8 @@ static void switch_core_standard_on_hangup(switch_core_session_t *session)
 
                status = switch_core_session_execute_application(session,
                                                                                                                 current_application->application_name, current_application->application_data);
-                                                                                                                
-               
+
+
                if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_IGNORE) {
                        return;
                }
@@ -236,7 +236,7 @@ static void switch_core_standard_on_routing(switch_core_session_t *session)
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard ROUTING\n", switch_channel_get_name(session->channel));
 
        switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session));
-               
+
        if ((switch_channel_test_flag(session->channel, CF_ANSWERED) ||
                 switch_channel_test_flag(session->channel, CF_EARLY_MEDIA) ||
                 switch_channel_test_flag(session->channel, CF_SIGNAL_BRIDGE_TTL)) && switch_channel_test_flag(session->channel, CF_PROXY_MODE)) {
@@ -339,7 +339,7 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
        switch_channel_clear_flag(session->channel, CF_RESET);
 
        switch_core_session_video_reset(session);
-       
+
        if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
                switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING);
                return;
@@ -362,13 +362,13 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
 
        }
 
-       if (switch_channel_ready(session->channel) && switch_channel_get_state(session->channel) == CS_EXECUTE && 
-               switch_channel_test_flag(session->channel, CF_CONFIRM_BLIND_TRANSFER) && 
+       if (switch_channel_ready(session->channel) && switch_channel_get_state(session->channel) == CS_EXECUTE &&
+               switch_channel_test_flag(session->channel, CF_CONFIRM_BLIND_TRANSFER) &&
                (uuid = switch_channel_get_variable(session->channel, "blind_transfer_uuid"))) {
                switch_core_session_t *other_session;
 
                if ((other_session = switch_core_session_locate(uuid))) {
-                       switch_core_session_message_t msg = { 0 };                      
+                       switch_core_session_message_t msg = { 0 };
                        msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE;
                        msg.from = __FILE__;
                        msg.numeric_arg = 0;
@@ -380,7 +380,7 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
                        switch_channel_clear_flag(session->channel, CF_CONFIRM_BLIND_TRANSFER);
                }
        }
-       
+
        if (switch_channel_ready(session->channel) && switch_channel_get_state(session->channel) == CS_EXECUTE) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s has executed the last dialplan instruction, hanging up.\n",
                                                  switch_channel_get_name(session->channel));
@@ -589,7 +589,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
                        if (session->endpoint_interface->io_routines->state_run) {
                                rstatus = session->endpoint_interface->io_routines->state_run(session);
                        }
-                       
+
                        if (rstatus == SWITCH_STATUS_SUCCESS) {
                                for (ptr = session->event_hooks.state_run; ptr; ptr = ptr->next) {
                                        if ((rstatus = ptr->state_run(session)) != SWITCH_STATUS_SUCCESS) {
@@ -625,7 +625,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
                                        switch_event_t *event;
 
                                        STATE_MACRO(init, "INIT");
-                                       
+
                                        if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_CREATE) == SWITCH_STATUS_SUCCESS) {
                                                switch_channel_event_set_data(session->channel, event);
                                                switch_event_fire(&event);
@@ -698,11 +698,11 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
                                        switch_channel_set_flag(session->channel, CF_THREAD_SLEEPING);
                                        if (switch_channel_get_state(session->channel) == switch_channel_get_running_state(session->channel)) {
                                                switch_ivr_parse_all_events(session);
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s session thread sleep state: %s!\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s session thread sleep state: %s!\n",
                                                                                  switch_channel_get_name(session->channel),
                                                                                  switch_channel_state_name(switch_channel_get_running_state(session->channel)));
                                                switch_thread_cond_wait(session->cond, session->mutex);
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s session thread wake state: %s!\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s session thread wake state: %s!\n",
                                                                                  switch_channel_get_name(session->channel),
                                                                                  switch_channel_state_name(switch_channel_get_running_state(session->channel)));
 
@@ -789,7 +789,7 @@ static void api_hook(switch_core_session_t *session, const char *hook_var, int u
                }
 
                switch_safe_free(cmd);
-               
+
                switch_safe_free(stream.data);
        }
 }
@@ -863,7 +863,7 @@ SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *ses
        }
 
        switch_channel_process_device_hangup(session->channel);
-       
+
        switch_set_flag(session, SSF_HANGUP);
 
 }
@@ -952,7 +952,7 @@ SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t *
                if (switch_true(switch_channel_get_variable(session->channel, "hangup_complete_with_xml"))) {
                        switch_xml_t cdr = NULL;
                        char *xml_cdr_text;
-                       
+
                        if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
                                xml_cdr_text = switch_xml_toxml(cdr, SWITCH_FALSE);
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CDR-Attached", "xml");
index 3ddfe79be0ca94149d017647affc73391f7c0dbc..b91639c97c28b56de7546771e381d124182f90fa 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
index effbdbb71555231815c2b05bc35eaa6a3a2a057a..7b227884a382e05890c5f94211d66aad105fb0dd 100644 (file)
@@ -110,14 +110,14 @@ SWITCH_DECLARE(switch_img_position_t) parse_img_position(const char *name)
        int i;
 
        switch_assert(name);
-       
+
        for(i = 0; POS_TABLE[i].name; i++) {
                if (!strcasecmp(POS_TABLE[i].name, name)) {
                        r = POS_TABLE[i].pos;
                        break;
                }
        }
-       
+
        return r;
 }
 
@@ -142,14 +142,14 @@ SWITCH_DECLARE(switch_img_fit_t) parse_img_fit(const char *name)
        int i;
 
        switch_assert(name);
-       
+
        for(i = 0; IMG_FIT_TABLE[i].name; i++) {
                if (!strcasecmp(IMG_FIT_TABLE[i].name, name)) {
                        r = IMG_FIT_TABLE[i].fit;
                        break;
                }
        }
-       
+
        return r;
 }
 
@@ -165,7 +165,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_has_video(void)
        return SWITCH_FALSE;
 #endif
 }
-                                                         
+
 SWITCH_DECLARE(switch_image_t *)switch_img_alloc(switch_image_t  *img,
                                                 switch_img_fmt_t fmt,
                                                 unsigned int d_w,
@@ -529,7 +529,7 @@ SWITCH_DECLARE(switch_image_t *) switch_img_copy_rect(switch_image_t *img, uint3
 
 static inline void switch_img_draw_pixel(switch_image_t *img, int x, int y, switch_rgb_color_t *color)
 {
-#ifdef SWITCH_HAVE_YUV 
+#ifdef SWITCH_HAVE_YUV
        switch_yuv_color_t yuv;
 
        if (x < 0 || y < 0 || x >= img->d_w || y >= img->d_h) return;
@@ -555,7 +555,7 @@ static inline void switch_img_draw_pixel(switch_image_t *img, int x, int y, swit
 
 SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color)
 {
-#ifdef SWITCH_HAVE_YUV 
+#ifdef SWITCH_HAVE_YUV
        int len, i, max_h;
        switch_yuv_color_t yuv_color;
 
@@ -613,7 +613,7 @@ static inline void switch_img_get_yuv_pixel(switch_image_t *img, switch_yuv_colo
 
 static inline void switch_img_get_rgb_pixel(switch_image_t *img, switch_rgb_color_t *rgb, int x, int y)
 {
-#ifdef SWITCH_HAVE_YUV         
+#ifdef SWITCH_HAVE_YUV
        if (x < 0 || y < 0 || x >= img->d_w || y >= img->d_h) return;
 
        if (img->fmt == SWITCH_IMG_FMT_I420) {
@@ -628,7 +628,7 @@ static inline void switch_img_get_rgb_pixel(switch_image_t *img, switch_rgb_colo
                rgb->g = *(++a);
                rgb->b = *(++a);
        }
-#endif 
+#endif
 }
 
 SWITCH_DECLARE(void) switch_img_overlay(switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t percent)
@@ -796,7 +796,7 @@ SWITCH_DECLARE(void) switch_color_set_yuv(switch_yuv_color_t *color, const char
 
        switch_color_set_rgb(&rgb, str);
        switch_color_rgb2yuv(&rgb, color);
-#endif 
+#endif
 }
 
 #if SWITCH_HAVE_FREETYPE
@@ -903,11 +903,11 @@ SWITCH_DECLARE(void) switch_img_txt_handle_destroy(switch_img_txt_handle_t **han
        switch_memory_pool_t *pool;
 
        switch_assert(handleP);
-       
+
        old_handle = *handleP;
        *handleP = NULL;
        if (!old_handle) return;
-       
+
 
 #if SWITCH_HAVE_FREETYPE
        if (old_handle->library) {
@@ -997,7 +997,7 @@ static void draw_bitmap(switch_img_txt_handle_t *handle, switch_image_t *img, FT
 
 SWITCH_DECLARE(uint32_t) switch_img_txt_handle_render(switch_img_txt_handle_t *handle, switch_image_t *img,
                                                                                                                         int x, int y, const char *text,
-                                                                                                                        const char *font_family, const char *font_color, 
+                                                                                                                        const char *font_family, const char *font_color,
                                                                                                                         const char *bgcolor, uint16_t font_size, double angle)
 {
 #if SWITCH_HAVE_FREETYPE
@@ -1091,7 +1091,7 @@ SWITCH_DECLARE(uint32_t) switch_img_txt_handle_render(switch_img_txt_handle_t *h
                if (error) continue;
 
                this_x = pen.x + slot->bitmap_left;
-               
+
                if (img) {
                        /* now, draw to our target surface (convert position) */
                        draw_bitmap(handle, img, &slot->bitmap, this_x, pen.y - slot->bitmap_top + font_size);
@@ -1142,7 +1142,7 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
 
        if (strchr(text, ':')) {
                argc = switch_split(duptxt, ':', argv);
-               
+
                if (argc > 0 && !zstr(argv[0])) {
                        fg = argv[0];
                }
@@ -1150,11 +1150,11 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
                if (argc > 1 && !zstr(argv[1])) {
                        bg = argv[1];
                }
-               
+
                if (argc > 2 && !zstr(argv[2])) {
                        font_face = argv[2];
                }
-               
+
                if (argc > 3 && !zstr(argv[3])) {
                        fontsz = argv[3];
                }
@@ -1163,7 +1163,7 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
                        txt = argv[4];
                }
        } else txt = duptxt;
-       
+
        if (!txt) txt = duptxt;
 
        if (strrchr(fontsz, '%')) {
@@ -1174,7 +1174,7 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
 
        while (*txt == ' ') txt++;
        while (end_of(txt) == ' ') end_of(txt) = '\0';
-       
+
        len = strlen(txt);
 
        if (len < 5) len = 5;
@@ -1187,9 +1187,9 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
                                                                                         NULL,
                                                                                         font_size / 2, font_size / 2,
                                                                                         txt, NULL, fg, bg, 0, 0);
-       
+
        height = font_size * 2;
-       
+
        if (full && w > width) {
                width = w;
        } else {
@@ -1887,7 +1887,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_letterbox(switch_image_t *img, switch
        int y_pos = 0;
        switch_image_t *IMG = NULL, *scale_img = NULL;
        switch_rgb_color_t bgcolor = { 0 };
-       
+
        switch_assert(imgP);
        *imgP = NULL;
 
@@ -1905,7 +1905,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_letterbox(switch_image_t *img, switch
 
        screen_aspect = (double) IMG->d_w / IMG->d_h;
        img_aspect = (double) img->d_w / img->d_h;
-       
+
 
        if (screen_aspect > img_aspect) {
                img_w = img_aspect * IMG->d_h;
@@ -1914,7 +1914,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_letterbox(switch_image_t *img, switch
                img_h = IMG->d_w / img_aspect;
                y_pos = (IMG->d_h - img_h) / 2;
        }
-       
+
        switch_img_scale(img, &scale_img, img_w, img_h);
        switch_img_patch(IMG, scale_img, x_pos, y_pos);
        switch_img_free(&scale_img);
@@ -1947,7 +1947,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width,
 
        new_w = src->d_w;
        new_h = src->d_h;
-       
+
        if (src->d_w < width && src->d_h < height) {
                float rw = (float)new_w / width;
                float rh = (float)new_h / height;
@@ -1960,7 +1960,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width,
                        new_h = height;
                }
        } else {
-               while(new_w > width || new_h > height) { 
+               while(new_w > width || new_h > height) {
                        if (new_w > width) {
                                double m = (double) width / new_w;
                                new_w = width;
@@ -2150,7 +2150,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_ima
        if (destP) {
                *destP = dest;
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 #else
        return SWITCH_STATUS_FALSE;
@@ -2193,7 +2193,7 @@ SWITCH_DECLARE(void) switch_img_find_position(switch_img_position_t pos, int sw,
                *xP = (sw - iw);
                *yP = (sh - ih) / 2;
                break;
-       case POS_RIGHT_BOT:     
+       case POS_RIGHT_BOT:
                *xP = (sw - iw);
                *yP = (sh - ih);
                break;
index 648c70c81b1a77a61337b3b9592c83536c1323ef..9cf2df36146e95e89c69dd1133c3f27678b1b942 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -41,7 +41,7 @@ static void event_handler(switch_event_t *event)
 {
        EventConsumer *E = (EventConsumer *) event->bind_user_data;
        switch_event_t *dup;
-       
+
        switch_event_dup(&dup, event);
 
        if (switch_queue_trypush(E->events, dup) != SWITCH_STATUS_SUCCESS) {
@@ -54,11 +54,11 @@ static void event_handler(switch_event_t *event)
 SWITCH_DECLARE_CONSTRUCTOR EventConsumer::EventConsumer(const char *event_name, const char *subclass_name, int len)
 {
 
-       switch_core_new_memory_pool(&pool);     
+       switch_core_new_memory_pool(&pool);
        switch_queue_create(&events, len, pool);
        node_index = 0;
        ready = 1;
-       
+
        if (!zstr(event_name)) {
                bind(event_name, subclass_name);
        }
@@ -80,8 +80,8 @@ SWITCH_DECLARE(int) EventConsumer::bind(const char *event_name, const char *subc
        if (zstr(subclass_name)) {
                subclass_name = NULL;
        }
-       
-       if (node_index <= SWITCH_EVENT_ALL && 
+
+       if (node_index <= SWITCH_EVENT_ALL &&
                switch_event_bind_removable(__FILE__, event_id, subclass_name, event_handler, this, &enodes[node_index]) == SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "bound to %s %s\n", event_name, switch_str_nil(subclass_name));
                node_index++;
@@ -102,7 +102,7 @@ SWITCH_DECLARE(Event *) EventConsumer::pop(int block, int timeout)
        if (!ready) {
                return NULL;
        }
-       
+
        if (block) {
                if (timeout > 0) {
                        switch_queue_pop_timeout(events, &pop, (switch_interval_time_t) timeout * 1000); // millisec rather than microsec
@@ -128,7 +128,7 @@ SWITCH_DECLARE(void) EventConsumer::cleanup()
 
        if (!ready) {
                return;
-       }       
+       }
 
        ready = 0;
 
@@ -183,13 +183,13 @@ SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main,
                name = "no name";
        }
 
-       switch_ivr_menu_init(&menu, main ? main->menu : NULL, name, greeting_sound, short_greeting_sound, invalid_sound, 
+       switch_ivr_menu_init(&menu, main ? main->menu : NULL, name, greeting_sound, short_greeting_sound, invalid_sound,
                                                 exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout,
                                                 digit_len, timeout, max_failures, max_timeouts, pool);
-       
+
 
 }
-                                                                                       
+
 SWITCH_DECLARE_CONSTRUCTOR IVRMenu::~IVRMenu()
 {
        if (menu) {
@@ -203,7 +203,7 @@ SWITCH_DECLARE(void) IVRMenu::bindAction(char *action, const char *arg, const ch
        switch_ivr_action_t ivr_action = SWITCH_IVR_ACTION_NOOP;
 
        this_check_void();
-       
+
        if (switch_ivr_menu_str2action(action, &ivr_action) == SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bind %s to %s(%s)\n", bind, action, arg);
                switch_ivr_menu_bind_action(menu, ivr_action, arg, bind);
@@ -298,7 +298,7 @@ SWITCH_DECLARE_CONSTRUCTOR Event::Event(const char *type, const char *subclass_n
         if (switch_event_create_json(&event, subclass_name) != SWITCH_STATUS_SUCCESS) {
                        return;
                }
-               
+
                event_id = event->event_id;
 
     } else {
@@ -360,7 +360,7 @@ SWITCH_DECLARE(const char *)Event::serialize(const char *format)
 
 
        switch_safe_free(serialized_string);
-       
+
        if (!event) {
                return "";
        }
@@ -385,7 +385,7 @@ SWITCH_DECLARE(const char *)Event::serialize(const char *format)
                        return serialized_string;
                }
        }
-       
+
        return "";
 
 }
@@ -489,13 +489,13 @@ SWITCH_DECLARE(bool) Event::addBody(const char *value)
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Trying to addBody an event that does not exist!\n");
        }
-       
+
        return false;
 }
 
 SWITCH_DECLARE(char *)Event::getBody(void)
 {
-       
+
        this_check((char *)"");
 
        if (event) {
@@ -503,7 +503,7 @@ SWITCH_DECLARE(char *)Event::getBody(void)
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Trying to getBody an event that does not exist!\n");
        }
-       
+
        return NULL;
 }
 
@@ -516,7 +516,7 @@ SWITCH_DECLARE(const char *)Event::getType(void)
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Trying to getType an event that does not exist!\n");
        }
-       
+
        return (char *) "invalid";
 }
 
@@ -534,7 +534,7 @@ SWITCH_DECLARE_CONSTRUCTOR DTMF::DTMF(char idigit, uint32_t iduration)
 
 SWITCH_DECLARE_CONSTRUCTOR DTMF::~DTMF()
 {
-       
+
 }
 
 
@@ -619,7 +619,7 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid, CoreSession *a_
                allocated = 1;
     } else {
                cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
-               if (switch_ivr_originate(a_leg ? a_leg->session : NULL, &session, &cause, nuuid, 60, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL) 
+               if (switch_ivr_originate(a_leg ? a_leg->session : NULL, &session, &cause, nuuid, 60, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL)
                        == SWITCH_STATUS_SUCCESS) {
                        channel = switch_core_session_get_channel(session);
                        allocated = 1;
@@ -652,7 +652,7 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::~CoreSession()
 
 SWITCH_DECLARE(char *) CoreSession::getXMLCDR()
 {
-       
+
        switch_xml_t cdr = NULL;
 
        this_check((char *)"");
@@ -672,7 +672,7 @@ SWITCH_DECLARE(void) CoreSession::setEventData(Event *e)
 {
        this_check_void();
        sanity_check_noreturn;
-       
+
        if (channel && e->event) {
                switch_channel_event_set_data(channel, e->event);
        }
@@ -717,7 +717,7 @@ SWITCH_DECLARE(int) CoreSession::preAnswer()
 
 SWITCH_DECLARE(void) CoreSession::hangupState(void)
 {
-       sanity_check_noreturn;  
+       sanity_check_noreturn;
        this->begin_allow_threads();
        if (switch_channel_down(channel)) {
                switch_core_session_hangup_state(session, SWITCH_FALSE);
@@ -728,7 +728,7 @@ SWITCH_DECLARE(void) CoreSession::hangupState(void)
 SWITCH_DECLARE(void) CoreSession::hangup(const char *cause)
 {
        this_check_void();
-       sanity_check_noreturn;  
+       sanity_check_noreturn;
     switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CoreSession::hangup\n");
        this->begin_allow_threads();
     switch_channel_hangup(channel, switch_channel_str2cause(cause));
@@ -772,7 +772,7 @@ SWITCH_DECLARE(void) CoreSession::execute(const char *app, const char *data)
        if (zstr(app)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No application specified\n");
                return;
-       } 
+       }
 
        begin_allow_threads();
        switch_core_session_execute_application(session, app, data);
@@ -787,16 +787,16 @@ SWITCH_DECLARE(void) CoreSession::setDTMFCallback(void *cbfunc, char *funcargs)
        cb_state.funcargs = funcargs;
        cb_state.function = cbfunc;
 
-       args.buf = &cb_state; 
+       args.buf = &cb_state;
        args.buflen = sizeof(cb_state);  // not sure what this is used for, copy mod_spidermonkey
 
     switch_channel_set_private(channel, "CoreSession", this);
-        
+
        // we cannot set the actual callback to a python function, because
        // the callback is a function pointer with a specific signature.
        // so, set it to the following c function which will act as a proxy,
        // finding the python callback in the args callback args structure
-       args.input_callback = dtmf_callback;  
+       args.input_callback = dtmf_callback;
        ap = &args;
 
 
@@ -871,7 +871,7 @@ SWITCH_DECLARE(int) CoreSession::collectDigits(int digit_timeout, int abs_timeou
        switch_ivr_collect_digits_callback(session, ap, digit_timeout, abs_timeout);
     end_allow_threads();
     return SWITCH_STATUS_SUCCESS;
-} 
+}
 
 SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, char *terminators, int timeout)
 {
@@ -883,8 +883,8 @@ SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, char *terminators,
     return getDigits(maxdigits, terminators, timeout, interdigit, 0);
 }
 
-SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, 
-                                                                                         char *terminators, 
+SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits,
+                                                                                         char *terminators,
                                                                                          int timeout,
                                                                                          int interdigit,
                                                                                          int abstimeout)
@@ -895,12 +895,12 @@ SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits,
        char terminator;
 
        memset(dtmf_buf, 0, sizeof(dtmf_buf));
-       switch_ivr_collect_digits_count(session, 
+       switch_ivr_collect_digits_count(session,
                                                                        dtmf_buf,
                                                                        sizeof(dtmf_buf),
-                                                                       maxdigits, 
-                                                                       terminators, 
-                                                                       &terminator, 
+                                                                       maxdigits,
+                                                                       terminators,
+                                                                       &terminator,
                                                                        (uint32_t) timeout, (uint32_t)interdigit, (uint32_t)abstimeout);
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "getDigits dtmf_buf: %s\n", dtmf_buf);
@@ -943,19 +943,19 @@ SWITCH_DECLARE(char *) CoreSession::read(int min_digits,
        }
 
     begin_allow_threads();
-       switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, NULL, dtmf_buf, 
+       switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, NULL, dtmf_buf,
                                        sizeof(dtmf_buf), timeout, valid_terminators, (uint32_t)digit_timeout);
     end_allow_threads();
 
        return dtmf_buf;
 }
 
-SWITCH_DECLARE(char *) CoreSession::playAndGetDigits(int min_digits, 
-                                                                                                        int max_digits, 
-                                                                                                        int max_tries, 
-                                                                                                        int timeout, 
-                                                                                                        char *terminators, 
-                                                                                                        char *audio_files, 
+SWITCH_DECLARE(char *) CoreSession::playAndGetDigits(int min_digits,
+                                                                                                        int max_digits,
+                                                                                                        int max_tries,
+                                                                                                        int timeout,
+                                                                                                        char *terminators,
+                                                                                                        char *audio_files,
                                                                                                         char *bad_input_audio_files,
                                                                                                         char *digits_regex,
                                                                                                         const char *var_name,
@@ -966,17 +966,17 @@ SWITCH_DECLARE(char *) CoreSession::playAndGetDigits(int min_digits,
        this_check((char *)"");
        begin_allow_threads();
        memset(dtmf_buf, 0, sizeof(dtmf_buf));
-       switch_play_and_get_digits( session, 
+       switch_play_and_get_digits( session,
                                                                (uint32_t) min_digits,
                                                                (uint32_t) max_digits,
-                                                               (uint32_t) max_tries, 
-                                                               (uint32_t) timeout, 
-                                                               terminators, 
-                                                               audio_files, 
+                                                               (uint32_t) max_tries,
+                                                               (uint32_t) timeout,
+                                                               terminators,
+                                                               audio_files,
                                                                bad_input_audio_files,
                                                                var_name,
-                                                               dtmf_buf, 
-                                                               sizeof(dtmf_buf), 
+                                                               dtmf_buf,
+                                                               sizeof(dtmf_buf),
                                                                digits_regex,
                                                                (uint32_t) digit_timeout,
                                                                transfer_on_failure);
@@ -985,7 +985,7 @@ SWITCH_DECLARE(char *) CoreSession::playAndGetDigits(int min_digits,
        return dtmf_buf;
 }
 
-SWITCH_DECLARE(void) CoreSession::say(const char *tosay, const char *module_name, const char *say_type, const char *say_method, const char *say_gender) 
+SWITCH_DECLARE(void) CoreSession::say(const char *tosay, const char *module_name, const char *say_type, const char *say_method, const char *say_gender)
 {
        this_check_void();
        sanity_check_noreturn;
@@ -998,11 +998,11 @@ SWITCH_DECLARE(void) CoreSession::say(const char *tosay, const char *module_name
     end_allow_threads();
 }
 
-SWITCH_DECLARE(void) CoreSession::sayPhrase(const char *phrase_name, const char *phrase_data, const char *phrase_lang) 
+SWITCH_DECLARE(void) CoreSession::sayPhrase(const char *phrase_name, const char *phrase_data, const char *phrase_lang)
 {
        this_check_void();
        sanity_check_noreturn;
-       
+
        if (!(phrase_name)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error! invalid args.\n");
                return;
@@ -1022,7 +1022,7 @@ SWITCH_DECLARE(int) CoreSession::streamFile(char *file, int starting_sample_coun
 
        this_check(-1);
     sanity_check(-1);
-       
+
        memset(&local_fh, 0, sizeof(local_fh));
        fhp = &local_fh;
     local_fh.samples = starting_sample_count;
@@ -1040,7 +1040,7 @@ SWITCH_DECLARE(int) CoreSession::streamFile(char *file, int starting_sample_coun
     end_allow_threads();
 
        fhp = NULL;
-       
+
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 
 }
@@ -1051,7 +1051,7 @@ SWITCH_DECLARE(int) CoreSession::sleep(int ms, int sync) {
 
        this_check(-1);
     sanity_check(-1);
-       
+
     begin_allow_threads();
     status = switch_ivr_sleep(session, ms, (switch_bool_t) sync, ap);
     end_allow_threads();
@@ -1088,21 +1088,21 @@ SWITCH_DECLARE(bool) CoreSession::bridged() {
 SWITCH_DECLARE(bool) CoreSession::mediaReady() {
 
        this_check(false);
-       sanity_check(false);    
+       sanity_check(false);
        return switch_channel_media_ready(channel) != 0;
 }
 
 SWITCH_DECLARE(bool) CoreSession::answered() {
 
        this_check(false);
-       sanity_check(false);    
+       sanity_check(false);
        return switch_channel_test_flag(channel, CF_ANSWERED) != 0;
 }
 
 SWITCH_DECLARE(void) CoreSession::destroy(void)
 {
        this_check_void();
-       
+
        if (!allocated) {
                return;
        }
@@ -1110,7 +1110,7 @@ SWITCH_DECLARE(void) CoreSession::destroy(void)
        allocated = 0;
 
        switch_safe_free(xml_cdr_text);
-       switch_safe_free(uuid); 
+       switch_safe_free(uuid);
        switch_safe_free(tts_name);
        switch_safe_free(voice_name);
 
@@ -1120,7 +1120,7 @@ SWITCH_DECLARE(void) CoreSession::destroy(void)
                }
 
                if (channel) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                          "%s destroy/unlink session from object\n", switch_channel_get_name(channel));
                        switch_channel_set_private(channel, "CoreSession", NULL);
                        if (switch_channel_up(channel) && switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
@@ -1134,7 +1134,7 @@ SWITCH_DECLARE(void) CoreSession::destroy(void)
     }
 
        init_vars();
-       
+
 }
 
 SWITCH_DECLARE(const char *) CoreSession::hangupCause()
@@ -1169,19 +1169,19 @@ SWITCH_DECLARE(int) CoreSession::originate(CoreSession *a_leg_session, char *des
        }
 
        // this session has no valid switch_core_session_t at this point, and therefore
-       // no valid channel.  since the threadstate is stored in the channel, and there 
+       // no valid channel.  since the threadstate is stored in the channel, and there
        // is none, if we try to call begin_alllow_threads it will fail miserably.
        // use the 'a leg session' to do the thread swapping stuff.
     if (a_leg_session) a_leg_session->begin_allow_threads();
 
-       if (switch_ivr_originate(aleg_core_session, 
-                                                        &session, 
-                                                        &cause, 
-                                                        dest, 
+       if (switch_ivr_originate(aleg_core_session,
+                                                        &session,
+                                                        &cause,
+                                                        dest,
                                                         timeout,
-                                                        handlers, 
-                                                        NULL, 
-                                                        NULL, 
+                                                        handlers,
+                                                        NULL,
+                                                        NULL,
                                                         NULL,
                                                         NULL,
                                                         SOF_NONE,
@@ -1205,7 +1205,7 @@ SWITCH_DECLARE(int) CoreSession::originate(CoreSession *a_leg_session, char *des
        return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(int) CoreSession::recordFile(char *file_name, int time_limit, int silence_threshold, int silence_hits) 
+SWITCH_DECLARE(int) CoreSession::recordFile(char *file_name, int time_limit, int silence_threshold, int silence_hits)
 {
        switch_status_t status;
        switch_file_handle_t local_fh;
@@ -1228,7 +1228,7 @@ SWITCH_DECLARE(int) CoreSession::recordFile(char *file_name, int time_limit, int
 
 }
 
-SWITCH_DECLARE(int) CoreSession::flushEvents() 
+SWITCH_DECLARE(int) CoreSession::flushEvents()
 {
        switch_event_t *event;
 
@@ -1245,7 +1245,7 @@ SWITCH_DECLARE(int) CoreSession::flushEvents()
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(int) CoreSession::flushDigits() 
+SWITCH_DECLARE(int) CoreSession::flushDigits()
 {
        this_check(-1);
        sanity_check(-1);
@@ -1253,14 +1253,14 @@ SWITCH_DECLARE(int) CoreSession::flushDigits()
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(int) CoreSession::setAutoHangup(bool val) 
+SWITCH_DECLARE(int) CoreSession::setAutoHangup(bool val)
 {
        this_check(-1);
        sanity_check(-1);
 
        if (!session) {
                return SWITCH_STATUS_FALSE;
-       }       
+       }
        if (val) {
                switch_set_flag(this, S_HUP);
        } else {
@@ -1269,11 +1269,11 @@ SWITCH_DECLARE(int) CoreSession::setAutoHangup(bool val)
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(void) CoreSession::waitForAnswer(CoreSession *calling_session) 
+SWITCH_DECLARE(void) CoreSession::waitForAnswer(CoreSession *calling_session)
 {
        this_check_void();
        sanity_check_noreturn;
-       
+
        switch_ivr_wait_for_answer(calling_session ? calling_session->session : NULL, session);
 
 }
@@ -1282,7 +1282,7 @@ SWITCH_DECLARE(void) CoreSession::setHangupHook(void *hangup_func) {
 
        this_check_void();
        sanity_check_noreturn;
-       
+
     switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CoreSession::seHangupHook, hangup_func: %p\n", hangup_func);
     on_hangup = hangup_func;
     switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -1324,7 +1324,7 @@ SWITCH_DECLARE(int) globalSetVariable(const char *var, const char *val, const ch
 {
        if (zstr(val)) val = NULL;
        if (zstr(val2)) val2 = NULL;
-       
+
        if (val2) {
                return switch_core_set_var_conditional(var, val, val2);
        } else {
@@ -1414,7 +1414,7 @@ SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b)
        switch_input_args_t args;
        switch_channel_t *channel_a = NULL, *channel_b = NULL;
        const char *err = "Channels not ready\n";
-       
+
        if (session_a.allocated && session_a.session && session_b.allocated && session_b.session) {
                channel_a = switch_core_session_get_channel(session_a.session);
                channel_b = switch_core_session_get_channel(session_b.session);
@@ -1442,7 +1442,7 @@ SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b)
 
 }
 
-SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session_hungup) 
+SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session_hungup)
 {
        if (session_hungup) {
                switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
@@ -1465,12 +1465,12 @@ SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session
 }
 
 
-SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session_cb, 
-                                                                                                        void *input, 
-                                                                                                        switch_input_type_t itype, 
-                                                                                                        void *buf,  
+SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session_cb,
+                                                                                                        void *input,
+                                                                                                        switch_input_type_t itype,
+                                                                                                        void *buf,
                                                                                                         unsigned int buflen) {
-       
+
        switch_channel_t *channel = switch_core_session_get_channel(session_cb);
        CoreSession *coresession = NULL;
 
@@ -1486,10 +1486,10 @@ SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *sess
 
 SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *result)
 {
-       
+
        this_check(SWITCH_STATUS_FALSE);
        sanity_check(SWITCH_STATUS_FALSE);
-       
+
        return switch_ivr_process_fh(session, result, fhp);
 }
 
index 82f87d1c481086c9d2870f8c5322ea5f859c4286..c99a5f61de062d8d92bef9249cbe018083ff7213 100644 (file)
@@ -2,7 +2,7 @@
 #include "switch_curl.h"
 #include <curl/curl.h>
 
-SWITCH_DECLARE(switch_CURL *) switch_curl_easy_init(void) 
+SWITCH_DECLARE(switch_CURL *) switch_curl_easy_init(void)
 {
        return curl_easy_init();
 }
@@ -81,7 +81,7 @@ SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_even
 
                if (!strncasecmp(hp->name, "attach_file:", 12)) {
                        char *pname = strdup(hp->name + 12);
-                       
+
                        if (pname) {
                                char *fname = strchr(pname, ':');
                                if (fname) {
index afa7b05f9c984964c9fc7f2412c2a68d3b05348f..8ec57139b13364a0b12f112a1753c3174e5e024d 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Cross Platform dso/dll load abstraction
  * Copyright(C) 2008 Michael Jerris
  *
@@ -13,7 +13,7 @@
  * code prove defective in any respect, you (not the initial developer or any other contributor)
  * assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
  * constitutes an essential part of this license. No use of any covered code is authorized hereunder
- * except under this disclaimer. 
+ * except under this disclaimer.
  *
  */
 
index 6f6e85a52c0b7195f658a2d7e58efcb278d4a4bd..8d7ca50dd0986a719d0b751690093c2bae91e2cf 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Dragos Oancea <droancea@yahoo.com>
  *
  * switch_estimators.c -- Estimators and Detectors (try to read into the future: packet loss, jitter, RTT, etc)
 
 /* This function initializes the Kalman System Model
  *
- * xk+1 = A*xk + wk 
+ * xk+1 = A*xk + wk
  * zk = H*xk + vk
  * xk = state variable (must exist in physical world - measurable )
- * zk = measurment 
- * wk,vk - white noise 
- * A = state trasition matrix , (n x n )  matrix 
- * H = state-to-measurment matrix , ( n x n ) matrix 
+ * zk = measurment
+ * wk,vk - white noise
+ * A = state trasition matrix , (n x n )  matrix
+ * H = state-to-measurment matrix , ( n x n ) matrix
  * Noise covariance:
  * Q:  Covariance matrix of wk, ( n x n ) diagonal matrix
- * R:  Covariance matrix of vk , ( m x m ) diagonal matrix 
- * R: if you want to be affected less by the measurement and get the estimate with less variation, increase R 
- * Q: if you want to be affected more by the measurement and get the estimate with more variation, decrease Q  
+ * R:  Covariance matrix of vk , ( m x m ) diagonal matrix
+ * R: if you want to be affected less by the measurement and get the estimate with less variation, increase R
+ * Q: if you want to be affected more by the measurement and get the estimate with more variation, decrease Q
  *
  * (Phil Kim book)
  *
@@ -76,7 +76,7 @@ SWITCH_DECLARE(void) switch_kalman_init(kalman_estimator_t *est, float Q, float
        est -> Q = Q; /*accuracy of system model */ /* SYSTEM MODEL: TO BE DEDUCTED */
        est -> R = R; /*accuracy of measurement*/ /* SYSTEM MODEL: TO BE DEDUCTED */
        est -> K = 0;
-       est -> val_estimate = 0 ; 
+       est -> val_estimate = 0 ;
        est -> val_measured = 0 ; // [0-100 %] or [0-5000] or [0-2sec]
 }
 
@@ -84,7 +84,7 @@ SWITCH_DECLARE(void) switch_kalman_init(kalman_estimator_t *est, float Q, float
 CUSUM Kalman functions to detect sudden change over a predefined thereshold.
 
 y(t) = sampled RTT
-x(t)= desired RTT 
+x(t)= desired RTT
 
 Model:
 x(t+1) = x(t) + delta(t)*v(t)
@@ -92,25 +92,25 @@ y(t) = x(t) + e(t)
 
 Noisy characteristic of RTT captured by measurment noise e(t) with variance Re.
 The step changes in the desired RTT x(t) is modeled as the process noise v(t)
-with variance Rv and the discrete variable delta(t) . 
+with variance Rv and the discrete variable delta(t) .
 If a change occurs at time t, then delta(t) = 1 otherwise delta(t) = 0.
 
 avg(x(t)) = avg(x(t-1)) + K(t)(y(t) - avg(x(t-1)))
 K(t) = P(t-1)/(P(t-1) + Re))
-P(t) = (1-K(t))P(t-1)  + delta(t-1)* Rv 
+P(t) = (1-K(t))P(t-1)  + delta(t-1)* Rv
 e(t) = y(t) - avg(x(t))
 g(t) = max(g(t-1) + e(t) - epsilon,0)
-if g(t) > 0 then 
+if g(t) > 0 then
        delta(t) = 1 // alarm
        g(t) = 0
-else 
+else
        delta(t) = 0
 endif
 
-constants: 
+constants:
 
-epsilon = 0.005 
-h = 0.05 
+epsilon = 0.005
+h = 0.05
 */
 SWITCH_DECLARE(switch_bool_t) switch_kalman_cusum_init(cusum_kalman_detector_t *detect_change, float epsilon,float h)
 {
@@ -123,9 +123,9 @@ SWITCH_DECLARE(switch_bool_t) switch_kalman_cusum_init(cusum_kalman_detector_t *
 
        detector_change -> val_estimate_last = 0;
        detector_change -> val_desired_last = 0;
-       detector_change -> P_last = 0; 
+       detector_change -> P_last = 0;
        detector_change -> K_last = 0;
-       detector_change -> delta = 0; 
+       detector_change -> delta = 0;
        detector_change -> measurement_noise_e = 0;
        detector_change -> variance_Re = 0;
        detector_change -> measurement_noise_v = 0;
@@ -139,14 +139,14 @@ SWITCH_DECLARE(switch_bool_t) switch_kalman_cusum_init(cusum_kalman_detector_t *
        detector_change -> last_q = 0;
        detector_change -> N = 0;
        return TRUE;
-} 
+}
 
 SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_detector_t * detector, float measurement, float rtt_avg)
 {
        float K=0;
        float P=0;
        float g=0;
-       float desired_val; 
+       float desired_val;
        float current_average;
        float current_q;
        float sample_variance_Re = 0;
@@ -189,10 +189,10 @@ SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_de
                return TRUE;
        }
        return FALSE;
-} 
+}
 
 /* Kalman filter abstract ( measure and estimate 1 single value per system model )
- * Given the measurment and the system model  together with the current state , 
+ * Given the measurment and the system model  together with the current state ,
  * the function puts an estimate in the estimator struct */
 SWITCH_DECLARE(switch_bool_t) switch_kalman_estimate(kalman_estimator_t * est, float measurement, int system_model)
 {
@@ -209,7 +209,7 @@ SWITCH_DECLARE(switch_bool_t) switch_kalman_estimate(kalman_estimator_t * est, f
        if (system_model == EST_LOSS )  {
                if ((measurement > 100) && (measurement < 0)) {
                        return SWITCH_FALSE ;
-               }               
+               }
        }
 
        if (system_model == EST_JITTER)  {
@@ -242,10 +242,10 @@ SWITCH_DECLARE(switch_bool_t) switch_kalman_is_slow_link(kalman_estimator_t * es
        float thresh_packet_loss = 5; /* % */
        float thresh_rtt = 0.8 ; /*seconds*/
 
-       if ((est_loss->val_estimate_last > thresh_packet_loss) && 
+       if ((est_loss->val_estimate_last > thresh_packet_loss) &&
                                (est_rtt->val_estimate_last > thresh_rtt )) {
                return SWITCH_TRUE;
-       } 
+       }
 
        return SWITCH_FALSE;
 }
index 6f99952d79523661851c738685dfe09335cb85b9..078b74039753818de089127331664e5d7a1f5f43 100644 (file)
@@ -274,7 +274,7 @@ static void *SWITCH_THREAD_FUNC switch_event_deliver_thread(switch_thread_t *thr
 static void switch_event_deliver_thread_pool(switch_event_t **event)
 {
        switch_thread_data_t *td;
-       
+
        td = malloc(sizeof(*td));
        switch_assert(td);
 
@@ -551,12 +551,12 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void)
                for(x = 0; x < (uint32_t)DISPATCH_THREAD_COUNT; x++) {
                        switch_queue_trypush(EVENT_DISPATCH_QUEUE, NULL);
                }
-               
+
 
                switch_queue_interrupt_all(EVENT_DISPATCH_QUEUE);
-               
+
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch threads\n");
-               
+
                for(x = 0; x < (uint32_t)DISPATCH_THREAD_COUNT; x++) {
                        switch_status_t st;
                        switch_thread_join(&st, EVENT_DISPATCH_QUEUE_THREADS[x]);
@@ -606,17 +606,17 @@ static void check_dispatch(void)
 {
        if (!EVENT_DISPATCH_QUEUE) {
                switch_mutex_lock(BLOCK);
-               
+
                if (!EVENT_DISPATCH_QUEUE) {
                        switch_queue_create(&EVENT_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, THRUNTIME_POOL);
                        switch_event_launch_dispatch_threads(1);
-                       
+
                        while (!THREAD_COUNT) {
                                switch_cond_next();
                        }
                }
                switch_mutex_unlock(BLOCK);
-       }            
+       }
 }
 
 
@@ -1824,7 +1824,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_serialize_json(switch_event_t *even
        if (switch_event_serialize_json_obj(event, &cj) == SWITCH_STATUS_SUCCESS) {
                *str = cJSON_PrintUnformatted(cj);
                cJSON_Delete(cj);
-               
+
                return SWITCH_STATUS_SUCCESS;
        }
 
@@ -2001,7 +2001,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_get_custom_events(switch_console_ca
        const void *var;
        void *val;
        int x = 0;
-       
+
        for (hi = switch_core_hash_first(CUSTOM_HASH); hi; hi = switch_core_hash_next(&hi)) {
                switch_core_hash_this(hi, &var, NULL, &val);
                switch_console_push_match(matches, (const char *) var);
@@ -2705,7 +2705,7 @@ static uint32_t switch_event_channel_unsub_head(switch_event_channel_func_t func
 
                if (!func || thisnp->func == func) {
                        x++;
-                       
+
                        if (last) {
                                last->next = np;
                        } else {
@@ -2789,7 +2789,7 @@ static uint32_t switch_event_channel_unsub_channel(switch_event_channel_func_t f
 }
 
 static switch_status_t switch_event_channel_sub_channel(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t id)
-                                                                                                               
+
 {
        switch_event_channel_sub_node_t *node, *np;
        switch_event_channel_sub_node_head_t *head;
@@ -2853,7 +2853,7 @@ typedef struct {
 
 
 
-static uint32_t _switch_event_channel_broadcast(const char *event_channel, const char *broadcast_channel, 
+static uint32_t _switch_event_channel_broadcast(const char *event_channel, const char *broadcast_channel,
                                                                                                cJSON *json, const char *key, switch_event_channel_id_t id)
 {
        switch_event_channel_sub_node_t *np;
@@ -2866,7 +2866,7 @@ static uint32_t _switch_event_channel_broadcast(const char *event_channel, const
                        if (np->id == id) {
                                continue;
                        }
-                       
+
                        np->func(broadcast_channel, json, key, id);
                        x++;
                }
@@ -2899,7 +2899,7 @@ static void ecd_deliver(event_channel_data_t **ecdP)
        *ecdP = NULL;
 
        _switch_event_channel_broadcast(ecd->event_channel, ecd->event_channel, ecd->json, ecd->key, ecd->id);
-       
+
        if ((p = strchr(ecd->event_channel, '.'))) {
                char *main_channel = strdup(ecd->event_channel);
                p = strchr(main_channel, '.');
@@ -2925,7 +2925,7 @@ static void *SWITCH_THREAD_FUNC switch_event_channel_deliver_thread(switch_threa
        switch_mutex_unlock(EVENT_QUEUE_MUTEX);
 
        while(SYSTEM_RUNNING) {
-               
+
                if (switch_queue_pop(queue, &pop) != SWITCH_STATUS_SUCCESS) {
                        continue;
                }
@@ -2950,7 +2950,7 @@ static void *SWITCH_THREAD_FUNC switch_event_channel_deliver_thread(switch_threa
        switch_mutex_unlock(EVENT_QUEUE_MUTEX);
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Channel Dispatch Thread Ended.\n");
-       return NULL;    
+       return NULL;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_event_channel_broadcast(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id)
@@ -2983,19 +2983,19 @@ SWITCH_DECLARE(switch_status_t) switch_event_channel_broadcast(const char *event
 
        if (launch) {
                switch_thread_data_t *td;
-       
+
                if (!EVENT_CHANNEL_DISPATCH_QUEUE) {
                        switch_queue_create(&EVENT_CHANNEL_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, THRUNTIME_POOL);
                }
 
                td = malloc(sizeof(*td));
                switch_assert(td);
-               
+
                td->alloc = 1;
                td->func = switch_event_channel_deliver_thread;
                td->obj = EVENT_CHANNEL_DISPATCH_QUEUE;
                td->pool = NULL;
-               
+
                switch_thread_pool_launch_thread(&td);
        }
 
@@ -3007,7 +3007,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_channel_broadcast(const char *event
        } else {
                ecd = NULL;
        }
-       
+
        return status;
 }
 
@@ -3017,7 +3017,7 @@ SWITCH_DECLARE(uint32_t) switch_event_channel_unbind(const char *event_channel,
 }
 
 SWITCH_DECLARE(switch_status_t) switch_event_channel_bind(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t *id)
-                                                                                                                 
+
 {
        switch_status_t status = SWITCH_STATUS_SUCCESS;
 
@@ -3131,7 +3131,7 @@ static switch_status_t la_broadcast(switch_live_array_t *la, cJSON **json)
 
                        cJSON_ReplaceItemInObject(dup, "eventChannel", cJSON_CreateString(np->event_channel));
                        cJSON_ReplaceItemInObject(data, "name", cJSON_CreateString(np->name));
-                       
+
                        switch_event_channel_broadcast(np->event_channel, &dup, __FILE__, la->channel_id);
                }
                switch_mutex_unlock(la->mutex);
@@ -3149,14 +3149,14 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_visible(switch_live_array_t *l
        switch_mutex_lock(la->mutex);
        if (la->visible != visible || force) {
                cJSON *msg, *data;
-               
+
                msg = cJSON_CreateObject();
                data = json_add_child_obj(msg, "data", NULL);
 
                cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel));
                cJSON_AddItemToObject(data, "action", cJSON_CreateString(visible ? "hide" : "show"));
                cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++));
-               
+
                la_broadcast(la, &msg);
 
                la->visible = visible;
@@ -3182,7 +3182,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_clear(switch_live_array_t *la)
        cJSON_AddItemToObject(data, "name", cJSON_CreateString(la->name));
        cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(-1));
        cJSON_AddItemToObject(data, "data", cJSON_CreateObject());
-       
+
        la_broadcast(la, &msg);
 
        while(np) {
@@ -3194,7 +3194,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_clear(switch_live_array_t *la)
        }
 
        la->head = la->tail = NULL;
-       
+
        switch_mutex_unlock(la->mutex);
 
        return SWITCH_STATUS_SUCCESS;
@@ -3216,7 +3216,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_bootstrap(switch_live_array_t
        cJSON_AddItemToObject(data, "name", cJSON_CreateString(la->name));
        cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(-1));
        cJSON_AddItemToObject(data, "data", cJSON_CreateObject());
-       
+
        switch_event_channel_broadcast(la->event_channel, &msg, __FILE__, channel_id);
 
        for (np = la->head; np; np = np->next) {
@@ -3239,7 +3239,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_bootstrap(switch_live_array_t
 
        msg = cJSON_CreateObject();
        data = json_add_child_obj(msg, "data", NULL);
-       
+
        cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel));
        cJSON_AddItemToObject(data, "action", cJSON_CreateString("bootObj"));
        cJSON_AddItemToObject(data, "name", cJSON_CreateString(la->name));
@@ -3257,7 +3257,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_bootstrap(switch_live_array_t
                cJSON_AddItemToArray(row, cJSON_Duplicate(np->obj, 1));
                cJSON_AddItemToArray(data, row);
        }
-       
+
        switch_event_channel_broadcast(la->event_channel, &msg, __FILE__, channel_id);
 
 
@@ -3295,7 +3295,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_destroy(switch_live_array_t **
        pool = la->pool;
 
        switch_live_array_clear(la);
-       
+
        switch_core_hash_destroy(&la->hash);
 
        switch_mutex_lock(event_channel_manager.lamutex);
@@ -3359,7 +3359,7 @@ SWITCH_DECLARE(switch_bool_t) switch_live_array_add_alias(switch_live_array_t *l
                        break;
                }
        }
-       
+
        if (!exist) {
                node = switch_core_alloc(la->pool, sizeof(*node));
                node->event_channel = switch_core_strdup(la->pool, event_channel);
@@ -3385,7 +3385,7 @@ SWITCH_DECLARE(switch_bool_t) switch_live_array_add_alias(switch_live_array_t *l
        return !exist;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_channel, const char *name, 
+SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_channel, const char *name,
                                                                                                                 switch_event_channel_id_t channel_id, switch_live_array_t **live_arrayP)
 {
        switch_live_array_t *la = NULL;
@@ -3395,10 +3395,10 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_chann
        switch_core_new_memory_pool(&pool);
        key = switch_core_sprintf(pool, "%s.%s", event_channel, name);
 
-       switch_mutex_lock(event_channel_manager.lamutex); 
+       switch_mutex_lock(event_channel_manager.lamutex);
        la = switch_core_hash_find(event_channel_manager.lahash, key);
        switch_mutex_unlock(event_channel_manager.lamutex);
-       
+
        if (la) {
                la->new = SWITCH_FALSE;
        } else {
@@ -3413,7 +3413,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_chann
                la->channel_id = channel_id;
                switch_core_hash_init(&la->hash);
                switch_mutex_init(&la->mutex, SWITCH_MUTEX_NESTED, la->pool);
-               
+
                switch_mutex_lock(event_channel_manager.lamutex);
                switch_core_hash_insert(event_channel_manager.lahash, la->key, la);
                switch_mutex_unlock(event_channel_manager.lamutex);
@@ -3424,7 +3424,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_chann
        switch_mutex_unlock(la->mutex);
 
        *live_arrayP = la;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -3435,7 +3435,7 @@ SWITCH_DECLARE(cJSON *) switch_live_array_get(switch_live_array_t *la, const cha
 
        switch_mutex_lock(la->mutex);
        if ((node = switch_core_hash_find(la->hash, name))) {
-               dup = cJSON_Duplicate(node->obj, 1); 
+               dup = cJSON_Duplicate(node->obj, 1);
        }
        switch_mutex_unlock(la->mutex);
 
@@ -3450,12 +3450,12 @@ SWITCH_DECLARE(cJSON *) switch_live_array_get_idx(switch_live_array_t *la, int i
        switch_mutex_lock(la->mutex);
        for (node = la->head; node; node = node->next) {
                if (node->pos == idx) {
-                       dup = cJSON_Duplicate(node->obj, 1); 
+                       dup = cJSON_Duplicate(node->obj, 1);
                        break;
                }
        }
        switch_mutex_unlock(la->mutex);
-       
+
        return dup;
 }
 
@@ -3478,7 +3478,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_del(switch_live_array_t *la, c
        switch_mutex_lock(la->mutex);
        if ((node = switch_core_hash_find(la->hash, name))) {
                np = la->head;
-               
+
                while(np) {
                        cur = np;
                        np = np->next;
@@ -3545,9 +3545,9 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, c
                if (index > -1 && index < la->pos && la->head) {
                        la_node_t *np, *last = NULL;
                        int i = 0;
-                       
+
                        for(np = la->head; np; np = np->next) {
-                               
+
                                if (i == index) {
                                        if (last) {
                                                node->next = last->next;
@@ -3565,7 +3565,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, c
                                last = np;
                                i++;
                        }
-                       
+
 
                } else {
 
@@ -3590,7 +3590,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, c
 
        msg = cJSON_CreateObject();
        data = json_add_child_obj(msg, "data", NULL);
-       
+
        cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel));
        cJSON_AddItemToObject(data, "action", cJSON_CreateString(action));
 
@@ -3604,7 +3604,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, c
        cJSON_AddItemToObject(data, "data", cJSON_Duplicate(node->obj, 1));
 
        la_broadcast(la, &msg);
-       
+
        switch_mutex_unlock(la->mutex);
 
        return status;
@@ -3628,7 +3628,7 @@ SWITCH_DECLARE(void) switch_live_array_parse_json(cJSON *json, switch_event_chan
        const char *context = NULL, *name = NULL;
        switch_live_array_t *la = NULL;
        cJSON *jla = NULL;
-       
+
        if ((jla = cJSON_GetObjectItem(json, "data")) && (jla = cJSON_GetObjectItem(jla, "liveArray"))) {
 
                if ((context = cJSON_GetObjectCstr(jla, "context")) && (name = cJSON_GetObjectCstr(jla, "name"))) {
@@ -3637,7 +3637,7 @@ SWITCH_DECLARE(void) switch_live_array_parse_json(cJSON *json, switch_event_chan
 
                        if (command) {
                                if (switch_live_array_create(context, name, channel_id, &la) == SWITCH_STATUS_SUCCESS) {
-                               
+
                                        if (!strcasecmp(command, "bootstrap")) {
                                                switch_live_array_bootstrap(la, sessid, channel_id);
                                        } else {
index d0b47778e7940dbea91fb5897839d6a98f4caa0c..c7676990b664c66ba5cfa246706a9ca01a541df2 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (c) 2002, Christopher Clark
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -64,9 +64,9 @@ switch_create_hashtable(switch_hashtable_t **hp, unsigned int minsize,
        if (minsize > (1u << 30)) {*hp = NULL; return SWITCH_STATUS_FALSE;}
        /* Enforce size as prime */
        for (pindex=0; pindex < prime_table_length; pindex++) {
-               if (primes[pindex] > minsize) { 
-                       size = primes[pindex]; 
-                       break; 
+               if (primes[pindex] > minsize) {
+                       size = primes[pindex];
+                       break;
                }
        }
        h = (switch_hashtable_t *) malloc(sizeof(switch_hashtable_t));
@@ -120,7 +120,7 @@ hashtable_expand(switch_hashtable_t *h)
                        h->table = newtable;
                }
        /* Plan B: realloc instead */
-       else 
+       else
                {
                        newtable = (struct entry **)
                                realloc(h->table, newsize * sizeof(struct entry *));
@@ -174,7 +174,7 @@ static void * _switch_hashtable_remove(switch_hashtable_t *h, void *k, unsigned
                                freekey(e->k);
                        }
                        if (e->flags & HASHTABLE_FLAG_FREE_VALUE) {
-                               switch_safe_free(e->v); 
+                               switch_safe_free(e->v);
                                v = NULL;
                        } else if (e->destructor) {
                                e->destructor(e->v);
@@ -259,19 +259,19 @@ switch_hashtable_destroy(switch_hashtable_t **h)
        for (i = 0; i < (*h)->tablelength; i++) {
                e = table[i];
                while (NULL != e) {
-                       f = e; e = e->next; 
+                       f = e; e = e->next;
 
                        if (f->flags & HASHTABLE_FLAG_FREE_KEY) {
-                               freekey(f->k); 
+                               freekey(f->k);
                        }
-                       
+
                        if (f->flags & HASHTABLE_FLAG_FREE_VALUE) {
-                               switch_safe_free(f->v); 
+                               switch_safe_free(f->v);
                        } else if (f->destructor) {
                                f->destructor(f->v);
                                f->v = NULL;
                        }
-                       switch_safe_free(f); 
+                       switch_safe_free(f);
                }
        }
 
@@ -284,9 +284,9 @@ SWITCH_DECLARE(switch_hashtable_iterator_t *) switch_hashtable_next(switch_hasht
 {
 
        switch_hashtable_iterator_t *i = *iP;
-       
+
        if (i->e) {
-               if ((i->e = i->e->next) != 0) { 
+               if ((i->e = i->e->next) != 0) {
                        return i;
                } else {
                        i->pos++;
@@ -296,12 +296,12 @@ SWITCH_DECLARE(switch_hashtable_iterator_t *) switch_hashtable_next(switch_hasht
        while(i->pos < i->h->tablelength && !i->h->table[i->pos]) {
                i->pos++;
        }
-       
+
        if (i->pos >= i->h->tablelength) {
                goto end;
        }
-       
-       if ((i->e = i->h->table[i->pos]) != 0) { 
+
+       if ((i->e = i->h->table[i->pos]) != 0) {
                return i;
        }
 
index d26730349163eeafe7e1b9c51c2ab55c89a976f0..76d0158b1a1dbd8113dbae00c7b31c5164d6367b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Neal Horman <neal at wanlink dot com>
@@ -148,7 +148,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
        switch_core_session_get_read_impl(session, &imp);
 
        /*
-          if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_test_flag(channel, CF_PROXY_MODE) && 
+          if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_test_flag(channel, CF_PROXY_MODE) &&
           !switch_channel_media_ready(channel) && !switch_channel_test_flag(channel, CF_SERVICE)) {
           if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
           switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot establish media.\n");
@@ -158,13 +158,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
         */
 
        if (!switch_channel_media_ready(channel)) {
-               
+
                for (elapsed=0; switch_channel_ready(channel) && elapsed<(ms/20); elapsed++) {
                        if (switch_channel_test_flag(channel, CF_BREAK)) {
                                switch_channel_clear_flag(channel, CF_BREAK);
                                switch_goto_status(SWITCH_STATUS_BREAK, end);
                        }
-               
+
                        switch_yield(20 * 1000);
                }
                switch_goto_status(SWITCH_STATUS_SUCCESS, end);
@@ -249,7 +249,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
                        switch_dtmf_t dtmf = {0};
 
                        /*
-                          dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+                          dtmf handler function you can hook up to be executed when a digit is dialed during playback
                           if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
                         */
                        if (switch_channel_has_dtmf(channel)) {
@@ -264,7 +264,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
                                        if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) {
                                                break;
                                        }
-                               } 
+                               }
 
                                if (args->input_callback) {
                                        status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
@@ -379,7 +379,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_sessio
                switch_clear_flag_locked(conninfo, SUF_READY);
                switch_socket_shutdown(conninfo->socket, SWITCH_SHUTDOWN_READWRITE);
                switch_thread_join(&st, conninfo->thread);
-               
+
                while (switch_test_flag(conninfo, SUF_THREAD_RUNNING)) {
                        switch_yield(10000);
                        if (++sanity >= 10000) {
@@ -511,7 +511,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
        switch_status_t status = SWITCH_STATUS_FALSE;
        int el = 0, elp = 0, reneg_sec = 0;
        const char *var = NULL;
-       
+
        if (zstr(cmd)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Command!\n");
                return SWITCH_STATUS_FALSE;
@@ -575,7 +575,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                        if (!switch_channel_test_flag(channel, CF_BRIDGED) || switch_channel_test_flag(channel, CF_BROADCAST)) {
                                inner++;
                                hold_bleg = NULL;
-                       } 
+                       }
 
                        if (!switch_channel_test_flag(channel, CF_BROADCAST)) {
                                switch_channel_set_flag(channel, CF_BROADCAST);
@@ -597,15 +597,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                                                if ((b_session = switch_core_session_locate(b_uuid))) {
                                                        switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
                                                        switch_status_t st;
-                                                       
+
                                                        switch_ivr_broadcast(b_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
                                                        st = switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL);
-                                                       if (st != SWITCH_STATUS_SUCCESS && 
+                                                       if (st != SWITCH_STATUS_SUCCESS &&
                                                                switch_channel_ready(channel) && switch_channel_ready(b_channel) && !switch_channel_test_flag(b_channel, CF_BROADCAST)) {
                                                                switch_core_session_kill_channel(b_session, SWITCH_SIG_BREAK);
                                                                st = switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL);
-                                                       
-                                                               if (st != SWITCH_STATUS_SUCCESS && 
+
+                                                               if (st != SWITCH_STATUS_SUCCESS &&
                                                                        switch_channel_ready(channel) && switch_channel_ready(b_channel) && !switch_channel_test_flag(b_channel, CF_BROADCAST)) {
                                                                        switch_core_session_flush_private_events(b_session);
                                                                }
@@ -661,9 +661,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
 
                        if (switch_channel_test_flag(channel, CF_STOP_BROADCAST)) {
                                switch_channel_clear_flag(channel, CF_BROADCAST);
-                               switch_channel_set_flag(channel, CF_BREAK); 
+                               switch_channel_set_flag(channel, CF_BREAK);
                        }
-                       
+
                        switch_channel_audio_sync(channel);
 
                        if ((var = switch_channel_get_variable(channel, "media_reneg_after_broadcast"))) {
@@ -674,11 +674,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                                        reneg_sec = -1;
                                }
                        }
-                       
+
                        if (reneg_sec) {
                                switch_stream_handle_t stream = { 0 };
                                char *api, *api_arg;
-                               
+
                                SWITCH_STANDARD_STREAM(stream);
                                if (reneg_sec > 0) {
                                        api = "sched_api";
@@ -728,11 +728,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                if ((extension = switch_caller_extension_new(session, "xferext", "xferext")) == 0) {
                        abort();
                }
-               
+
                for (hp = event->headers; hp; hp = hp->next) {
                        char *app;
                        char *data;
-                       
+
                        if (!strcasecmp(hp->name, "application")) {
                                app = strdup(hp->value);
                                if (app) {
@@ -749,7 +749,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
                }
 
                switch_channel_transfer_to_extension(channel, extension);
-               
+
        } else if (cmd_hash == CMD_HANGUP) {
                char *cause_name = switch_event_get_header(event, "hangup-cause");
                switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
@@ -802,7 +802,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_indications(switch_core_sessi
 {
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        switch_channel_t *channel = switch_core_session_get_channel(session);
-               
+
                switch(message->message_id) {
                case SWITCH_MESSAGE_INDICATE_ANSWER:
                        if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
@@ -871,8 +871,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_signal_data(switch_core_session
 
        while (switch_core_session_dequeue_signal_data(session, &data) == SWITCH_STATUS_SUCCESS) {
                i++;
-       
-               msg.pointer_arg = data; 
+
+               msg.pointer_arg = data;
                switch_core_session_receive_message(session, &msg);
 
                data = NULL;
@@ -963,7 +963,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
                if ((cause_str = strchr(to, ':'))) {
                        timeout_cause = switch_channel_str2cause(cause_str + 1);
                }
-               
+
                if ((timeout = atoi(to)) < 0) {
                        timeout = 0;
                } else {
@@ -1044,7 +1044,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
                        switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, read_impl.number_of_channels, sval);
                        switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
                }
-               
+
                if (expires && switch_epoch_time_now(NULL) >= expires) {
                        switch_channel_hangup(channel, timeout_cause);
                        break;
@@ -1127,12 +1127,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
 
                if (switch_channel_has_dtmf(channel)) {
                        switch_dtmf_t dtmf = { 0 };
-                               
+
                        if (args && !args->input_callback && !args->buf && !args->dmachine) {
                                status = SWITCH_STATUS_BREAK;
                                break;
                        }
-                               
+
                        switch_channel_dequeue_dtmf(channel, &dtmf);
 
                        if (args) {
@@ -1141,7 +1141,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
                                        if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) {
                                                break;
                                        }
-                               } 
+                               }
 
                                if (args->input_callback) {
                                        if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) {
@@ -1164,13 +1164,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
                                switch_event_fire(&event);
                        }
                }
-                       
+
                if (args && args->dmachine) {
                        if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
                }
-               
+
 
        }
 
@@ -1262,7 +1262,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
                                if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) {
                                        break;
                                }
-                       } 
+                       }
 
                        if (args->input_callback) {
                                status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
@@ -1605,7 +1605,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_media(const char *uuid, switch_med
 
        if ((session = switch_core_session_locate(uuid))) {
                channel = switch_core_session_get_channel(session);
-               
+
                if (switch_channel_test_flag(channel, CF_MEDIA_TRANS) || !switch_channel_test_flag(channel, CF_PROXY_MODE)) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,  "Operation is invalid\n");
                        switch_core_session_rwunlock(session);
@@ -1624,16 +1624,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_media(const char *uuid, switch_med
                /* If we had early media in bypass mode before, it is no longer relevant */
                if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
                        switch_core_session_message_t msg2 = { 0 };
-                               
+
                        msg2.message_id = SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS;
                        msg2.from = __FILE__;
                        switch_core_session_receive_message(session, &msg2);
                }
-                       
+
                if ((flags & SMF_REPLYONLY_A)) {
                        msg.numeric_arg = 1;
                }
-                       
+
                switch_channel_set_flag(channel, CF_3P_MEDIA_REQUESTED);
 
                if (switch_core_session_receive_message(session, &msg) != SWITCH_STATUS_SUCCESS) {
@@ -1666,10 +1666,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_media(const char *uuid, switch_med
 
                        other_channel = switch_core_session_get_channel(other_session);
                        switch_assert(other_channel != NULL);
-                               
+
                        switch_channel_set_flag(other_channel, CF_3P_MEDIA_REQUESTED);
                        switch_channel_set_variable(other_channel, "rtp_secure_media", "optional");
-                               
+
                        switch_core_session_receive_message(other_session, &msg);
                        switch_channel_wait_for_flag(other_channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
                        switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
@@ -1682,7 +1682,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_media(const char *uuid, switch_med
                if (other_channel) {
                        switch_channel_clear_state_handler(channel, NULL);
                }
-       
+
                switch_channel_clear_flag(channel, CF_MEDIA_TRANS);
                switch_core_session_rwunlock(session);
 
@@ -1715,7 +1715,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_media(const char *uuid, switch_media_
 
        if ((session = switch_core_session_locate(uuid))) {
                channel = switch_core_session_get_channel(session);
-               
+
                if (switch_channel_test_flag(channel, CF_MEDIA_TRANS)) {
                        switch_core_session_rwunlock(session);
                        return SWITCH_STATUS_INUSE;
@@ -1733,16 +1733,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_media(const char *uuid, switch_media_
                        /* If we had early media in bypass mode before, it is no longer relevant */
                        if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
                                switch_core_session_message_t msg2 = { 0 };
-                               
+
                                msg2.message_id = SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS;
                                msg2.from = __FILE__;
                                switch_core_session_receive_message(session, &msg2);
                        }
-                       
+
                        if ((flags & SMF_REPLYONLY_A)) {
                                msg.numeric_arg = 1;
                        }
-                                       
+
                        if (switch_core_session_receive_message(session, &msg) != SWITCH_STATUS_SUCCESS) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't re-establsh media on %s\n", switch_channel_get_name(channel));
                                switch_core_session_rwunlock(session);
@@ -1815,7 +1815,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_nomedia(const char *uuid, switch_m
        if ((session = switch_core_session_locate(uuid))) {
                status = SWITCH_STATUS_SUCCESS;
                channel = switch_core_session_get_channel(session);
-               
+
                if (switch_channel_test_flag(channel, CF_MEDIA_TRANS) || (!(flags & SMF_FORCE) && switch_channel_test_flag(channel, CF_PROXY_MODE))) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,  "Operation is invalid\n");
                        switch_core_session_rwunlock(session);
@@ -1832,10 +1832,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_nomedia(const char *uuid, switch_m
                        if ((flags & SMF_REBRIDGE) && (other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) &&
                                (other_session = switch_core_session_locate(other_uuid))) {
                                other_channel = switch_core_session_get_channel(other_session);
-               
+
                                switch_channel_set_flag(channel, CF_REDIRECT);
                                switch_channel_set_flag(channel, CF_RESET);
-                               
+
                                switch_channel_set_flag(other_channel, CF_RESET);
                                switch_channel_set_flag(other_channel, CF_REDIRECT);
 
@@ -1848,14 +1848,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_nomedia(const char *uuid, switch_m
                                }
 
                                switch_channel_set_state(other_channel, CS_PARK);
-                               
+
                                if (switch_core_session_in_thread(session)) {
                                        switch_yield(100000);
                                } else {
                                        switch_channel_wait_for_state(other_channel, channel, CS_PARK);
                                }
-                               
-                                       
+
+
                                if (!switch_core_session_in_thread(session)) {
                                        switch_channel_wait_for_state(channel, NULL, CS_PARK);
                                }
@@ -1899,7 +1899,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_nomedia(const char *uuid, switch_m
                switch_core_session_rwunlock(session);
        }
 
-       
+
 
        return status;
 }
@@ -1925,7 +1925,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
 
                if (switch_channel_test_flag(channel, CF_SECURE)) {
                        switch_core_session_rwunlock(session);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
                                                          "Cannot bypass %s due to secure connection.\n", switch_channel_get_name(channel));
                        return SWITCH_STATUS_FALSE;
                }
@@ -2059,7 +2059,7 @@ SWITCH_DECLARE(void) switch_ivr_bg_media(const char *uuid, switch_media_flag_t f
        td->obj = job;
        td->pool = pool;
        switch_thread_pool_launch_thread(&td);
-       
+
 }
 
 
@@ -2103,7 +2103,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
        switch_channel_set_variable(channel, SWITCH_TEMP_HOLD_MUSIC_VARIABLE, NULL);
 
        switch_channel_execute_on(channel, "execute_on_blind_transfer");
-       
+
        if ((profile = switch_channel_get_caller_profile(channel))) {
                const char *var;
 
@@ -2150,7 +2150,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
                /* Set CF_TRANSFER flag before hanging up bleg to avoid race condition */
                switch_channel_set_flag(channel, CF_TRANSFER);
 
-               /* If HANGUP_AFTER_BRIDGE is set to 'true', SWITCH_SIGNAL_BRIDGE_VARIABLE 
+               /* If HANGUP_AFTER_BRIDGE is set to 'true', SWITCH_SIGNAL_BRIDGE_VARIABLE
                 * will not have a value, so we need to check SWITCH_BRIDGE_VARIABLE */
 
                uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE);
@@ -2197,7 +2197,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
                                                  extension, use_context);
 
 
-               new_profile->transfer_source = switch_core_sprintf(new_profile->pool, "%ld:%s:bl_xfer:%s/%s/%s", 
+               new_profile->transfer_source = switch_core_sprintf(new_profile->pool, "%ld:%s:bl_xfer:%s/%s/%s",
                                                                                                                   (long) switch_epoch_time_now(NULL), new_profile->uuid_str,
                                                                                                                   extension, use_context, use_dialplan);
                switch_channel_add_variable_var_check(channel, SWITCH_TRANSFER_HISTORY_VARIABLE, new_profile->transfer_source, SWITCH_FALSE, SWITCH_STACK_PUSH);
@@ -2647,7 +2647,7 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_
        add_stat(x_in, stats->inbound.flaws, "flaw_total");
        add_stat_double(x_in, stats->inbound.R, "quality_percentage");
        add_stat_double(x_in, stats->inbound.mos, "mos");
-       
+
 
        if (stats->inbound.error_log) {
                switch_xml_t x_err_log, x_err;
@@ -2657,7 +2657,7 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_
                if (!(x_err_log = switch_xml_add_child_d(x_stat, "error-log", off++))) {
                        abort();
                }
-               
+
                for(ep = stats->inbound.error_log; ep; ep = ep->next) {
 
                        if (!(ep->start && ep->stop)) continue;
@@ -2697,7 +2697,7 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_
        add_stat(x_out, stats->outbound.cng_packet_count, "cng_packet_count");
        add_stat(x_out, stats->rtcp.packet_count, "rtcp_packet_count");
        add_stat(x_out, stats->rtcp.octet_count, "rtcp_octet_count");
-       
+
        return off;
 }
 
@@ -2708,7 +2708,7 @@ static int switch_ivr_set_xml_chan_var(switch_xml_t xml, const char *var, const
        switch_xml_t variable;
 
        if (!val) val = "";
-       
+
        if (!zstr(var) && ((variable = switch_xml_add_child_d(xml, var, off++)))) {
                if ((data = malloc(dlen))) {
                        memset(data, 0, dlen);
@@ -2717,9 +2717,9 @@ static int switch_ivr_set_xml_chan_var(switch_xml_t xml, const char *var, const
                        free(data);
                } else abort();
        }
-       
+
        return off;
-       
+
 }
 
 
@@ -2734,7 +2734,7 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_chan_vars(switch_xml_t xml, switch_channe
        for (; hi; hi = hi->next) {
                if (hi->idx) {
                        int i;
-                       
+
                        for (i = 0; i < hi->idx; i++) {
                                off = switch_ivr_set_xml_chan_var(xml, hi->name, hi->array[i], off);
                        }
@@ -3054,7 +3054,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
                        }
                        switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->last_hold);
                        switch_xml_set_txt_d(time_tag, tmp);
-                       
+
                        if (!(time_tag = switch_xml_add_child_d(x_times, "hold_accum_time", t_off++))) {
                                goto error;
                        }
@@ -3115,7 +3115,7 @@ static void switch_ivr_set_json_profile_data(cJSON *json, switch_caller_profile_
 
 #define add_jstat(_j, _i, _s)                                                                                  \
        switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_SIZE_T_FMT, _i); \
-       cJSON_AddItemToObject(_j, _s, cJSON_CreateNumber(_i))                           
+       cJSON_AddItemToObject(_j, _s, cJSON_CreateNumber(_i))
 
 SWITCH_DECLARE(void) switch_ivr_set_json_call_stats(cJSON *json, switch_core_session_t *session, switch_media_type_t type)
 {
@@ -3154,7 +3154,7 @@ SWITCH_DECLARE(void) switch_ivr_set_json_call_stats(cJSON *json, switch_core_ses
        add_jstat(j_in, stats->inbound.flaws, "flaw_total");
        add_jstat(j_in, stats->inbound.R, "quality_percentage");
        add_jstat(j_in, stats->inbound.mos, "mos");
-       
+
 
        if (stats->inbound.error_log) {
                cJSON *j_err_log, *j_err;
@@ -3241,7 +3241,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_json_cdr(switch_core_session
 
        switch_snprintf(tmp, sizeof(tmp), "%d", switch_channel_get_state(channel));
        cJSON_AddItemToObject(j_channel_data, "state_number", cJSON_CreateString((char *) tmp));
-       
+
        if ((f = switch_channel_get_flag_string(channel))) {
                cJSON_AddItemToObject(j_channel_data, "flags", cJSON_CreateString((char *) f));
                free(f);
@@ -3452,7 +3452,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_json_cdr(switch_core_session
        *json_cdr = cdr;
 
        return SWITCH_STATUS_SUCCESS;
-       
+
 }
 
 
@@ -3535,7 +3535,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3
                        packet.header.seq = htons(++seq);
                        packet.header.version = 2;
                }
-               
+
                if (switch_jb_get_packet(jb, (switch_rtp_packet_t *) &packet, &plen) == SWITCH_STATUS_SUCCESS) {
                        write_frame.data = packet.body;
                        write_frame.datalen = (uint32_t) plen - 12;
@@ -3583,7 +3583,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session,
                char *p;
                p = switch_core_session_strdup(session, module_name);
                module_name = p;
-               
+
                if ((p = strchr(module_name, ':'))) {
                        *p++ = '\0';
                        chan_lang = p;
@@ -3643,11 +3643,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session,
        if ((si = switch_loadable_module_get_say_interface(module_name))) {
                /* should go back and proto all the say mods to const.... */
                switch_say_args_t say_args = {0};
-               
+
                say_args.type = switch_ivr_get_say_type_by_name(say_type);
                say_args.method = switch_ivr_get_say_method_by_name(say_method);
                say_args.gender = switch_ivr_get_say_gender_by_name(say_gender);
-               
+
                status = si->say_function(session, (char *) tosay, &say_args, args);
        } else {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
@@ -3740,7 +3740,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *ses
        }
 
        if (channel) {
-               const char *p = switch_channel_get_variable(channel, "sound_prefix_enforced");  
+               const char *p = switch_channel_get_variable(channel, "sound_prefix_enforced");
                if (!switch_true(p)) {
                        save_path = switch_channel_get_variable(channel, "sound_prefix");
                        if (sound_path) {
@@ -3752,7 +3752,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *ses
        if ((si = switch_loadable_module_get_say_interface(module_name)) && si->say_string_function) {
                /* should go back and proto all the say mods to const.... */
                switch_say_args_t say_args = {0};
-               
+
                say_args.type = switch_ivr_get_say_type_by_name(say_type);
                say_args.method = switch_ivr_get_say_method_by_name(say_method);
                say_args.gender = switch_ivr_get_say_gender_by_name(say_gender);
@@ -3806,7 +3806,7 @@ static const char *get_prefixed_str(char *buffer, size_t buffer_size, const char
        return buffer;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_set_user_xml(switch_core_session_t *session, const char *prefix, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_set_user_xml(switch_core_session_t *session, const char *prefix,
                                                                                                                const char *user, const char *domain, switch_xml_t x_user)
 {
        switch_xml_t x_params, x_param;
@@ -3896,7 +3896,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_user_extended(switch_core_session
        }
 
        status = switch_ivr_set_user_xml(session, prefix, user, domain, x_user);
-       
+
        goto done;
 
   error:
@@ -3940,7 +3940,7 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_force_exists(const char *uuid)
 SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp)
 {
        if (zstr(cmd)) {
-               return SWITCH_STATUS_SUCCESS;   
+               return SWITCH_STATUS_SUCCESS;
        }
 
        if (fhp) {
@@ -3950,7 +3950,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
 
                if (!strncasecmp(cmd, "speed", 5)) {
                        char *p;
-               
+
                        if ((p = strchr(cmd, ':'))) {
                                p++;
                                if (*p == '+' || *p == '-') {
@@ -3970,7 +3970,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
 
                } else if (!strncasecmp(cmd, "volume", 6)) {
                        char *p;
-                       
+
                        if ((p = strchr(cmd, ':'))) {
                                p++;
                                if (*p == '+' || *p == '-') {
@@ -3985,11 +3985,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
                                }
                                return SWITCH_STATUS_SUCCESS;
                        }
-                       
+
                        if (fhp->vol) {
                                switch_normalize_volume(fhp->vol);
                        }
-                       
+
                        return SWITCH_STATUS_FALSE;
                } else if (!strcasecmp(cmd, "pause")) {
                        if (switch_test_flag(fhp, SWITCH_FILE_PAUSE)) {
@@ -4017,7 +4017,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
                        unsigned int pos = 0;
                        char *p;
                        //codec = switch_core_session_get_read_codec(session);
-                       
+
                        if ((p = strchr(cmd, ':'))) {
                                p++;
                                if (*p == '+' || *p == '-') {
@@ -4053,7 +4053,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
        }
 
        return SWITCH_STATUS_FALSE;
-       
+
 }
 
 #define START_SAMPLES 32768
@@ -4082,12 +4082,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_insert_file(switch_core_session_t *se
        } else {
                ext = "wav";
        }
-       
-       tmp_file = switch_core_session_sprintf(session, "%s%smsg_%s.%s", 
-                                                                                  SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str, ext);  
-       
+
+       tmp_file = switch_core_session_sprintf(session, "%s%smsg_%s.%s",
+                                                                                  SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str, ext);
+
        switch_core_session_get_read_impl(session, &read_impl);
-       
+
        new_fh.channels = read_impl.number_of_channels;
        new_fh.native_rate = read_impl.actual_samples_per_second;
 
@@ -4258,22 +4258,22 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name,
        for (x_domain = switch_xml_child(x_domains, "domain"); x_domain; x_domain = x_domain->next) {
                const char *dname = switch_xml_attr(x_domain, "name");
                if (!dname || (strcasecmp(dname, "*") && strcasecmp(domain_name, dname))) continue;
-               
+
                for (x_exten = switch_xml_child(x_domain, "exten"); x_exten; x_exten = x_exten->next) {
                        const char *regex = switch_xml_attr(x_exten, "regex");
                        const char *proto = switch_xml_attr(x_exten, "proto");
-                       
+
                        if (!zstr(regex) && !zstr(proto)) {
                                proceed = switch_regex_perform(exten_name, regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0]));
                                switch_regex_safe_free(re);
-                               
+
                                if (proceed) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Mapping %s@%s to proto %s matching expression [%s]\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Mapping %s@%s to proto %s matching expression [%s]\n",
                                                                          exten_name, domain_name, proto, regex);
                                        r = strdup(proto);
                                        goto end;
                                }
-                               
+
                        }
                }
        }
@@ -4286,7 +4286,7 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name,
        }
 
        return r;
-       
+
 }
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_call_cause_t cause)
@@ -4315,7 +4315,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_blind_transfer_ack(switch_core_sessio
                switch_channel_clear_flag(channel, CF_CONFIRM_BLIND_TRANSFER);
 
                if (!zstr(uuid) && (other_session = switch_core_session_locate(uuid))) {
-                       switch_core_session_message_t msg = { 0 };                      
+                       switch_core_session_message_t msg = { 0 };
                        msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE;
                        msg.from = __FILE__;
                        msg.numeric_arg = success;
index ceacdf88dc0bfa0b53629161e50427c04abd1a78..103effa5758bbbcf807f36243210a2d268662711 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Bret McDanel <bret AT 0xdecafbad dot com>
@@ -123,10 +123,10 @@ SWITCH_DECLARE(const char *) switch_ivr_dmachine_get_name(switch_ivr_dmachine_t
        return (const char *) dmachine->name;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p,
                                                                                                                   const char *name,
                                                                                                                   switch_memory_pool_t *pool,
-                                                                                                                  uint32_t digit_timeout_ms, 
+                                                                                                                  uint32_t digit_timeout_ms,
                                                                                                                   uint32_t input_timeout_ms,
                                                                                                                   switch_ivr_dmachine_callback_t match_callback,
                                                                                                                   switch_ivr_dmachine_callback_t nonmatch_callback,
@@ -148,9 +148,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t
        dmachine->match.dmachine = dmachine;
        dmachine->name = switch_core_strdup(dmachine->pool, name);
        switch_mutex_init(&dmachine->mutex, SWITCH_MUTEX_NESTED, dmachine->pool);
-       
+
        switch_core_hash_init(&dmachine->binding_hash);
-       
+
        if (match_callback) {
                dmachine->match_callback = match_callback;
        }
@@ -160,9 +160,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t
        }
 
        dmachine->user_data = user_data;
-       
+
        *dmachine_p = dmachine;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -182,11 +182,11 @@ SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachin
        switch_memory_pool_t *pool;
 
        if (!(dmachine && *dmachine)) return;
-       
+
        pool = (*dmachine)->pool;
 
        switch_core_hash_destroy(&(*dmachine)->binding_hash);
-       
+
        if ((*dmachine)->my_pool) {
                switch_core_destroy_memory_pool(&pool);
        }
@@ -218,7 +218,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_set_realm(switch_ivr_dmachin
        }
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Digit parser %s: Error Setting realm to '%s'\n", dmachine->name, realm);
-       
+
        return SWITCH_STATUS_FALSE;
 }
 
@@ -236,7 +236,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear_realm(switch_ivr_dmach
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Digit parser %s: Clearing realm '%s'\n", dmachine->name, realm);
 
        if (headp == dmachine->realm) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
                                                  "Digit parser %s: '%s' was the active realm, no realm currently selected.\n", dmachine->name, realm);
                dmachine->realm = NULL;
        }
@@ -246,10 +246,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear_realm(switch_ivr_dmach
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine,
                                                                                                                 const char *realm,
                                                                                                                 const char *digits,
-                                                                                                                switch_byte_t is_priority,                                                                                                              
+                                                                                                                switch_byte_t is_priority,
                                                                                                                 int32_t key,
                                                                                                                 switch_ivr_dmachine_callback_t callback,
                                                                                                                 void *user_data)
@@ -278,12 +278,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *
                        msg = "Reuse Existing ";
                        binding = ptr;
                        binding->callback = callback;
-                       binding->user_data = user_data; 
+                       binding->user_data = user_data;
                        goto done;
                }
        }
-       
-       
+
+
        binding = switch_core_alloc(dmachine->pool, sizeof(*binding));
 
        if (*digits == '~') {
@@ -311,19 +311,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *
                switch_ivr_dmachine_set_realm(dmachine, realm);
        }
 
-       if (binding->is_regex && dmachine->max_digit_len != DMACHINE_MAX_DIGIT_LEN -1) { 
+       if (binding->is_regex && dmachine->max_digit_len != DMACHINE_MAX_DIGIT_LEN -1) {
                dmachine->max_digit_len = DMACHINE_MAX_DIGIT_LEN -1;
        } else if (len > dmachine->max_digit_len) {
                dmachine->max_digit_len = (uint32_t) len;
        }
-       
+
  done:
 
        if (binding->is_regex) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%sDigit parser %s: binding %s/%s/%d callback: %p data: %p\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%sDigit parser %s: binding %s/%s/%d callback: %p data: %p\n",
                                                  msg, dmachine->name, digits, realm, key, (void *)(intptr_t) callback, user_data);
        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%sDigit parser %s: binding %s/%s/%d callback: %p data: %p\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%sDigit parser %s: binding %s/%s/%d callback: %p data: %p\n",
                                                  msg, dmachine->name, digits, realm, key, (void *)(intptr_t) callback, user_data);
        }
 
@@ -344,13 +344,13 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin
        dm_match_t best = DM_MATCH_NONE;
        switch_ivr_dmachine_binding_t *bp, *exact_bp = NULL, *partial_bp = NULL, *both_bp = NULL, *r_bp = NULL;
        int pmatches = 0, ematches = 0, rmatches = 0;
-       
+
        if (!dmachine->cur_digit_len || !dmachine->realm) goto end;
 
        for(bp = dmachine->realm->binding_list; bp; bp = bp->next) {
                if (bp->is_regex) {
                        switch_status_t r_status = switch_regex_match(dmachine->digits, bp->digits);
-                       
+
                        bp->rmatch = r_status == SWITCH_STATUS_SUCCESS;
 
                        rmatches++;
@@ -383,7 +383,7 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin
        for(bp = dmachine->realm->binding_list; bp; bp = bp->next) {
                if (bp->is_regex) {
                        if (bp->rmatch) {
-                               if ((bp->is_priority && ! ematches) || is_timeout || (bp == dmachine->realm->binding_list && !bp->next)) {                                      
+                               if ((bp->is_priority && ! ematches) || is_timeout || (bp == dmachine->realm->binding_list && !bp->next)) {
                                        best = DM_MATCH_EXACT;
                                        exact_bp = bp;
                                        break;
@@ -393,14 +393,14 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin
                } else {
                        int pmatch = !strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits));
 
-                       if (!exact_bp && pmatch && (!rmatches || bp->is_priority || is_timeout) && !strcmp(bp->digits, dmachine->digits)) {                             
+                       if (!exact_bp && pmatch && (!rmatches || bp->is_priority || is_timeout) && !strcmp(bp->digits, dmachine->digits)) {
                                best = DM_MATCH_EXACT;
                                exact_bp = bp;
-                               if (bp->is_priority || dmachine->cur_digit_len == dmachine->max_digit_len) break;                               
-                       } 
+                               if (bp->is_priority || dmachine->cur_digit_len == dmachine->max_digit_len) break;
+                       }
 
                        if (!(both_bp && partial_bp) && strlen(bp->digits) != strlen(dmachine->digits) && pmatch) {
-                               
+
                                if (exact_bp) {
                                        best = DM_MATCH_BOTH;
                                        both_bp = bp;
@@ -418,20 +418,20 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin
                best = DM_MATCH_NEVER;
        }
 
-       
+
  end:
 
        if (is_timeout) {
                if (both_bp) {
                        r_bp = exact_bp ? exact_bp : both_bp;
                }
-       } 
+       }
 
        if (best == DM_MATCH_EXACT && exact_bp) {
                r_bp = exact_bp;
        }
-       
-       
+
+
        if (r_bp) {
                dmachine->last_matching_binding = r_bp;
                switch_set_string(dmachine->last_matching_digits, dmachine->digits);
@@ -439,7 +439,7 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin
        }
 
        return best;
-       
+
 }
 
 static switch_bool_t switch_ivr_dmachine_check_timeout(switch_ivr_dmachine_t *dmachine)
@@ -484,7 +484,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
        if (is_match == DM_MATCH_NEVER) {
                is_timeout++;
        }
-       
+
        if (switch_mutex_trylock(dmachine->mutex) != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_SUCCESS;
        }
@@ -501,11 +501,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
                r = SWITCH_STATUS_FALSE;
        } else if (is_match == DM_MATCH_EXACT || (is_match == DM_MATCH_BOTH && is_timeout)) {
                r = SWITCH_STATUS_FOUND;
-               
+
                dmachine->match.match_digits = dmachine->last_matching_digits;
                dmachine->match.match_key = dmachine->last_matching_binding->key;
                dmachine->match.user_data = dmachine->last_matching_binding->user_data;
-               
+
                if (match_p) {
                        *match_p = &dmachine->match;
                }
@@ -513,10 +513,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
                dmachine->is_match = 1;
 
                dmachine->match.type = DM_MATCH_POSITIVE;
-               
+
                if (dmachine->last_matching_binding->callback) {
                        s = dmachine->last_matching_binding->callback(&dmachine->match);
-                       
+
                        switch(s) {
                        case SWITCH_STATUS_CONTINUE:
                                r = SWITCH_STATUS_SUCCESS;
@@ -554,13 +554,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
        } else {
                r = SWITCH_STATUS_SUCCESS;
        }
-       
+
        if (r != SWITCH_STATUS_FOUND && r != SWITCH_STATUS_SUCCESS && r != SWITCH_STATUS_BREAK) {
                switch_set_string(dmachine->last_failed_digits, dmachine->digits);
                dmachine->match.match_digits = dmachine->last_failed_digits;
-               
+
                dmachine->match.type = DM_MATCH_NEGATIVE;
-               
+
                if (dmachine->nonmatch_callback) {
                        dmachine->match.user_data = dmachine->user_data;
                        s = dmachine->nonmatch_callback(&dmachine->match);
@@ -577,10 +577,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
                        }
 
                }
-               
+
                clear++;
        }
-       
+
        if (clear) {
                switch_ivr_dmachine_clear(dmachine);
        }
@@ -598,7 +598,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t *
 {
        const char *p;
        switch_status_t status = SWITCH_STATUS_BREAK;
-       
+
        if (!zstr(digits)) {
                status = SWITCH_STATUS_SUCCESS;
        }
@@ -608,7 +608,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t *
                if (dmachine->cur_digit_len < dmachine->max_digit_len) {
                        switch_status_t istatus;
                        char *e = dmachine->digits + strlen(dmachine->digits);
-                       
+
                        *e++ = *p;
                        *e = '\0';
                        dmachine->cur_digit_len++;
@@ -623,7 +623,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t *
                        status = SWITCH_STATUS_FALSE;
                }
        }
-               
+
        return status;
 }
 
@@ -671,14 +671,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_echo(switch_core_session_t *s
                if (!SWITCH_READ_ACCEPTABLE(status)) {
                        break;
                }
-               
+
                switch_ivr_parse_all_events(session);
 
                if (args && (args->input_callback || args->buf || args->buflen)) {
                        switch_dtmf_t dtmf = {0};
 
                        /*
-                          dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+                          dtmf handler function you can hook up to be executed when a digit is dialed during playback
                           if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
                         */
                        if (switch_channel_has_dtmf(channel)) {
@@ -863,7 +863,7 @@ static switch_bool_t read_displace_callback(switch_media_bug_t *bug, void *user_
                                        switch_normalize_to_16bit(mixed);
                                        fp[x] = (int16_t) mixed;
                                }
-                               
+
                        } else {
                                st = switch_core_file_read(&dh->fh, rframe->data, &len);
                                rframe->samples = (uint32_t) len;
@@ -1160,7 +1160,7 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void *
                        switch_mutex_unlock(rh->buffer_mutex);
                        break;
                }
-               
+
                samples = switch_buffer_read(rh->thread_buffer, data, bsize) / 2 / channels;
                switch_mutex_unlock(rh->buffer_mutex);
 
@@ -1201,13 +1201,13 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                                switch_memory_pool_t *pool = switch_core_session_get_pool(session);
                                int sanity = 200;
 
-                               
+
                                switch_core_session_get_read_impl(session, &rh->read_impl);
                                switch_mutex_init(&rh->buffer_mutex, SWITCH_MUTEX_NESTED, pool);
                                switch_threadattr_create(&thd_attr, pool);
                                switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
                                switch_thread_create(&rh->thread, thd_attr, recording_thread, bug, pool);
-                               
+
                                while(--sanity > 0 && !rh->thread_ready) {
                                        switch_yield(10000);
                                }
@@ -1236,7 +1236,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
 
                        nframe = switch_core_media_bug_get_native_read_frame(bug);
                        len = nframe->datalen;
-                       
+
                        if (!rh->wready) {
                                unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
                                switch_size_t fill_len = len;
@@ -1244,15 +1244,15 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                                switch_core_gen_encoded_silence(fill_data, &rh->read_impl, len);
                                switch_core_file_write(&rh->out_fh, fill_data, &fill_len);
                        }
-                               
-                               
+
+
                        if (rh->last_read_time && rh->last_read_time < now) {
                                diff = (now - rh->last_read_time) / rh->read_impl.microseconds_per_packet;
-                               
+
                                if (diff > 3) {
                                        unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
                                        switch_core_gen_encoded_silence(fill_data, &rh->read_impl, len);
-                                       
+
                                        while(diff > 1) {
                                                switch_size_t fill_len = len;
                                                switch_core_file_write(&rh->in_fh, fill_data, &fill_len);
@@ -1271,7 +1271,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                        switch_time_t now = switch_time_now();
                        switch_time_t diff;
                        rh->wready = 1;
-                       
+
                        nframe = switch_core_media_bug_get_native_write_frame(bug);
                        len = nframe->datalen;
 
@@ -1283,15 +1283,15 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                        }
 
 
-                       
+
 
                        if (rh->last_write_time && rh->last_write_time < now) {
                                diff = (now - rh->last_write_time) / rh->read_impl.microseconds_per_packet;
-                               
+
                                if (diff > 3) {
                                        unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
                                        switch_core_gen_encoded_silence(fill_data, &rh->read_impl, len);
-                                       
+
                                        while(diff > 1) {
                                                switch_size_t fill_len = len;
                                                switch_core_file_write(&rh->out_fh, fill_data, &fill_len);
@@ -1299,7 +1299,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                                        }
                                }
                        }
-                       
+
                        switch_core_file_write(&rh->out_fh, mask ? null_data : nframe->data, &len);
                        rh->last_write_time = now;
                        rh->writes++;
@@ -1354,7 +1354,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                                        }
                                }
 
-                               
+
                                //if (switch_core_file_has_video(rh->fh, SWITCH_TRUE)) {
                                        //switch_core_media_set_video_file(session, NULL, SWITCH_RW_READ);
                                        //switch_channel_clear_flag_recursive(session->channel, CF_VIDEO_DECODED_READ);
@@ -1390,16 +1390,16 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                                        }
                                }
                        }
-                       
+
                        send_record_stop_event(channel, &read_impl, rh);
-                       
+
                        switch_channel_execute_on(channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE);
 
                        if ((var = switch_channel_get_variable(channel, SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE))) {
                                char *cmd = switch_core_session_strdup(session, var);
                                char *data, *expanded = NULL;
                                switch_stream_handle_t stream = { 0 };
-                               
+
                                SWITCH_STANDARD_STREAM(stream);
 
                                if ((data = strchr(cmd, ':'))) {
@@ -1440,7 +1440,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                                        break;
                                } else {
                                        len = (switch_size_t) frame.datalen / 2 / frame.channels;
-                                       
+
                                        if (rh->thread_buffer) {
                                                switch_mutex_lock(rh->buffer_mutex);
                                                switch_buffer_write(rh->thread_buffer, mask ? null_data : data, frame.datalen);
@@ -1455,9 +1455,9 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                                                }
                                                return SWITCH_FALSE;
                                        }
-                                       
+
                                        rh->writes++;
-                                       
+
                                        /* check for silence timeout */
                                        if (rh->silence_threshold) {
                                                switch_codec_implementation_t read_impl = { 0 };
@@ -1508,8 +1508,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
        case SWITCH_ABC_TYPE_STREAM_VIDEO_PING:
                if (rh->fh) {
                        if (!bug->video_ping_frame) break;
-                       
-                       if ((len || bug->video_ping_frame->img) && switch_core_file_write_video(rh->fh, bug->video_ping_frame) != SWITCH_STATUS_SUCCESS && 
+
+                       if ((len || bug->video_ping_frame->img) && switch_core_file_write_video(rh->fh, bug->video_ping_frame) != SWITCH_STATUS_SUCCESS &&
                                rh->hangup_on_error) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing video to %s\n", rh->file);
                                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -1536,7 +1536,7 @@ static switch_bool_t text_callback(switch_media_bug_t *bug, void *user_data, swi
        case SWITCH_ABC_TYPE_READ_TEXT:
                {
                        const char *text = switch_core_media_bug_get_text(bug);
-                       
+
 
                        if (!zstr(text)) {
                                switch_event_t *event = NULL;
@@ -1545,14 +1545,14 @@ static switch_bool_t text_callback(switch_media_bug_t *bug, void *user_data, swi
 
                                if (switch_event_create(&event, SWITCH_EVENT_TEXT) == SWITCH_STATUS_SUCCESS) {
                                        switch_event_add_body(event, text, SWITCH_VA_NONE);
-                                       
+
                                        if (switch_true(switch_core_get_variable("fire_text_events"))) {
                                                switch_event_t *clone = NULL;
 
                                                switch_event_dup(&clone, event);
                                                switch_event_fire(&clone);
                                        }
-                                       
+
                                        switch_core_session_queue_event(session, &event);
                                }
                        }
@@ -1636,7 +1636,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_sessi
        return SWITCH_STATUS_FALSE;
 }
 
-static void* switch_ivr_record_user_data_dup(switch_core_session_t *session, void *user_data) 
+static void* switch_ivr_record_user_data_dup(switch_core_session_t *session, void *user_data)
 {
        struct record_helper *rh = (struct record_helper *) user_data, *dup = NULL;
 
@@ -1659,7 +1659,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_recordings(switch_core_sessi
                switch_channel_set_variable(new_channel, SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE, var);
        }
        switch_channel_transfer_variable_prefix(orig_channel, new_channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE);
-       
+
        return switch_core_media_bug_transfer_callback(orig_session, new_session, record_callback, switch_ivr_record_user_data_dup);
 }
 
@@ -1689,7 +1689,7 @@ static switch_status_t video_eavesdrop_callback(switch_core_session_t *session,
                if (switch_core_media_bug_test_flag(bug, SMBF_SPY_VIDEO_STREAM)) {
                        switch_core_media_bug_push_spy_frame(bug, frame, SWITCH_RW_READ);
                }
-               
+
                if (switch_core_media_bug_test_flag(bug, SMBF_SPY_VIDEO_STREAM_BLEG)) {
                        switch_core_media_bug_push_spy_frame(bug, frame, SWITCH_RW_WRITE);
                }
@@ -1729,8 +1729,8 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data
        switch (type) {
        case SWITCH_ABC_TYPE_INIT:
 
-               if (switch_core_media_bug_test_flag(bug, SMBF_READ_VIDEO_STREAM) || 
-                       switch_core_media_bug_test_flag(bug, SMBF_WRITE_VIDEO_STREAM) || 
+               if (switch_core_media_bug_test_flag(bug, SMBF_READ_VIDEO_STREAM) ||
+                       switch_core_media_bug_test_flag(bug, SMBF_WRITE_VIDEO_STREAM) ||
                        switch_core_media_bug_test_flag(bug, SMBF_READ_VIDEO_PING)) {
                        switch_core_session_set_video_read_callback(ep->eavesdropper, video_eavesdrop_callback, (void *)bug);
                        switch_channel_set_flag_recursive(switch_core_session_get_channel(session), CF_VIDEO_DECODED_READ);
@@ -1741,8 +1741,8 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data
                        switch_channel_clear_flag_recursive(e_channel, CF_VIDEO_DECODED_READ);
                }
 
-               if (switch_core_media_bug_test_flag(bug, SMBF_READ_VIDEO_STREAM) || 
-                       switch_core_media_bug_test_flag(bug, SMBF_WRITE_VIDEO_STREAM) || 
+               if (switch_core_media_bug_test_flag(bug, SMBF_READ_VIDEO_STREAM) ||
+                       switch_core_media_bug_test_flag(bug, SMBF_WRITE_VIDEO_STREAM) ||
                        switch_core_media_bug_test_flag(bug, SMBF_READ_VIDEO_PING)) {
                        switch_core_session_set_video_read_callback(ep->eavesdropper, NULL, NULL);
                }
@@ -1775,10 +1775,10 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data
                                if (switch_buffer_inuse(ep->r_buffer) >= rframe->datalen) {
                                        uint32_t bytes;
                                        int channels = rframe->channels ? rframe->channels : 1;
-                                       
+
                                        switch_buffer_lock(ep->r_buffer);
                                        bytes = (uint32_t) switch_buffer_read(ep->r_buffer, ep->data, rframe->datalen);
-                                       
+
                                        rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *) ep->data, bytes / 2, channels) * 2 * channels;
                                        rframe->samples = rframe->datalen / 2;
 
@@ -1825,7 +1825,7 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data
                        if (!bug->video_ping_frame || !bug->video_ping_frame->img) {
                                break;
                        }
-                       
+
                        if (ep->eavesdropper && switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) {
                                if (switch_core_session_write_video_frame(ep->eavesdropper, bug->video_ping_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing video to %s\n", switch_core_session_get_name(ep->eavesdropper));
@@ -1886,7 +1886,7 @@ static void exec_cb(switch_media_bug_t *bug, void *user_data)
                switch_channel_t *a = switch_core_session_get_channel(ep->eavesdropper);
                switch_channel_t *b = switch_core_session_get_channel(data->caller);
 
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s telling %s to exec %s:%s\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s telling %s to exec %s:%s\n",
                                                  switch_channel_get_name(b), switch_channel_get_name(a), data->var, data->val);
 
                switch_core_session_execute_application(ep->eavesdropper, data->var, data->val);
@@ -1905,8 +1905,8 @@ static void display_exec_cb(switch_media_bug_t *bug, void *user_data)
                msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
                msg.string_array_arg[0] = data->var;
                msg.string_array_arg[1] = data->val;
-               
-               switch_core_session_receive_message(ep->eavesdropper, &msg);            
+
+               switch_core_session_receive_message(ep->eavesdropper, &msg);
        }
 }
 
@@ -2065,7 +2065,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                write_frame.data = buf;
                write_frame.buflen = sizeof(buf);
                write_frame.rate = codec.implementation->actual_samples_per_second;
-               
+
                /* Make sure that at least one leg is bridged, default to both */
                if (! (flags & (ED_BRIDGE_READ | ED_BRIDGE_WRITE))) {
                        flags |= ED_BRIDGE_READ | ED_BRIDGE_WRITE;
@@ -2095,8 +2095,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                        write_flags = SMBF_WRITE_STREAM | SMBF_WRITE_REPLACE;
                }
 
-               if (switch_channel_test_flag(session->channel, CF_VIDEO) && switch_channel_test_flag(tsession->channel, CF_VIDEO)) {                    
-                       if ((vval = switch_channel_get_variable(session->channel, "eavesdrop_show_listener_video"))) { 
+               if (switch_channel_test_flag(session->channel, CF_VIDEO) && switch_channel_test_flag(tsession->channel, CF_VIDEO)) {
+                       if ((vval = switch_channel_get_variable(session->channel, "eavesdrop_show_listener_video"))) {
                                if (switch_true(vval) || !strcasecmp(vval, "aleg") || !strcasecmp(vval, "bleg") || !strcasecmp(vval, "both")) {
                                        read_flags |= SMBF_SPY_VIDEO_STREAM;
                                }
@@ -2104,8 +2104,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                                        read_flags |= SMBF_SPY_VIDEO_STREAM_BLEG;
                                }
                        }
-                       
-                       if ((vval = switch_channel_get_variable(session->channel, "eavesdrop_concat_video")) && switch_true(vval)) { 
+
+                       if ((vval = switch_channel_get_variable(session->channel, "eavesdrop_concat_video")) && switch_true(vval)) {
                                read_flags |= SMBF_READ_VIDEO_STREAM;
                                read_flags |= SMBF_WRITE_VIDEO_STREAM;
                        } else {
@@ -2119,7 +2119,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                        read_flags &= ~SMBF_SPY_VIDEO_STREAM_BLEG;
                }
 
-               
+
                if (switch_core_media_bug_add(tsession, "eavesdrop", uuid,
                                                                          eavesdrop_callback, ep, 0,
                                                                          read_flags | write_flags | SMBF_READ_PING | SMBF_THREAD_LOCK | SMBF_NO_PAUSE,
@@ -2128,7 +2128,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                        goto end;
                }
 
-               if ((vval = switch_channel_get_variable(session->channel, "eavesdrop_video_spy_fmt"))) { 
+               if ((vval = switch_channel_get_variable(session->channel, "eavesdrop_video_spy_fmt"))) {
                        switch_media_bug_set_spy_fmt(bug, switch_media_bug_parse_spy_fmt(vval));
                }
 
@@ -2198,7 +2198,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                                fcommand = db;
                        }
 
-                       if (switch_core_media_bug_test_flag(bug, SMBF_READ_VIDEO_STREAM) || 
+                       if (switch_core_media_bug_test_flag(bug, SMBF_READ_VIDEO_STREAM) ||
                                switch_core_media_bug_test_flag(bug, SMBF_WRITE_VIDEO_STREAM)) {
                                vid_dual = 1;
                        }
@@ -2206,7 +2206,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                        if (vid_dual || switch_core_media_bug_test_flag(bug, SMBF_READ_VIDEO_PING)) {
                                vid_bug = 1;
                        }
-                       
+
                        if (fcommand) {
                                char *d;
                                for (d = fcommand; *d; d++) {
@@ -2308,8 +2308,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
 
                                        switch_core_session_get_read_impl(tsession, &tread_impl);
                                        switch_core_session_get_read_impl(session, &read_impl);
-                                               
-                                       if (tread_impl.number_of_channels != ep->tread_impl.number_of_channels || 
+
+                                       if (tread_impl.number_of_channels != ep->tread_impl.number_of_channels ||
                                                tread_impl.actual_samples_per_second != ep->tread_impl.actual_samples_per_second) {
                                                tchanged = 1;
                                        }
@@ -2318,12 +2318,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                                                read_impl.actual_samples_per_second != ep->read_impl.actual_samples_per_second) {
                                                changed = 1;
                                        }
-                                       
+
                                        if (changed || tchanged) {
 
                                                if (changed) {
-                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
-                                                                                         "SPYING CHANNEL CODEC CHANGE FROM %dhz@%dc to %dhz@%dc\n", 
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                                         "SPYING CHANNEL CODEC CHANGE FROM %dhz@%dc to %dhz@%dc\n",
                                                                                          ep->read_impl.actual_samples_per_second,
                                                                                          ep->read_impl.number_of_channels,
                                                                                          read_impl.actual_samples_per_second,
@@ -2331,21 +2331,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                                                }
 
                                                if (tchanged) {
-                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
-                                                                                         "SPYED CHANNEL CODEC CHANGE FROM %dhz@%dc to %dhz@%dc\n", 
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                                                         "SPYED CHANNEL CODEC CHANGE FROM %dhz@%dc to %dhz@%dc\n",
                                                                                          ep->tread_impl.actual_samples_per_second,
                                                                                          ep->tread_impl.number_of_channels,
                                                                                          tread_impl.actual_samples_per_second,
                                                                                          tread_impl.number_of_channels);
 
                                                        tlen = tread_impl.decoded_bytes_per_packet;
-                                                       
+
                                                        if (len > tlen) {
                                                                len = tlen;
                                                        }
-                                                       
+
                                                        switch_core_codec_destroy(&codec);
-                                                       
+
                                                        if (switch_core_codec_init(&codec,
                                                                                                           "L16",
                                                                                                           NULL,
@@ -2360,20 +2360,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                                                                goto end;
                                                        }
                                                }
-                                               
+
                                                ep->read_impl = read_impl;
                                                ep->tread_impl = tread_impl;
                                        }
-                                       
+
 
                                        if (ep->tread_impl.number_of_channels != ep->read_impl.number_of_channels) {
                                                uint32_t rlen = write_frame.datalen / 2 / ep->tread_impl.number_of_channels;
-                                               
+
                                                switch_mux_channels((int16_t *) write_frame.data, rlen, ep->tread_impl.number_of_channels, ep->read_impl.number_of_channels);
                                                write_frame.datalen = rlen * 2 * ep->read_impl.number_of_channels;
                                                write_frame.samples = write_frame.datalen / 2;
                                        }
-                                       
+
                                        if ((status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0)) != SWITCH_STATUS_SUCCESS) {
                                                break;
                                        }
@@ -2440,7 +2440,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
        char *file_path = NULL;
        char *ext;
        char *in_file = NULL, *out_file = NULL;
-       
+
        if ((p = switch_channel_get_variable(channel, "RECORD_HANGUP_ON_ERROR"))) {
                hangup_on_error = switch_true(p);
        }
@@ -2461,17 +2461,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
                if (switch_true(switch_channel_get_variable(channel, "RECORD_TOGGLE_ON_REPEAT"))) {
                        return switch_ivr_stop_record_session(session, file);
                }
-               
+
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Already recording [%s]\n", file);
                return SWITCH_STATUS_SUCCESS;
        }
 
-       
+
        if ((p = switch_channel_get_variable(channel, "RECORD_CHECK_BRIDGE")) && switch_true(p)) {
                switch_core_session_t *other_session;
                int exist = 0;
                switch_status_t rstatus = SWITCH_STATUS_SUCCESS;
-               
+
                if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
                        switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
                        if ((bug = switch_channel_get_private(other_channel, file))) {
@@ -2484,7 +2484,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
                        }
                        switch_core_session_rwunlock(other_session);
                }
-               
+
                if (exist) {
                        return rstatus;
                }
@@ -2552,7 +2552,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
 
        if ((vval = switch_channel_get_variable(channel, "enable_file_write_buffering"))) {
                int tmp = atoi(vval);
-               
+
                if (tmp > 0) {
                        fh->pre_buffer_datalen = tmp;
                } else if (switch_true(vval)) {
@@ -2563,7 +2563,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
                fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
        }
 
-       
+
        if (!switch_is_file_path(file)) {
                char *tfile = NULL;
                char *e;
@@ -2595,7 +2595,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
        if (file_path && !strstr(file_path, SWITCH_URL_SEPARATOR)) {
                char *p;
                char *path = switch_core_session_strdup(session, file_path);
-               
+
                if ((p = strrchr(path, *SWITCH_PATH_SEPARATOR))) {
                        *p = '\0';
 
@@ -2613,7 +2613,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
                        path = NULL;
                }
        }
-       
+
        rh = switch_core_session_alloc(session, sizeof(*rh));
 
        if ((ext = strrchr(file, '.'))) {
@@ -2635,8 +2635,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
                if (switch_core_file_has_video(fh, SWITCH_TRUE)) {
                        //switch_core_media_set_video_file(session, fh, SWITCH_RW_READ);
                        //switch_channel_set_flag_recursive(session->channel, CF_VIDEO_DECODED_READ);
-                       
-                       if ((vval = switch_channel_get_variable(channel, "record_concat_video")) && switch_true(vval)) { 
+
+                       if ((vval = switch_channel_get_variable(channel, "record_concat_video")) && switch_true(vval)) {
                                flags |= SMBF_READ_VIDEO_STREAM;
                                flags |= SMBF_WRITE_VIDEO_STREAM;
                        } else {
@@ -2789,7 +2789,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
 
        if ((p = switch_channel_get_variable(channel, "RECORD_PRE_BUFFER_FRAMES"))) {
                int tmp = atoi(p);
-               
+
                if (tmp > 0) {
                        switch_core_media_bug_set_pre_buffer_framecount(bug, tmp);
                }
@@ -3377,7 +3377,7 @@ static switch_status_t generate_on_dtmf(switch_core_session_t *session, const sw
 
                if (pvt) {
                        switch_mutex_lock(pvt->mutex);
-                       
+
                        if (pvt->ready) {
                                switch_dtmf_t *dt = NULL;
                                switch_zmalloc(dt, sizeof(*dt));
@@ -3400,9 +3400,9 @@ static switch_status_t generate_on_dtmf(switch_core_session_t *session, const sw
                                                        switch_event_fire(&event);
                                                }
                                        }
-                                       
+
                                        dt = NULL;
-                                       /* 
+                                       /*
                                           SWITCH_STATUS_FALSE indicates pretend there never was a DTMF
                                           since we will be generating it inband now.
                                         */
@@ -3460,12 +3460,12 @@ static switch_bool_t inband_dtmf_generate_callback(switch_media_bug_t *bug, void
                {
                        switch_size_t bytes;
                        void *pop;
-                       
+
                        if (pvt->skip) {
                                pvt->skip--;
                                return SWITCH_TRUE;
                        }
-                       
+
 
                        switch_mutex_lock(pvt->mutex);
 
@@ -3483,7 +3483,7 @@ static switch_bool_t inband_dtmf_generate_callback(switch_media_bug_t *bug, void
                        if (!switch_buffer_inuse(pvt->audio_buffer)) {
                                if (switch_queue_trypop(pvt->digit_queue, &pop) == SWITCH_STATUS_SUCCESS) {
                                        switch_dtmf_t *dtmf = (switch_dtmf_t *) pop;
-                                       
+
 
                                        if (dtmf->source != SWITCH_DTMF_INBAND_AUDIO) {
                                                char buf[2] = "";
@@ -3496,7 +3496,7 @@ static switch_bool_t inband_dtmf_generate_callback(switch_media_bug_t *bug, void
                                                                                  SWITCH_LOG_WARNING, "%s Truncating DTMF duration %d ms to %d ms\n",
                                                                                          switch_channel_get_name(switch_core_session_get_channel(pvt->session)), dtmf->duration / 8, duration);
                                                }
-                                               
+
 
                                                pvt->ts.duration = duration;
                                                teletone_run(&pvt->ts, buf);
@@ -3606,11 +3606,11 @@ typedef struct {
 } switch_tone_container_t;
 
 
-static void tone_detect_set_total_time(switch_tone_container_t *cont, int index) 
+static void tone_detect_set_total_time(switch_tone_container_t *cont, int index)
 {
        char *total_time = switch_mprintf("%d", (int)(switch_micro_time_now() - cont->list[index].start_time) / 1000);
 
-       switch_channel_set_variable_name_printf(switch_core_session_get_channel(cont->session), total_time, "tone_detect_%s_total_time", 
+       switch_channel_set_variable_name_printf(switch_core_session_get_channel(cont->session), total_time, "tone_detect_%s_total_time",
                                                                                        cont->list[index].key);
        switch_safe_free(total_time);
 }
@@ -3638,7 +3638,7 @@ static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch
                        switch_core_session_execute_application_async(cont->session, cont->list[i].app, cont->list[i].data);
                }
        }
-               
+
        return SWITCH_STATUS_SUCCESS;
 
 }
@@ -3661,7 +3661,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da
        case SWITCH_ABC_TYPE_READ_REPLACE:
        case SWITCH_ABC_TYPE_WRITE_REPLACE:
                {
-                       
+
                        if (type == SWITCH_ABC_TYPE_READ_REPLACE) {
                                frame = switch_core_media_bug_get_read_replace_frame(bug);
                        } else {
@@ -4064,7 +4064,7 @@ static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch
                        int ok = 0;
                        *digit = dtmf->digit;
                        dval = switch_dtmftoi(digit);
-                       
+
                        if (direction == SWITCH_DTMF_RECV && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_ALEG)) {
                                ok = 1;
                        } else if (direction == SWITCH_DTMF_SEND && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_BLEG)) {
@@ -4166,7 +4166,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unblock_dtmf_session(switch_core_sess
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
        uint8_t enabled = (uint8_t)(intptr_t)switch_channel_get_private(channel, SWITCH_BLOCK_DTMF_KEY);
-       
+
        if (enabled) {
                switch_channel_set_private(channel, SWITCH_BLOCK_DTMF_KEY, NULL);
        }
@@ -4235,7 +4235,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se
                        md->sr[SWITCH_DTMF_RECV].map[key].app = switch_core_session_strdup(session, app);
                        md->sr[SWITCH_DTMF_RECV].map[key].flags |= SMF_HOLD_BLEG;
                        md->sr[SWITCH_DTMF_RECV].map[key].bind_flags = bind_flags;
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound A-Leg: %c%c %s\n", meta, switch_itodtmf((char)key), app);
                }
                if ((bind_flags & SBF_DIAL_BLEG)) {
@@ -4323,11 +4323,11 @@ static switch_status_t play_and_detect_input_callback(switch_core_session_t *ses
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_session_t *session, 
-                                                                                                                                 const char *file, 
-                                                                                                                                 const char *mod_name, 
-                                                                                                                                 const char *grammar, 
-                                                                                                                                 char **result, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_session_t *session,
+                                                                                                                                 const char *file,
+                                                                                                                                 const char *mod_name,
+                                                                                                                                 const char *grammar,
+                                                                                                                                 char **result,
                                                                                                                                  uint32_t input_timeout,
                                                                                                                                  switch_input_args_t *args)
 {
@@ -4469,7 +4469,7 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj
 
                        if (status == SWITCH_STATUS_SUCCESS && switch_true(switch_channel_get_variable(channel, "asr_intercept_dtmf"))) {
                                const char *p;
-                               
+
                                if ((p = switch_stristr("<input>", xmlstr))) {
                                        p += 7;
                                }
@@ -4589,7 +4589,7 @@ static switch_bool_t speech_callback(switch_media_bug_t *bug, void *user_data, s
        case SWITCH_ABC_TYPE_INIT:
                {
                        switch_threadattr_t *thd_attr = NULL;
-                       
+
                        switch_threadattr_create(&thd_attr, sth->pool);
                        switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
                        switch_thread_create(&sth->thread, thd_attr, speech_thread, sth, sth->pool);
@@ -4606,7 +4606,7 @@ static switch_bool_t speech_callback(switch_media_bug_t *bug, void *user_data, s
                                        switch_mutex_unlock(sth->mutex);
                                }
                        }
-                       
+
                        switch_thread_join(&st, sth->thread);
 
                }
@@ -4708,7 +4708,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_cor
        return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_session_t *session, const char *name, const char *val) 
+SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_session_t *session, const char *name, const char *val)
 {
        struct speech_thread_handle *sth = switch_channel_get_private(switch_core_session_get_channel(session), SWITCH_SPEECH_KEY);
        switch_status_t status = SWITCH_STATUS_FALSE;
@@ -5176,10 +5176,10 @@ static switch_bool_t video_write_overlay_callback(switch_media_bug_t *bug, void
        overly_helper_t *oht = (overly_helper_t *) user_data;
        switch_core_session_t *session = switch_core_media_bug_get_session(bug);
        switch_channel_t *channel = switch_core_session_get_channel(session);
-       
+
        switch (type) {
        case SWITCH_ABC_TYPE_INIT:
-               {                       
+               {
                }
                break;
        case SWITCH_ABC_TYPE_CLOSE:
@@ -5225,7 +5225,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_video_write_overlay_session(swit
        return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_video_write_overlay_session(switch_core_session_t *session, const char *img_path, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_video_write_overlay_session(switch_core_session_t *session, const char *img_path,
                                                                                                                                           switch_img_position_t pos, uint8_t alpha)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -5261,7 +5261,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_video_write_overlay_session(switch_co
        }
 
        switch_channel_set_private(channel, "_video_write_overlay_bug_", bug);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
index a20afc6cf396adab8e35735185d78fd2efcae807..e229ee7a4418994ec764c594d9f7556cfd87792d 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
- * switch_ivr_bridge.c -- IVR Library 
+ * switch_ivr_bridge.c -- IVR Library
  *
  */
 
@@ -76,21 +76,21 @@ static void text_bridge_thread(switch_core_session_t *session, void *obj)
                        if (read_frame->data && read_frame->datalen && !switch_test_flag(read_frame, SFF_CNG)) {
                                switch_buffer_write(text_buffer, read_frame->data, read_frame->datalen);
                        }
-                       
+
                        inuse = switch_buffer_inuse(text_buffer);
 
                        if (inuse && (switch_channel_test_flag(channel, CF_TEXT_IDLE) || switch_test_flag(read_frame, SFF_TEXT_LINE_BREAK))) {
                                int bytes = 0;
-                               
+
                                if (inuse + 4 > text_framesize) {
                                        void *tmp = malloc(inuse + 1024);
 
                                        memcpy(tmp, text_framedata, text_framesize);
 
                                        switch_assert(tmp);
-                       
+
                                        text_framesize = inuse + 1024;
-                                       
+
                                        free(text_framedata);
                                        text_framedata = tmp;
                                }
@@ -106,17 +106,17 @@ static void text_bridge_thread(switch_core_session_t *session, void *obj)
                                                        text_framedata[x] = '\0';
                                                        bytes = strlen((char *)text_framedata);
                                                        break;
-                                               } 
+                                               }
                                        }
                                }
 
                                if (!bytes) continue;
 
-                               *(text_framedata + bytes) = '\r'; 
-                               *(text_framedata + bytes + 1) = '\n'; 
-                               *(text_framedata + bytes + 2) = '\0'; 
+                               *(text_framedata + bytes) = '\r';
+                               *(text_framedata + bytes + 1) = '\n';
+                               *(text_framedata + bytes + 2) = '\0';
                                bytes += 2;
-                               
+
                                frame.data = text_framedata;
                                frame.datalen = strlen((char *)frame.data);
                                read_frame = &frame;
@@ -126,7 +126,7 @@ static void text_bridge_thread(switch_core_session_t *session, void *obj)
                        }
 
                }
-               
+
                if (!switch_test_flag(read_frame, SFF_CNG)) {
                        switch_status_t tstatus = switch_core_session_write_text_frame(vh->session_b, read_frame, 0, 0);
 
@@ -190,7 +190,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
                                                }
                                        }
                                } else {
-                                       if (a_codec->implementation->impl_id != b_codec->implementation->impl_id || 
+                                       if (a_codec->implementation->impl_id != b_codec->implementation->impl_id ||
                                                switch_channel_test_flag(b_channel, CF_VIDEO_DECODED_READ)) {
                                                switch_channel_set_flag_recursive(channel, CF_VIDEO_DECODED_READ);
                                                set_decoded_read = 1;
@@ -207,19 +207,19 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
                        }
 
                        status = switch_core_session_read_video_frame(vh->session_a, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-                       
+
                        if (!SWITCH_READ_ACCEPTABLE(status)) {
                                switch_cond_next();
                                continue;
                        }
                }
-               
 
-               if (switch_test_flag(read_frame, SFF_CNG) || 
+
+               if (switch_test_flag(read_frame, SFF_CNG) ||
                        switch_channel_test_flag(channel, CF_LEG_HOLDING) || switch_channel_test_flag(b_channel, CF_VIDEO_READ_FILE_ATTACHED)) {
                        continue;
                }
-               
+
                if (switch_channel_media_up(b_channel)) {
                        if (switch_core_session_write_video_frame(vh->session_b, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
                                switch_cond_next();
@@ -276,7 +276,7 @@ static void send_display(switch_core_session_t *session, switch_core_session_t *
                if (!zstr(peer_caller_profile->caller_id_number)) {
                        number = peer_caller_profile->caller_id_number;
                } else {
-                       number = caller_profile->caller_id_number;              
+                       number = caller_profile->caller_id_number;
                }
 
                if (zstr(number)) {
@@ -291,7 +291,7 @@ static void send_display(switch_core_session_t *session, switch_core_session_t *
                }
        }
 
-       
+
        if (zstr(name)) {
                name = number;
        }
@@ -398,7 +398,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
        }
 
        inner_bridge = switch_channel_test_flag(chan_a, CF_INNER_BRIDGE);
-       
+
        if (!switch_channel_test_flag(chan_a, CF_ANSWERED) && (bridge_answer_timeout = switch_channel_get_variable(chan_a, "bridge_answer_timeout"))) {
                if ((answer_timeout = atoi(bridge_answer_timeout)) < 0) {
                        answer_timeout = 0;
@@ -554,7 +554,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
 
                if (switch_channel_test_flag(chan_a, CF_HAS_TEXT) && switch_channel_test_flag(chan_b, CF_HAS_TEXT) && !txt_launch) {
                        txt_launch++;
-                       
+
                        th.session_a = session_a;
                        th.session_b = session_b;
                        switch_core_media_start_engine_function(th.session_a, SWITCH_MEDIA_TYPE_TEXT, text_bridge_thread, &th);
@@ -584,7 +584,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
                        if (!played_banner && switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO) &&
                                switch_channel_test_flag(chan_a, CF_ANSWERED) && switch_channel_test_flag(chan_b, CF_ANSWERED) &&
                                ++banner_counter > 100 &&
-                               switch_channel_test_flag(chan_a, CF_VIDEO_READY) && switch_channel_test_flag(chan_b, CF_VIDEO_READY) && 
+                               switch_channel_test_flag(chan_a, CF_VIDEO_READY) && switch_channel_test_flag(chan_b, CF_VIDEO_READY) &&
                                switch_channel_test_flag(chan_a, CF_BRIDGE_ORIGINATOR) && banner_file) {
                                const char *b_banner_file = switch_channel_get_variable(chan_b, "video_pre_call_banner");
 
@@ -592,7 +592,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
                                        b_banner_file = switch_channel_get_variable(chan_a, "video_pre_call_banner_bleg");
                                }
 
-                               
+
                                switch_channel_clear_flag(chan_a, CF_VIDEO_PAUSE_READ);
                                switch_channel_clear_flag(chan_b, CF_VIDEO_PAUSE_READ);
 
@@ -604,13 +604,13 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
                                }
 
                                played_banner = 1;
-                               
+
                                switch_channel_clear_flag(chan_a, CF_AUDIO_PAUSE_READ);
                                switch_channel_clear_flag(chan_b, CF_AUDIO_PAUSE_READ);
                                switch_channel_clear_flag(chan_a, CF_AUDIO_PAUSE_WRITE);
                                switch_channel_clear_flag(chan_b, CF_AUDIO_PAUSE_WRITE);
                        }
-                       
+
 
 
                        if (!exec_check) {
@@ -621,15 +621,15 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
                                }
                                exec_check = 1;
                        }
-                       
+
                        if (exec_app) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Bridge execute app %s(%s)\n", 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Bridge execute app %s(%s)\n",
                                                                  switch_channel_get_name(chan_a), exec_app, exec_data);
 
                                switch_core_session_execute_application_async(session_a, exec_app, exec_data);
                                exec_app = exec_data = NULL;
                        }
-                       
+
                        if ((bypass_media_after_bridge || switch_channel_test_flag(chan_b, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED)
                                && switch_channel_test_flag(chan_b, CF_ANSWERED)) {
 
@@ -766,7 +766,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
                        switch_ivr_sleep(session_a, 5000, SWITCH_FALSE, NULL);
                        continue;
                }
-                       
+
 
                /* read audio from 1 channel and write it to the other */
                status = switch_core_session_read_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, stream_id);
@@ -775,7 +775,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
                        read_frame_count++;
                        if (switch_test_flag(read_frame, SFF_CNG)) {
                                if (silence_val) {
-                                       switch_generate_sln_silence((int16_t *) silence_frame.data, silence_frame.samples, 
+                                       switch_generate_sln_silence((int16_t *) silence_frame.data, silence_frame.samples,
                                                                                                read_impl.number_of_channels, silence_val);
                                        read_frame = &silence_frame;
                                } else if (!switch_channel_test_flag(chan_b, CF_ACCEPT_CNG)) {
@@ -881,12 +881,12 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
        switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
        switch_channel_clear_flag(chan_a, CF_BRIDGED);
-       
+
        if (switch_channel_test_flag(chan_a, CF_LEG_HOLDING) || switch_channel_test_flag(chan_a, CF_HANGUP_HELD)) {
                if (switch_channel_ready(chan_b) &&
                        switch_channel_get_state(chan_b) != CS_PARK && !data->other_leg_data->clean_exit && !switch_channel_test_flag(chan_b, CF_3P_NOMEDIA_REQUESTED)) {
                        const char *ext = switch_channel_get_variable(chan_a, "hold_hangup_xfer_exten");
-                       
+
                        switch_channel_stop_broadcast(chan_b);
 
                        if (zstr(ext)) {
@@ -961,7 +961,7 @@ static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *ses
        state = switch_channel_get_state(channel);
 
        if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) &&
-               !switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit && state != CS_PARK && state != CS_ROUTING && 
+               !switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit && state != CS_PARK && state != CS_ROUTING &&
                state == CS_EXCHANGE_MEDIA && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
 
                if (state < CS_HANGUP && switch_true(switch_channel_get_variable(channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
@@ -1088,7 +1088,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
                int max = 1000, loops = max;
 
                switch_channel_set_variable(channel, SWITCH_UUID_BRIDGE, NULL);
-               
+
                for (;;) {
                        state = switch_channel_get_state(other_channel);
                        running_state = switch_channel_get_running_state(other_channel);
@@ -1098,7 +1098,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
                        }
 
                        if (state < CS_HANGUP && state == running_state) {
-                               
+
                                if (--loops < 1) {
                                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                        switch_channel_hangup(other_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -1120,7 +1120,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
                        } else {
                                loops = max;
                        }
-                       
+
                        switch_yield(20000);
                }
 
@@ -1246,8 +1246,8 @@ static switch_status_t hanguphook(switch_core_session_t *session)
        msg->message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
        msg->from = __FILE__;
        msg->string_arg = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE);
-       switch_core_session_queue_message(session, msg);        
-       
+       switch_core_session_queue_message(session, msg);
+
        switch_core_event_hook_remove_state_change(session, hanguphook);
 
        return SWITCH_STATUS_SUCCESS;
@@ -1280,7 +1280,7 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session
 
        switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
        switch_channel_set_variable(channel, SWITCH_LAST_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
-       
+
        switch_channel_set_bridge_time(channel);
 
 
@@ -1303,9 +1303,9 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session
                }
        }
 
-       if ((dmachine[0] = switch_core_session_get_dmachine(session, DIGIT_TARGET_SELF)) || 
+       if ((dmachine[0] = switch_core_session_get_dmachine(session, DIGIT_TARGET_SELF)) ||
                (dmachine[1] = switch_core_session_get_dmachine(session, DIGIT_TARGET_PEER))) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                  "%s not hibernating due to active digit parser, semi-hibernation engaged.\n", switch_channel_get_name(channel));
 
                while(switch_channel_ready(channel) && switch_channel_get_state(channel) == CS_HIBERNATE) {
@@ -1321,7 +1321,7 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session
                        switch_ivr_parse_all_messages(session);
                }
        }
-       
+
 
        return SWITCH_STATUS_SUCCESS;
 }
@@ -1386,7 +1386,7 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
                                }
                        }
                }
-               
+
                if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
                        switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
                        if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
@@ -1434,7 +1434,7 @@ static void check_bridge_export(switch_channel_t *channel, switch_channel_t *pee
 
        originator_cp->callee_id_name = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_name);
        originator_cp->callee_id_number = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_number);
-       
+
 
        switch_channel_process_export(peer_channel, channel, NULL, SWITCH_BRIDGE_EXPORT_VARS_VARIABLE);
        switch_channel_process_export(channel, peer_channel, NULL, SWITCH_BRIDGE_EXPORT_VARS_VARIABLE);
@@ -1513,11 +1513,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
 static void abort_call(switch_channel_t *caller_channel, switch_channel_t *peer_channel)
 {
        switch_call_cause_t cause = switch_channel_get_cause(caller_channel);
-       
+
        if (!cause) {
                cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
        }
-       
+
        switch_channel_hangup(peer_channel, cause);
 }
 
@@ -1546,7 +1546,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
        }
 
        check_bridge_export(caller_channel, peer_channel);
-       
+
        switch_channel_set_flag_recursive(caller_channel, CF_MEDIA_BRIDGE_TTL);
        switch_channel_set_flag_recursive(peer_channel, CF_MEDIA_BRIDGE_TTL);
 
@@ -1582,7 +1582,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
        if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA) ||
                switch_channel_test_flag(peer_channel, CF_RING_READY)) {
                const char *app, *data;
-               
+
                if (!switch_channel_ready(caller_channel)) {
                        abort_call(caller_channel, peer_channel);
                        goto done;
@@ -1591,7 +1591,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
                switch_channel_set_state(peer_channel, CS_CONSUME_MEDIA);
 
                switch_channel_set_variable(peer_channel, "call_uuid", switch_core_session_get_uuid(session));
-               
+
                switch_channel_set_bridge_time(caller_channel);
                switch_channel_set_bridge_time(peer_channel);
 
@@ -1677,7 +1677,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
 
                        if ((app = switch_channel_get_variable(caller_channel, "bridge_pre_execute_aleg_app"))) {
                                switch_channel_set_variable(caller_channel, "bridge_pre_execute_app", app);
-                               
+
                                if ((data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_aleg_data"))) {
                                        switch_channel_set_variable(caller_channel, "bridge_pre_execute_data", data);
                                }
@@ -1689,9 +1689,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
                                if ((data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_bleg_data"))) {
                                        switch_channel_set_variable(peer_channel, "bridge_pre_execute_data", data);
                                }
-                               
+
                        }
-                       
+
                        switch_channel_set_private(peer_channel, "_bridge_", b_leg);
                        switch_channel_set_state(peer_channel, CS_EXCHANGE_MEDIA);
 
@@ -1725,13 +1725,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
                        if ((cause = switch_channel_get_cause(peer_channel))) {
                                switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE, switch_channel_cause2str(cause));
                        }
-                       
+
                        if (switch_channel_down_nosig(peer_channel)) {
                                switch_bool_t copy_xml_cdr = switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_XML_CDR_VARIABLE));
                                switch_bool_t copy_json_cdr = switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_JSON_CDR_VARIABLE));
 
                                if (copy_xml_cdr || copy_json_cdr) {
-                                       char *cdr_text = NULL;                                  
+                                       char *cdr_text = NULL;
 
                                        switch_channel_wait_for_state(peer_channel, caller_channel, CS_DESTROY);
 
@@ -1758,9 +1758,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
                                                switch_safe_free(cdr_text);
                                        }
                                }
-                                       
+
                        }
-                       
+
                        switch_core_session_rwunlock(peer_session);
 
                } else {
@@ -1810,15 +1810,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
                if (cause == SWITCH_CAUSE_NONE) {
                        cause = SWITCH_CAUSE_NORMAL_CLEARING;
                }
-               
+
                if (hup) {
                        explicit = !strcasecmp(hup, "explicit");
                }
-               
+
                if (cause && !switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
                        switch_channel_handle_cause(caller_channel, cause);
                }
-               
+
                if (explicit) {
                        if (switch_channel_test_flag(peer_channel, CF_INTERCEPTED)) {
                                switch_channel_set_flag(peer_channel, CF_INTERCEPT);
@@ -1830,7 +1830,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
                early = switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA);
 
                if ((state != CS_EXECUTE && state != CS_SOFT_EXECUTE && state != CS_PARK && state != CS_ROUTING) || ((answered || early) && state < CS_HANGUP)) {
-                       
+
                        if (!switch_channel_test_flag(caller_channel, CF_TRANSFER)) {
 
                                if ((answered && switch_true(switch_channel_get_variable(caller_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) ||
@@ -1869,7 +1869,7 @@ static void cleanup_proxy_mode_b(switch_core_session_t *session)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
 
-       if (switch_channel_test_flag(channel, CF_PROXY_MODE) && 
+       if (switch_channel_test_flag(channel, CF_PROXY_MODE) &&
                !switch_channel_test_flag(channel, CF_MEDIA_TRANS) && !switch_channel_test_flag(channel, CF_3P_MEDIA_REQUESTED)) {
                switch_ivr_media(switch_core_session_get_uuid(session), SMF_NONE);
        }
@@ -1882,12 +1882,12 @@ static void cleanup_proxy_mode_a(switch_core_session_t *session)
        switch_channel_t *channel = switch_core_session_get_channel(session);
        int done = 0;
 
-       if (!switch_channel_test_flag(channel, CF_3P_MEDIA_REQUESTED) && 
+       if (!switch_channel_test_flag(channel, CF_3P_MEDIA_REQUESTED) &&
                switch_channel_test_flag(channel, CF_PROXY_MODE) && !switch_channel_test_flag(channel, CF_3P_NOMEDIA_REQUESTED)) {
                if (switch_core_session_get_partner(session, &sbsession) == SWITCH_STATUS_SUCCESS) {
                        switch_channel_t *sbchannel = switch_core_session_get_channel(sbsession);
 
-                       if (switch_channel_test_flag(sbchannel, CF_PROXY_MODE)) {       
+                       if (switch_channel_test_flag(sbchannel, CF_PROXY_MODE)) {
                                /* Clear this now, otherwise will cause the one we're interested in to hang up too...*/
                                switch_channel_set_variable(sbchannel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
                                switch_channel_hangup(sbchannel, SWITCH_CAUSE_ATTENDED_TRANSFER);
@@ -1899,7 +1899,7 @@ static void cleanup_proxy_mode_a(switch_core_session_t *session)
        }
 
        if (done) return;
-       
+
        switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
        switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
        switch_channel_set_variable(channel, SWITCH_BRIDGE_UUID_VARIABLE, NULL);
@@ -1965,11 +1965,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
                        if (switch_channel_direction(originatee_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && switch_channel_test_flag(originatee_channel, CF_DIALPLAN)) {
                                switch_channel_clear_flag(originatee_channel, CF_DIALPLAN);
                        }
-                       
+
                        cleanup_proxy_mode_a(originator_session);
                        cleanup_proxy_mode_a(originatee_session);
 
-                       /* override transmit state for originator_channel to bridge to originatee_channel 
+                       /* override transmit state for originator_channel to bridge to originatee_channel
                         * install pointer to originatee_session into originator_channel
                         * set CF_TRANSFER on both channels and change state to CS_SOFT_EXECUTE to
                         * interrupt anything they are already doing.
@@ -1993,10 +1993,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
                        originatee_cp = switch_channel_get_caller_profile(originatee_channel);
 
 
-                       
+
                        if (switch_channel_outbound_display(originator_channel)) {
                                switch_channel_invert_cid(originator_channel);
-                               
+
                                if (switch_channel_direction(originator_channel) == SWITCH_CALL_DIRECTION_INBOUND) {
                                        switch_channel_clear_flag(originatee_channel, CF_BLEG);
                                }
@@ -2004,7 +2004,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
 
                        if (switch_channel_inbound_display(originatee_channel)) {
                                switch_channel_invert_cid(originatee_channel);
-                               
+
                                if (switch_channel_direction(originatee_channel) == SWITCH_CALL_DIRECTION_INBOUND) {
                                        switch_channel_set_flag(originatee_channel, CF_BLEG);
                                }
@@ -2043,7 +2043,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
 
                        switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
                        switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
-                       
+
                        originator_cp->callee_id_name = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_name);
                        originator_cp->callee_id_number = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_number);
 
@@ -2075,18 +2075,18 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
                        switch_channel_clear_flag(originatee_channel, CF_ORIGINATING);
 
 
-                       originator_cp->transfer_source = switch_core_sprintf(originator_cp->pool, 
-                                                                                                                                "%ld:%s:uuid_br:%s", (long)switch_epoch_time_now(NULL), originator_cp->uuid_str, 
+                       originator_cp->transfer_source = switch_core_sprintf(originator_cp->pool,
+                                                                                                                                "%ld:%s:uuid_br:%s", (long)switch_epoch_time_now(NULL), originator_cp->uuid_str,
                                                                                                                                 switch_core_session_get_uuid(originatee_session));
-                       switch_channel_add_variable_var_check(originator_channel, SWITCH_TRANSFER_HISTORY_VARIABLE, 
+                       switch_channel_add_variable_var_check(originator_channel, SWITCH_TRANSFER_HISTORY_VARIABLE,
                                                                                                  originator_cp->transfer_source, SWITCH_FALSE, SWITCH_STACK_PUSH);
                        switch_channel_set_variable(originator_channel, SWITCH_TRANSFER_SOURCE_VARIABLE, originator_cp->transfer_source);
 
-                       
+
                        originatee_cp->transfer_source = switch_core_sprintf(originatee_cp->pool,
-                                                                                                                                "%ld:%s:uuid_br:%s", (long)switch_epoch_time_now(NULL), originatee_cp->uuid_str, 
+                                                                                                                                "%ld:%s:uuid_br:%s", (long)switch_epoch_time_now(NULL), originatee_cp->uuid_str,
                                                                                                                                 switch_core_session_get_uuid(originator_session));
-                       switch_channel_add_variable_var_check(originatee_channel, SWITCH_TRANSFER_HISTORY_VARIABLE, 
+                       switch_channel_add_variable_var_check(originatee_channel, SWITCH_TRANSFER_HISTORY_VARIABLE,
                                                                                                  originatee_cp->transfer_source, SWITCH_FALSE, SWITCH_STACK_PUSH);
                        switch_channel_set_variable(originatee_channel, SWITCH_TRANSFER_SOURCE_VARIABLE, originatee_cp->transfer_source);
 
@@ -2144,7 +2144,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, c
                switch_channel_t *rchannel = switch_core_session_get_channel(rsession);
                const char *brto;
 
-               if ((brto = switch_channel_get_variable(rchannel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE)) || 
+               if ((brto = switch_channel_get_variable(rchannel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE)) ||
                        (brto = switch_channel_get_partner_uuid(rchannel))) {
                        switch_copy_string(b_uuid, brto, blen);
                        status = SWITCH_STATUS_SUCCESS;
@@ -2162,7 +2162,7 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session
        switch_channel_t *channel, *rchannel, *bchannel = NULL;
        const char *buuid, *var;
        char brto[SWITCH_UUID_FORMATTED_LENGTH + 1] = "";
-       
+
        if (bleg) {
                if (switch_ivr_find_bridged_uuid(uuid, brto, sizeof(brto)) == SWITCH_STATUS_SUCCESS) {
                        uuid = switch_core_session_strdup(session, brto);
index 69f6e0ace683705216925bec67609a6fe51ab045..ec0723031639774161563180f880b5a2d7a3e3ed 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Neal Horman <neal at wanlink dot com>
  *
@@ -292,7 +292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t
                }
 
                action->function = function;
-               
+
                if (menu->actions) {
                        for(ap = menu->actions; ap && ap->next; ap = ap->next);
                        ap->next = action;
@@ -432,15 +432,15 @@ static void exec_app(switch_core_session_t *session, char *app_str)
        char *app = switch_core_session_strdup(session, app_str);
        char *data = strchr(app, ' ');
        char *expanded = NULL;
-       
+
        if (data) {
                *data++ = '\0';
        }
-       
+
        expanded = switch_channel_expand_variables(channel, data);
-       
+
        switch_core_session_execute_application(session, app, expanded);
-       
+
        if (expanded && expanded != data) {
                free(expanded);
        }
@@ -490,7 +490,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
                char *digits_regex = switch_core_session_sprintf(session, "^%s$", menu->pin);
 
                if (switch_play_and_get_digits(session, (uint32_t)strlen(menu->pin), (uint32_t)strlen(menu->pin), 3, 3000, "#",
-                                                                          menu->prompt_pin_file, menu->bad_pin_file, NULL, digit_buffer, sizeof(digit_buffer), 
+                                                                          menu->prompt_pin_file, menu->bad_pin_file, NULL, digit_buffer, sizeof(digit_buffer),
                                                                           digits_regex, 10000, NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_goto_status(SWITCH_STATUS_FALSE, end);
                }
@@ -870,7 +870,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
                const char *pin = switch_xml_attr_soft(xml_menu, "pin");
                const char *prompt_pin_file = switch_xml_attr_soft(xml_menu, "pin-file");
                const char *bad_pin_file = switch_xml_attr_soft(xml_menu, "bad-pin-file");
-               
+
                switch_ivr_menu_t *menu = NULL;
 
                if (zstr(max_timeouts)) {
index b8f7cd9f31c246ae77d4718cfeef2f981b20c5cf..9f3f5d099f3874747aa8da5bbbef264a61aea4e1 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Travis Cross <tc@traviscross.com>
@@ -166,7 +166,7 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
        if (!strcasecmp(collect->key, "exec")) {
                char *data;
                char *app_name, *app_data;
-               
+
                if (!(data = collect->file)) {
                        goto wbreak;
                }
@@ -213,19 +213,19 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
                if (zstr(file)) {
                        file = "silence";
                }
-               
+
                status = switch_ivr_read(collect->session,
                                                                 (uint32_t)len,
                                                                 (uint32_t)len,
                                                                 collect->file, NULL, buf, sizeof(buf), collect->confirm_timeout, NULL, 0);
-               
-               
+
+
                if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK && status != SWITCH_STATUS_TOO_SMALL) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(collect->session), SWITCH_LOG_ERROR, "%s Error Playing File!\n",
                                                          switch_channel_get_name(channel));
                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                }
-               
+
                if (!strcmp(collect->key, buf)) {
                        switch_channel_set_flag(channel, CF_WINNER);
                        switch_channel_set_variable(channel, "group_dial_status", "winner");
@@ -404,7 +404,7 @@ static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_
                                switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui",
                                                                impl.iananame, impl.samples_per_second, (uint32_t)impl.microseconds_per_packet / 1000);
                        }
-               
+
                        if (ep && switch_stristr(impl.iananame, ep)) {
                                switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp);
                                switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n",
@@ -450,21 +450,21 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat
                if (originate_status[i].peer_channel && switch_channel_test_flag(originate_status[i].peer_channel, CF_CHANNEL_SWAP)) {
                        const char *key = switch_channel_get_variable(originate_status[i].peer_channel, "channel_swap_uuid");
                        switch_core_session_t *swap_session, *old_session;
-                       
+
                        if ((swap_session = switch_core_session_locate(key))) {
                                switch_channel_clear_flag(originate_status[i].peer_channel, CF_CHANNEL_SWAP);
                                switch_channel_hangup(originate_status[i].peer_channel, SWITCH_CAUSE_PICKED_OFF);
 
                                switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(originate_status[i].peer_channel), SWITCH_LOG_DEBUG, "Swapping %s for %s\n",
                                                                  switch_core_session_get_name(swap_session), switch_channel_get_name(originate_status[i].peer_channel));
-                               
-                               
+
+
                                old_session = originate_status[i].peer_session;
                                originate_status[i].peer_session = swap_session;
                                originate_status[i].peer_channel = switch_core_session_get_channel(originate_status[i].peer_session);
                                originate_status[i].caller_profile = switch_channel_get_caller_profile(originate_status[i].peer_channel);
                                switch_channel_set_flag(originate_status[i].peer_channel, CF_ORIGINATING);
-                               
+
                                switch_channel_answer(originate_status[i].peer_channel);
 
                                switch_channel_set_variable(originate_status[i].peer_channel, "picked_up_uuid", switch_core_session_get_uuid(old_session));
@@ -690,8 +690,8 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat
                                }
                        }
                }
-               
-               if (!switch_channel_test_flag(originate_status[i].peer_channel, CF_PARK) && 
+
+               if (!switch_channel_test_flag(originate_status[i].peer_channel, CF_PARK) &&
                        !switch_channel_test_flag(originate_status[i].peer_channel, CF_CONSUME_ON_ORIGINATE)) {
                        if (switch_core_session_messages_waiting(originate_status[i].peer_session)) {
                                if (switch_channel_test_flag(originate_status[i].peer_channel, CF_THREAD_SLEEPING)) {
@@ -793,7 +793,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat
 
        if (rval == 0 && pickups_without_timelimit) {
                for (i = 0; i < len; i++) {
-                       if (originate_status[i].peer_channel && switch_channel_test_flag(originate_status[i].peer_channel, CF_PICKUP) && 
+                       if (originate_status[i].peer_channel && switch_channel_test_flag(originate_status[i].peer_channel, CF_PICKUP) &&
                                switch_channel_up(originate_status[i].peer_channel)) {
                                switch_channel_hangup(originate_status[i].peer_channel, SWITCH_CAUSE_NO_PICKUP);
                        }
@@ -801,7 +801,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat
        }
 
 
-       if (pindex > -1 && caller_channel && switch_channel_ready(caller_channel) && !switch_channel_media_ready(caller_channel) && 
+       if (pindex > -1 && caller_channel && switch_channel_ready(caller_channel) && !switch_channel_media_ready(caller_channel) &&
                switch_channel_media_ready(originate_status[pindex].peer_channel)) {
                inherit_codec(caller_channel, originate_status[pindex].peer_session);
        }
@@ -839,7 +839,7 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map
                return -1;
        }
        wrote = teletone_mux_tones(ts, map);
-       
+
        if (tto->channels != 1) {
                if (tto->mux_buflen < wrote * 2 * tto->channels) {
                        tto->mux_buflen = wrote * 2 * tto->channels;
@@ -1097,7 +1097,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
                                        switch_core_file_seek(ringback.fh, &pos, 0, SEEK_SET);
                                        switch_core_file_read(ringback.fh, write_frame.data, &olen);
                                        if (olen == 0) {
-                                               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_ERROR, 
+                                               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_ERROR,
                                                                                  "Failure to read or re-read after seeking to beginning on file [%s]\n", ringback.fh->file_path);
                                                break;
                                        }
@@ -1111,7 +1111,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
                                }
                        } else if (ringback.silence) {
                                write_frame.datalen = write_frame.codec->implementation->decoded_bytes_per_packet;
-                               switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.datalen / 2, 
+                               switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.datalen / 2,
                                                                                        write_frame.codec->implementation->number_of_channels, ringback.silence);
                        }
 
@@ -1136,9 +1136,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
                switch_buffer_destroy(&ringback.audio_buffer);
        }
 
-       
+
        switch_ivr_parse_all_events(session);
-       
+
        switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 
        if (switch_core_codec_ready(&write_codec)) {
@@ -1213,8 +1213,8 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
 
        if (!switch_channel_test_flag(caller_channel, CF_ANSWERED)
                && !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
-               if (oglobals->bridge_early_media > -1  && len == 1 && originate_status[0].peer_session && 
-                       switch_channel_media_ready(originate_status[0].peer_channel)) {                         
+               if (oglobals->bridge_early_media > -1  && len == 1 && originate_status[0].peer_session &&
+                       switch_channel_media_ready(originate_status[0].peer_channel)) {
                        inherit_codec(caller_channel, originate_status[0].peer_session);
                }
                if ((status = switch_channel_pre_answer(caller_channel)) != SWITCH_STATUS_SUCCESS) {
@@ -1231,11 +1231,11 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
                        }
                } else if (oglobals->bridge_early_media > -1 && zstr(ringback_data) && len == 1 && originate_status[0].peer_session) {
                        switch_codec_implementation_t read_impl = { 0 }, write_impl = { 0 };
-                       
+
                        if (switch_channel_ready(originate_status[0].peer_channel)
                                && switch_core_session_get_read_impl(originate_status[0].peer_session, &read_impl) == SWITCH_STATUS_SUCCESS
                                && switch_core_session_get_write_impl(oglobals->session, &write_impl) == SWITCH_STATUS_SUCCESS) {
-                               if (read_impl.impl_id == write_impl.impl_id && 
+                               if (read_impl.impl_id == write_impl.impl_id &&
                                        read_impl.microseconds_per_packet == write_impl.microseconds_per_packet &&
                                        read_impl.actual_samples_per_second == write_impl.actual_samples_per_second) {
                                                ringback->asis++;
@@ -1244,7 +1244,7 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
                                                switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "bridge_early_media: passthrough enabled\n");
                                        } else {
                                                switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "bridge_early_media: codecs don't match (%s@%uh@%di / %s@%uh@%di)\n",
-                                                       read_impl.iananame, read_impl.actual_samples_per_second, read_impl.microseconds_per_packet / 1000, 
+                                                       read_impl.iananame, read_impl.actual_samples_per_second, read_impl.microseconds_per_packet / 1000,
                                                        write_impl.iananame, write_impl.actual_samples_per_second, write_impl.microseconds_per_packet / 1000);
                                        }
                        }
@@ -1465,7 +1465,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess
                                                                                                                                const char *cid_name_override,
                                                                                                                                const char *cid_num_override,
                                                                                                                                switch_caller_profile_t *caller_profile_override,
-                                                                                                                               switch_event_t *ovars, switch_originate_flag_t flags, 
+                                                                                                                               switch_event_t *ovars, switch_originate_flag_t flags,
                                                                                                                                switch_call_cause_t *cancel_cause)
 {
        int x_argc = 0;
@@ -1517,7 +1517,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess
        if (session) {
                switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "ent_originate_aleg_uuid", switch_core_session_get_uuid(session));
        }
-       
+
        if (channel) {
                const char *tmp_var = NULL;
 
@@ -1766,7 +1766,7 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *
        for (i = 0; i < MAX_PEERS && i < state->ttl; i++) {
                switch_core_session_t *session = state->originate_status[i].peer_session;
                switch_channel_t *channel = NULL;
-               
+
                if (session) channel = switch_core_session_get_channel(session);
 
                if (!session || !channel || !switch_channel_up(channel)) {
@@ -1796,7 +1796,7 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *
                        if (!session || !channel || !switch_channel_up(channel)) {
                                continue;
                        }
-                       
+
                        if (switch_channel_media_ready(channel)) {
                                ready++;
 
@@ -1805,7 +1805,7 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *
                                        state->oglobals->bridge_early_media = -1;
                                        state->oglobals->ignore_early_media = 1;
                                }
-                               
+
                                if (switch_channel_test_flag(channel, CF_ANSWERED)) {
                                        answered++;
                                }
@@ -1846,11 +1846,11 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *
                                }
                        }
                }
-       
+
                if (!ready || answered || ring_ready) {
                        break;
                }
-       
+
                if (!datalen) {
                        continue;
                }
@@ -1872,7 +1872,7 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *
        for (i = 0; i < MAX_PEERS && i < state->ttl; i++) {
                switch_core_session_t *session = originate_status[i].peer_session;
                switch_channel_t *channel = originate_status[i].peer_channel;
-               
+
                if (!session) continue;
 
                if (switch_core_codec_ready((&read_codecs[i]))) {
@@ -1978,8 +1978,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                        switch_channel_set_variable(caller_channel, "originate_causes", NULL);
                }
        }
-       
-       
+
+
        if (strstr(bridgeto, SWITCH_ENT_ORIGINATE_DELIM)) {
                return switch_ivr_enterprise_originate(session, bleg, cause, bridgeto, timelimit_sec, table, cid_name_override, cid_num_override,
                                                                                           caller_profile_override, ovars, flags, cancel_cause);
@@ -2052,14 +2052,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                if (!switch_channel_test_flag(caller_channel, CF_ANSWERED) && switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
                                        switch_channel_set_variable(caller_channel, SWITCH_B_SDP_VARIABLE, NULL);
                                        switch_channel_answer(caller_channel);
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
                                                                          "Must answer channel %s due to SIP PARADOX\n", switch_channel_get_name(caller_channel));
                                }
                                switch_channel_set_variable(caller_channel, SWITCH_B_SDP_VARIABLE, NULL);
                                switch_ivr_media(switch_core_session_get_uuid(session), SMF_NONE);
                        }
                }
-               
+
                if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                          "Channel is already up, delaying proxy mode 'till both legs are answered.\n");
@@ -2094,7 +2094,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
 
        /* Some channel are created from an originating channel and some aren't so not all outgoing calls have a way to get params
-          so we will normalize dialstring params and channel variables (when there is an originator) into an event that we 
+          so we will normalize dialstring params and channel variables (when there is an originator) into an event that we
           will use as a pseudo hash to consult for params as needed.
         */
 
@@ -2117,8 +2117,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                data++;
        }
 
-       if ((ovars && switch_true(switch_event_get_header(ovars,"origination_nested_vars"))) || 
-               (caller_channel && switch_true(switch_channel_get_variable(caller_channel, "origination_nested_vars"))) 
+       if ((ovars && switch_true(switch_event_get_header(ovars,"origination_nested_vars"))) ||
+               (caller_channel && switch_true(switch_channel_get_variable(caller_channel, "origination_nested_vars")))
                || switch_true(switch_core_get_variable("origination_nested_vars")) || switch_stristr("origination_nested_vars=true", data)) {
                oglobals.check_vars = SWITCH_FALSE;
        }
@@ -2134,7 +2134,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n");
                                switch_goto_status(SWITCH_STATUS_GENERR, done);
                        }
-                       
+
                        data = parsed;
                }
        }
@@ -2152,7 +2152,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                data = parsed;
        }
 
-       
+
        /* strip leading spaces (again) */
        while (data && *data && *data == ' ') {
                data++;
@@ -2173,7 +2173,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                        }
                }
        }
-       
+
        if (oglobals.session) {
                switch_event_header_t *hi;
                const char *cdr_total_var;
@@ -2313,7 +2313,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                }
        }
        /* When using the AND operator, the fail_on_single_reject flag may be set in order to indicate that a single
-          rejections should terminate the attempt rather than a timeout, answer, or rejection by all. 
+          rejections should terminate the attempt rather than a timeout, answer, or rejection by all.
           If the value is set to 'true' any fail cause will end the attempt otherwise it can contain a comma (,) separated
           list of cause names which should be considered fatal
         */
@@ -2494,7 +2494,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
        if (cid_num_override) {
                dftflags |= SOF_NO_EFFECTIVE_CID_NUM;
        }
-       
+
        if (cid_name_override) {
                dftflags |= SOF_NO_EFFECTIVE_CID_NAME;
        }
@@ -2580,7 +2580,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                        oglobals.sent_ring = 0;
                        oglobals.progress = 0;
                        myflags = dftflags;
-                       
+
 
                        if (try > 0) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Originate attempt %d/%d in %d ms\n", try + 1, retries,
@@ -2604,7 +2604,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                        }
 
                        p = pipe_names[r];
-                       
+
                        while (p && *p) {
                                if (*p == '[') {
                                        end = switch_find_end_paren(p, '[', ']');
@@ -2615,13 +2615,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        }
                                        q = 0;
                                }
-                               
+
                                if (*p == '\'') {
                                        q = !q;
                                }
 
                                if (end && p < end && *p == ',' && *(p-1) != '\\') {
-                                       
+
                                        if (q || alt) {
                                                *p = QUOTED_ESC_COMMA;
                                        } else {
@@ -2648,17 +2648,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                switch_event_t *local_var_event = NULL, *originate_var_event = NULL;
 
                                end = NULL;
-                               
+
                                chan_type = peer_names[i];
-                               
+
 
                                /* strip leading spaces */
                                while (chan_type && *chan_type && *chan_type == ' ') {
                                        chan_type++;
                                }
-                               
+
                                /* extract channel variables, allowing multiple sets of braces */
-                               
+
                                if (*chan_type == '[') {
                                        switch_event_create_plain(&local_var_event, SWITCH_EVENT_CHANNEL_DATA);
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Parsing session specific variables\n");
@@ -2666,34 +2666,34 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
                                while (*chan_type == '[') {
                                        char *parsed = NULL;
-                                       char *bend = switch_find_end_paren(chan_type, '[', ']');                                        
+                                       char *bend = switch_find_end_paren(chan_type, '[', ']');
 
                                        for (p = chan_type + 1; p && p < bend && *p; p++) {
                                                if (*p == QUOTED_ESC_COMMA) {
                                                        *p = ',';
                                                }
-                                       }                                       
-                                       
-                                       if (switch_event_create_brackets(chan_type, '[', ']', UNQUOTED_ESC_COMMA, 
+                                       }
+
+                                       if (switch_event_create_brackets(chan_type, '[', ']', UNQUOTED_ESC_COMMA,
                                                                                                         &local_var_event, &parsed, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS || !parsed) {
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n");
                                                switch_goto_status(SWITCH_STATUS_GENERR, done);
                                        }
-                               
+
                                        if (chan_type == parsed) {
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n");
-                                               switch_goto_status(SWITCH_STATUS_GENERR, done);                                         
+                                               switch_goto_status(SWITCH_STATUS_GENERR, done);
                                        } else {
                                                chan_type = parsed;
                                        }
                                }
-                               
-                               
+
+
                                /* strip leading spaces (again) */
                                while (chan_type && *chan_type && *chan_type == ' ') {
                                        chan_type++;
                                }
-                               
+
                                if ((chan_data = strchr(chan_type, '/')) != 0) {
                                        *chan_data = '\0';
                                        chan_data++;
@@ -2704,7 +2704,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                status = SWITCH_STATUS_FALSE;
                                                goto done;
                                        }
-                                       
+
                                        if ((caller_caller_profile = oglobals.caller_profile_override)) {
                                                new_profile = switch_caller_profile_dup(oglobals.pool, caller_caller_profile);
                                        } else {
@@ -2766,8 +2766,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
                                if (and_argc > 1 || or_argc > 1) {
                                        myflags |= SOF_FORKED_DIAL;
-                               } 
-                               
+                               }
+
                                if (var_event) {
                                        const char *vvar;
                                        if ((vvar = switch_event_get_header(var_event, "forked_dial")) && switch_true(vvar)) {
@@ -2778,13 +2778,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        }
                                }
 
-                               
+
                                /* Valid in both {} and [] with [] taking precedence */
 
-                               /* make a special var event with mixture of the {} and the [] vars to pass down as global vars to the outgoing channel 
+                               /* make a special var event with mixture of the {} and the [] vars to pass down as global vars to the outgoing channel
                                   so if something like the user channel does another originate our options will be passed down properly
                                 */
-                               
+
                                switch_event_dup(&originate_var_event, var_event);
 
                                if (local_var_event) {
@@ -2826,7 +2826,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                switch_set_flag(new_profile, SWITCH_CPF_HIDE_NUMBER);
                                        }
                                }
-                               
+
                                switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "originate_early_media", oglobals.early_ok ? "true" : "false");
 
 
@@ -2836,8 +2836,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        new_name = switch_core_session_sprintf(session, "_%s", switch_channel_get_name(caller_channel));
                                        switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "sip_h_X-FS-Channel-Name", new_name);
                                }
-                               
-                               
+
+
                                reason = switch_core_session_outgoing_channel(oglobals.session, originate_var_event, chan_type,
                                                                                                                          new_profile, &new_session, NULL, myflags, cancel_cause);
                                switch_event_destroy(&originate_var_event);
@@ -2846,7 +2846,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Cannot create outgoing channel of type [%s] cause: [%s]\n",
                                                                          chan_type, switch_channel_cause2str(reason));
                                        if (local_var_event) switch_event_destroy(&local_var_event);
-                                       
+
                                        if (fail_on_single_reject_var) {
                                                const char *cause_str = switch_channel_cause2str(reason);
                                                int neg = *fail_on_single_reject_var == '!';
@@ -2878,11 +2878,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                originate_status[i].peer_session = new_session;
 
                                switch_channel_set_flag(originate_status[i].peer_channel, CF_ORIGINATING);
-                               
+
                                if (caller_channel) {
                                        switch_channel_set_variable(originate_status[i].peer_channel, "call_uuid", switch_channel_get_variable(caller_channel, "call_uuid"));
                                }
-                               
+
 
                                if (local_var_event) {
                                        const char *device_id = switch_event_get_header(local_var_event, "device_id");
@@ -2938,7 +2938,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        if (switch_true(switch_channel_get_variable(originate_status[i].peer_channel, "leg_required"))) {
                                                originate_status[i].tagged = 1;
                                        }
-                                       
+
                                        if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "origination_channel_name"))) {
                                                switch_channel_set_name(originate_status[i].peer_channel, vvar);
                                        }
@@ -2953,14 +2953,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
                                        if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "leg_timeout"))) {
                                                int val = atoi(vvar);
-                                               
+
                                                if (val > 0) {
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Setting leg timeout to %d\n",
                                                                                          switch_channel_get_name(originate_status[i].peer_channel), val);
                                                        originate_status[i].per_channel_timelimit_sec = (uint32_t) val;
                                                }
                                        }
-                                       
+
                                        if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "leg_progress_timeout"))) {
                                                int val = atoi(vvar);
                                                if (val > 0) {
@@ -2994,32 +2994,32 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
                                        if (a_session) {
                                                switch_channel_t *channel = switch_core_session_get_channel(a_session);
-                                               char *val = 
-                                                       switch_core_session_sprintf(a_session, "%s;%s;%s", 
+                                               char *val =
+                                                       switch_core_session_sprintf(a_session, "%s;%s;%s",
                                                                                                                switch_core_session_get_uuid(originate_status[i].peer_session),
                                                                                                                switch_str_nil(switch_channel_get_variable(originate_status[i].peer_channel, "callee_id_name")),
                                                                                                                switch_str_nil(switch_channel_get_variable(originate_status[i].peer_channel, "callee_id_number")));
-                                               
+
 
                                                switch_channel_set_variable(originate_status[i].peer_channel, "originating_leg_uuid", switch_core_session_get_uuid(a_session));
-                                               
+
                                                switch_channel_add_variable_var_check(channel, "originated_legs", val, SWITCH_FALSE, SWITCH_STACK_PUSH);
-                                                                                                                         
+
                                        }
 
                                        if (l_session) {
                                                switch_core_session_rwunlock(l_session);
                                                l_session = NULL;
                                        }
-                                       
+
                                        switch_channel_execute_on(originate_status[i].peer_channel, SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE);
                                        switch_channel_api_on(originate_status[i].peer_channel, SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE);
                                }
-                               
+
                                if (table) {
                                        switch_channel_add_state_handler(originate_status[i].peer_channel, table);
                                }
-                               
+
                                if (oglobals.monitor_early_media_ring || oglobals.monitor_early_media_fail || oglobals.ignore_early_media == 4) {
                                        switch_channel_set_flag(originate_status[i].peer_channel, CF_CONSUME_ON_ORIGINATE);
                                }
@@ -3032,7 +3032,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        *cause = SWITCH_CAUSE_SUCCESS;
                                        goto outer_for;
                                }
-                               
+
                                if (!switch_core_session_running(originate_status[i].peer_session)) {
                                        if (originate_status[i].per_channel_delay_start) {
                                                switch_channel_set_flag(originate_status[i].peer_channel, CF_BLOCK_STATE);
@@ -3130,7 +3130,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                        while ((!caller_channel || switch_channel_ready(caller_channel) || switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) &&
                                   check_channel_status(&oglobals, originate_status, and_argc, &force_reason)) {
                                time_t elapsed = switch_epoch_time_now(NULL) - start;
-                               
+
                                read_packet = 0;
 
                                if (cancel_cause && *cancel_cause > 0) {
@@ -3154,7 +3154,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        }
                                        goto notready;
                                }
-                               
+
                                if ((to = (uint8_t) (elapsed >= (time_t) timelimit_sec)) || (fail_on_single_reject && oglobals.hups)) {
                                        int ok = 0;
 
@@ -3165,7 +3165,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                        for (i = 0; i < and_argc; i++) {
                                                                switch_channel_t *pchannel;
                                                                const char *cause_str;
-                                                               
+
                                                                if (!originate_status[i].peer_session) {
                                                                        continue;
                                                                }
@@ -3180,7 +3180,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                                        if (neg) {
                                                                                pos = !pos;
                                                                        }
-                                                                       
+
                                                                        if (pos) {
                                                                                ok = 0;
                                                                                break;
@@ -3243,7 +3243,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                        switch_status_t rst;
 
                                                        rst = setup_ringback(&oglobals, originate_status, and_argc, ringback_data, &ringback, &write_frame, &write_codec);
-                                                       
+
                                                        if (oglobals.bridge_early_media > -1) {
                                                                switch_threadattr_t *thd_attr = NULL;
                                                                switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session));
@@ -3280,7 +3280,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                        goto do_continue;
                                                }
 
-                                               if (oglobals.bridge_early_media > -1) {                                                 
+                                               if (oglobals.bridge_early_media > -1) {
                                                        write_frame.datalen = 0;
                                                        switch_mutex_lock(early_state.mutex);
                                                        if (ringback.asis) {
@@ -3367,7 +3367,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                }
                                        }
 
-                               } 
+                               }
 
                        do_continue:
 
@@ -3553,7 +3553,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
                                if (i != oglobals.idx) {
                                        holding = NULL;
-                                       
+
                                        if (oglobals.idx == IDX_TIMEOUT || to) {
                                                reason = SWITCH_CAUSE_NO_ANSWER;
                                        } else {
@@ -3583,7 +3583,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
                                                        if ((holding_session = switch_core_session_locate(holding))) {
                                                                switch_channel_t *holding_channel = switch_core_session_get_channel(holding_session);
-                                                               
+
                                                                switch_channel_set_variable(holding_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, "true");
 
                                                                if (caller_channel && switch_true(switch_channel_get_variable(caller_channel, "recording_follow_transfer"))) {
@@ -3593,7 +3593,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                                if (switch_true(switch_channel_get_variable(holding_channel, "recording_follow_transfer"))) {
                                                                        switch_core_media_bug_transfer_recordings(holding_session, originate_status[i].peer_session);
                                                                }
-                                                               
+
                                                                switch_core_session_rwunlock(holding_session);
                                                        }
                                                        switch_channel_set_flag(originate_status[i].peer_channel, CF_LAZY_ATTENDED_TRANSFER);
@@ -3804,12 +3804,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                        }
 
                                                        wait_for_cause(originate_status[i].peer_channel);
-                                                       
+
                                                        if (switch_channel_down_nosig(originate_status[i].peer_channel)) {
                                                                *cause = switch_channel_get_cause(originate_status[i].peer_channel);
                                                                break;
                                                        }
-                                                       
+
                                                }
                                        }
                                }
@@ -3894,17 +3894,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                        for (i = 0; i < and_argc; i++) {
                                switch_channel_state_t state;
                                switch_core_session_t *peer_session;
-                               char *val;                                                      
+                               char *val;
 
                                if (!originate_status[i].peer_channel) {
                                        continue;
                                }
-                               
+
                                if (session) {
-                                       val = switch_core_session_sprintf(originate_status[i].peer_session, "%s;%s", 
-                                                                                                         switch_core_session_get_uuid(originate_status[i].peer_session), 
+                                       val = switch_core_session_sprintf(originate_status[i].peer_session, "%s;%s",
+                                                                                                         switch_core_session_get_uuid(originate_status[i].peer_session),
                                                                                                          switch_channel_cause2str(switch_channel_get_cause(originate_status[i].peer_channel)));
-                                       
+
                                        switch_channel_add_variable_var_check(switch_core_session_get_channel(session), "originate_causes", val, SWITCH_FALSE, SWITCH_STACK_PUSH);
                                }
 
@@ -3930,7 +3930,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                originate_status[i].down_session = originate_status[i].peer_session;
                                originate_status[i].peer_session = NULL;
                                originate_status[i].peer_channel = NULL;
-                               
+
                                switch_core_session_rwunlock(peer_session);
                        }
 
@@ -3943,17 +3943,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        for (i = 0; i < and_argc; i++) {
                                                switch_channel_t *pchannel;
                                                const char *cause_str;
-                                                       
+
                                                if (!originate_status[i].down_session) {
                                                        continue;
                                                }
-                                                       
+
                                                pchannel = switch_core_session_get_channel(originate_status[i].down_session);
                                                wait_for_cause(pchannel);
 
                                                if (switch_channel_down_nosig(pchannel)) {
                                                        int neg, pos;
-                                                               
+
                                                        cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
 
                                                        neg = *fail_on_single_reject_var == '!';
@@ -3961,8 +3961,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
                                                        if (neg) {
                                                                pos = !pos;
-                                                       }                                                                                               
-                                                               
+                                                       }
+
                                                        if (pos) {
                                                                ok = 0;
                                                                break;
@@ -3970,7 +3970,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                }
                                        }
                                }
-                               
+
                                if (!ok) {
                                        goto outer_for;
                                }
@@ -4011,7 +4011,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                        // Now main SWITCH_SIGNAL_BOND_VARIABLE is populated, don't need this one anymore...
                        switch_channel_set_variable(caller_channel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE, NULL);
                }
-               
+
 
                switch_channel_execute_on(bchan, SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE);
                switch_channel_api_on(bchan, SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE);
index db5873c04344a36706214c68c4ac5798c033adc8..d4f0d46c80b41149d960f2cee58f1e88e2c5f4e7 100644 (file)
@@ -437,7 +437,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
 
                        if (*file == '{') {
                                tfile = switch_core_session_strdup(session, file);
-                               
+
                                while (*file == '{') {
                                        if ((e = switch_find_end_paren(tfile, '{', '}'))) {
                                                *e = '\0';
@@ -449,7 +449,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                                        }
                                }
                        }
-                       
+
                        file = switch_core_session_sprintf(session, "%s%s%s%s%s", switch_str_nil(tfile), tfile ? "}" : "", prefix, SWITCH_PATH_SEPARATOR, file);
                }
                if ((ext = strrchr(file, '.'))) {
@@ -511,7 +511,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                arg_recursion_check_stop(args);
                return SWITCH_STATUS_GENERR;
        }
-       
+
 
        if ((p = switch_channel_get_variable(channel, "record_fill_cng")) || (fh->params && (p = switch_event_get_header(fh->params, "record_fill_cng")))) {
                if (!strcasecmp(p, "true")) {
@@ -526,7 +526,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
        if ((p = switch_channel_get_variable(channel, "record_indication")) || (fh->params && (p = switch_event_get_header(fh->params, "record_indication")))) {
                int flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT;
                waste_resources = 1400;
-               
+
                if (switch_core_file_open(&ind_fh,
                                                                  p,
                                                                  read_impl.number_of_channels,
@@ -535,7 +535,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                }
        }
 
-       if ((p = switch_channel_get_variable(channel, "record_waste_resources")) || 
+       if ((p = switch_channel_get_variable(channel, "record_waste_resources")) ||
                (fh->params && (p = switch_event_get_header(fh->params, "record_waste_resources")))) {
 
                if (!strcasecmp(p, "true")) {
@@ -546,7 +546,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                        }
                }
        }
-       
+
        if (fill_cng || waste_resources) {
                if (switch_core_codec_init(&write_codec,
                                                                   "L16",
@@ -572,15 +572,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
 
 
        if (switch_core_file_has_video(fh, SWITCH_TRUE)) {
-               switch_core_session_request_video_refresh(session);     
-               
-               if ((p = switch_channel_get_variable(channel, "record_play_video")) || 
+               switch_core_session_request_video_refresh(session);
+
+               if ((p = switch_channel_get_variable(channel, "record_play_video")) ||
 
                        (fh->params && (p = switch_event_get_header(fh->params, "record_play_video")))) {
 
                        video_file = switch_core_session_strdup(session, p);
-                       
-                       if (switch_core_file_open(&vfh, video_file, fh->channels, 
+
+                       if (switch_core_file_open(&vfh, video_file, fh->channels,
                                                                          read_impl.actual_samples_per_second, vid_play_file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
                                memset(&vfh, 0, sizeof(vfh));
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failure opening video playback file.\n");
@@ -596,12 +596,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                        }
                }
 
-               if (!switch_test_flag(&vfh, SWITCH_FILE_OPEN)) { 
+               if (!switch_test_flag(&vfh, SWITCH_FILE_OPEN)) {
                        echo_on = 1;
                        switch_channel_set_flag_recursive(channel, CF_VIDEO_DECODED_READ);
                        switch_channel_set_flag(channel, CF_VIDEO_ECHO);
                }
-               
+
                switch_core_media_set_video_file(session, fh, SWITCH_RW_READ);
        } else if (switch_channel_test_flag(channel, CF_VIDEO)) {
                switch_channel_set_flag(channel, CF_VIDEO_BLANK);
@@ -812,18 +812,18 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                        if (switch_test_flag(&vfh, SWITCH_FILE_FLAG_VIDEO_EOF)) {
 
                                //switch_core_media_set_video_file(session, NULL, SWITCH_RW_WRITE);
-                               
+
                                switch_core_media_lock_video_file(session, SWITCH_RW_WRITE);
 
                                switch_core_file_close(&vfh);
                                memset(&vfh, 0, sizeof(vfh));
-                               
-                               if (switch_core_file_open(&vfh, video_file, fh->channels, 
+
+                               if (switch_core_file_open(&vfh, video_file, fh->channels,
                                                                                  read_impl.actual_samples_per_second, vid_play_file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
                                        memset(&vfh, 0, sizeof(vfh));
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failure opening video playback file.\n");
                                }
-                               
+
                                if (switch_core_file_has_video(&vfh, SWITCH_TRUE)) {
                                        //switch_core_media_set_video_file(session, &vfh, SWITCH_RW_WRITE);
                                        switch_core_media_gen_key_frame(session);
@@ -867,7 +867,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
 
                if (switch_test_flag(&ind_fh, SWITCH_FILE_OPEN)) {
                        switch_size_t olen = write_frame.codec->implementation->samples_per_packet;
-                       
+
                        if (switch_core_file_read(&ind_fh, write_frame.data, &olen) == SWITCH_STATUS_SUCCESS) {
                                write_frame.samples = olen;
                                write_frame.datalen = olen * 2 * ind_fh.channels;;
@@ -894,7 +894,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                                break;
                        }
                }
-               
+
 
                if (waste_resources || switch_test_flag(&ind_fh, SWITCH_FILE_OPEN)) {
                        if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
@@ -906,7 +906,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
        if (fill_cng || waste_resources) {
                switch_core_codec_destroy(&write_codec);
        }
-       
+
        if (switch_core_file_has_video(fh, SWITCH_FALSE)) {
                if (echo_on) {
                        switch_channel_clear_flag(channel, CF_VIDEO_ECHO);
@@ -1210,7 +1210,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                        timeout_samples = read_impl.actual_samples_per_second * tmp;
                        cumulative = 1;
                }
-       
+
        } else if ((var = switch_channel_get_variable(channel, "playback_timeout_sec"))) {
                int tmp = atoi(var);
                if (tmp > 1) {
@@ -1493,16 +1493,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                                                                           NULL,
                                                                           NULL,
                                                                           fh->samplerate,
-                                                                          interval, read_impl.number_of_channels, 
+                                                                          interval, read_impl.number_of_channels,
                                                                           SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
-                                                                 SWITCH_LOG_DEBUG, "Codec Activated %s@%uhz %u channels %dms\n", 
+                                                                 SWITCH_LOG_DEBUG, "Codec Activated %s@%uhz %u channels %dms\n",
                                                                  codec_name, fh->samplerate, read_impl.number_of_channels, interval);
 
 
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
-                                                                 "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, 
+                                                                 "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name,
                                                                  fh->samplerate, read_impl.number_of_channels, interval);
                                switch_core_session_io_write_lock(session);
                                switch_channel_set_private(channel, "__fh", NULL);
@@ -1527,7 +1527,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                        channels = read_impl.number_of_channels;
                        if (framelen == 0) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s cannot play or record native files with variable length data\n", switch_channel_get_name(channel));
-                               
+
                                switch_core_session_io_write_lock(session);
                                switch_channel_set_private(channel, "__fh", NULL);
                                switch_core_session_io_rwunlock(session);
@@ -1568,7 +1568,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                                continue;
                        }
                        switch_core_timer_sync(&timer); // Sync timer
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                                          "Setup timer success %u bytes per %d ms! %d ch\n", len, interval, codec.implementation->number_of_channels);
                }
                write_frame.rate = fh->samplerate;
@@ -1629,7 +1629,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                                                done = 1;
                                                break;
                                        }
-                                       
+
 
                                        if (args->dmachine) {
                                                char ds[2] = {dtmf.digit, '\0'};
@@ -1654,7 +1654,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                                                if (ostatus != SWITCH_STATUS_SUCCESS) {
                                                        status = ostatus;
                                                }
-                                               
+
                                                switch_event_destroy(&event);
                                        }
                                }
@@ -1726,7 +1726,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                                if ((rstatus = switch_core_file_read(fh, abuf, &olen)) == SWITCH_STATUS_BREAK) {
                                        continue;
                                }
-                               
+
                                if (rstatus != SWITCH_STATUS_SUCCESS) {
                                        eof++;
                                        continue;
@@ -1940,7 +1940,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                }
 
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file %s\n", file);
-               switch_channel_set_variable_printf(channel, "playback_last_offset_pos", "%d", fh->offset_pos); 
+               switch_channel_set_variable_printf(channel, "playback_last_offset_pos", "%d", fh->offset_pos);
 
                if (read_impl.samples_per_second) {
                        switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / fh->native_rate);
@@ -1971,7 +1971,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                switch_core_session_io_write_lock(session);
                switch_channel_set_private(channel, "__fh", NULL);
                switch_core_session_io_rwunlock(session);
-               
+
                switch_core_media_set_video_file(session, NULL, SWITCH_RW_WRITE);
                switch_core_file_close(fh);
 
@@ -2087,21 +2087,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_
                                break;
                        }
                }
-               
+
                if (abuf) {
                        switch_size_t olen = raw_codec.implementation->samples_per_packet;
-                       
+
                        if (switch_core_file_read(&fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
-                       
+
                        write_frame.samples = (uint32_t) olen;
                        write_frame.datalen = (uint32_t) (olen * sizeof(int16_t) * fh.channels);
                        if ((status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0)) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
                }
-               
+
                if (countdown) {
                        if (!--countdown) {
                                switch_channel_set_variable(channel, "wait_for_silence_timeout", "false");
@@ -2223,21 +2223,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_audio(switch_core_session_t *s
                                break;
                        }
                }
-               
+
                if (abuf) {
                        switch_size_t olen = raw_codec.implementation->samples_per_packet;
-                       
+
                        if (switch_core_file_read(&fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
-                       
+
                        write_frame.samples = (uint32_t) olen;
                        write_frame.datalen = (uint32_t) (olen * sizeof(int16_t) * fh.channels);
                        if ((status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0)) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
                }
-               
+
                data = (int16_t *) read_frame->data;
 
                for (energy = 0, j = 0, count = 0; count < read_frame->samples; count++) {
@@ -2350,21 +2350,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_silence(switch_core_session_t
                                break;
                        }
                }
-               
+
                if (abuf) {
                        switch_size_t olen = raw_codec.implementation->samples_per_packet;
-                       
+
                        if (switch_core_file_read(&fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
-                       
+
                        write_frame.samples = (uint32_t) olen;
                        write_frame.datalen = (uint32_t) (olen * sizeof(int16_t) * fh.channels);
                        if ((status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0)) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
                }
-               
+
                data = (int16_t *) read_frame->data;
 
                for (energy = 0, j = 0, count = 0; count < read_frame->samples; count++) {
@@ -3025,7 +3025,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "OPEN TTS %s\n", tts_name);
 
        codec_name = "L16";
-       
+
        if (need_create) {
                if (switch_core_codec_init(codec,
                                                                   codec_name,
index 346a021a82b0d8fd7ee3467b801a731cba4b76a5..0d7ee1c04a8f246663392c6b05f8a7d10f989b25 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  *
@@ -133,7 +133,7 @@ SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *na
 SWITCH_DECLARE(switch_status_t) switch_ivr_say_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
 {
        char *p;
-       
+
        arg_recursion_check_start(args);
 
        for (p = tosay; p && *p; p++) {
index 826fa00011655afe24e76b893d2f79001b03f4c0..c6787a6bc111b9a2aab29a121c13a41351a14a0f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_jitterbuffer.c -- Audio/Video Jitter Buffer
@@ -110,7 +110,7 @@ static int node_cmp(const void *l, const void *r)
 {
        switch_jb_node_t *a = (switch_jb_node_t *) l;
        switch_jb_node_t *b = (switch_jb_node_t *) r;
-       
+
        if (!a->visible) return 0;
        if (!b->visible) return 1;
 
@@ -177,7 +177,7 @@ switch_jb_node_t *sort_nodes(switch_jb_node_t *list, int (*cmp)(const void *, co
 
                                /* Maintain reverse pointers in a doubly linked list. */
                                e->prev = tail;
-                               
+
                                tail = e;
                        }
 
@@ -210,15 +210,15 @@ static inline switch_jb_node_t *new_node(switch_jb_t *jb)
        }
 
        if (!np) {
-               
+
                np = switch_core_alloc(jb->pool, sizeof(*np));
-               
+
                np->next = jb->node_list;
                if (np->next) {
                        np->next->prev = np;
                }
                jb->node_list = np;
-               
+
        }
 
        switch_assert(np);
@@ -239,7 +239,7 @@ static inline void push_to_top(switch_jb_t *jb, switch_jb_node_t *node)
        } else if (node->prev) {
                node->prev->next = node->next;
        }
-                       
+
        if (node->next) {
                node->next->prev = node->prev;
        }
@@ -320,14 +320,14 @@ static inline void drop_ts(switch_jb_t *jb, uint32_t ts)
        }
 
        switch_mutex_unlock(jb->list_mutex);
-       
+
        if (x) jb->complete_frames--;
 }
 
 static inline switch_jb_node_t *jb_find_lowest_seq(switch_jb_t *jb, uint32_t ts)
 {
        switch_jb_node_t *np, *lowest = NULL;
-       
+
        switch_mutex_lock(jb->list_mutex);
        for (np = jb->node_list; np; np = np->next) {
                if (!np->visible) continue;
@@ -392,7 +392,7 @@ static inline void thin_frames(switch_jb_t *jb, int freq, int max)
        }
 
        sort_free_nodes(jb);
-       switch_mutex_unlock(jb->list_mutex);    
+       switch_mutex_unlock(jb->list_mutex);
 }
 
 
@@ -451,7 +451,7 @@ static inline void jb_hit(switch_jb_t *jb)
 static void jb_frame_inc_line(switch_jb_t *jb, int i, int line)
 {
        uint32_t old_frame_len = jb->frame_len;
-       
+
        if (i == 0) {
                jb->frame_len = jb->min_frame_len;
                goto end;
@@ -511,15 +511,15 @@ static inline int verify_oldest_frame(switch_jb_t *jb)
        if (!lowest || !(lowest = jb_find_lowest_seq(jb, lowest->packet.header.ts))) {
                goto end;
        }
-       
+
        switch_mutex_lock(jb->mutex);
 
        jb->node_list = sort_nodes(jb->node_list, node_cmp);
 
        for (np = lowest->next; np; np = np->next) {
-                       
+
                if (!np->visible) continue;
-                       
+
                if (ntohs(np->packet.header.seq) != ntohs(np->prev->packet.header.seq) + 1) {
                        uint32_t val = (uint32_t)htons(ntohs(np->prev->packet.header.seq) + 1);
 
@@ -528,12 +528,12 @@ static inline int verify_oldest_frame(switch_jb_t *jb)
                        }
                        break;
                }
-                               
+
                if (np->packet.header.ts != lowest->packet.header.ts || !np->next) {
                        r = 1;
                }
        }
-       
+
        switch_mutex_unlock(jb->mutex);
 
  end:
@@ -562,7 +562,7 @@ static inline void drop_newest_frame(switch_jb_t *jb)
 static inline void drop_second_newest_frame(switch_jb_t *jb)
 {
        switch_jb_node_t *second_newest = jb_find_penultimate_node(jb);
-       
+
        if (second_newest) {
                drop_ts(jb, second_newest->packet.header.ts);
                jb_debug(jb, 1, "Dropping second highest frame ts:%u\n", ntohl(second_newest->packet.header.ts));
@@ -584,7 +584,7 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch
                switch_core_inthash_insert(jb->node_hash_ts, node->packet.header.ts, node);
        }
 
-       jb_debug(jb, (packet->header.m ? 1 : 2), "PUT packet last_ts:%u ts:%u seq:%u%s\n", 
+       jb_debug(jb, (packet->header.m ? 1 : 2), "PUT packet last_ts:%u ts:%u seq:%u%s\n",
                         ntohl(jb->highest_wrote_ts), ntohl(node->packet.header.ts), ntohs(node->packet.header.seq), packet->header.m ? " <MARK>" : "");
 
        if (jb->write_init && jb->type == SJB_VIDEO) {
@@ -595,20 +595,20 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch
                } else {
                        seq_diff = abs(((int)ntohs(packet->header.seq) - ntohs(jb->highest_wrote_seq)));
                }
-               
+
                if (ntohl(jb->highest_wrote_ts) > (UINT_MAX - 1000) && ntohl(node->packet.header.ts) < 1000) {
                        ts_diff = (UINT_MAX - ntohl(node->packet.header.ts)) + ntohl(node->packet.header.ts);
                } else {
                        ts_diff = abs((int)((int64_t)ntohl(node->packet.header.ts) - (int64_t)ntohl(jb->highest_wrote_ts)));
                }
-               
+
                if (((seq_diff >= jb->max_frame_len) || (ts_diff > (900000 * 5)))) {
                        jb_debug(jb, 2, "CHANGE DETECTED, PUNT %u\n", abs(((int)ntohs(packet->header.seq) - ntohs(jb->highest_wrote_seq))));
                        switch_jb_reset(jb);
                }
        }
-       if (!jb->write_init || ntohs(packet->header.seq) > ntohs(jb->highest_wrote_seq) || 
+
+       if (!jb->write_init || ntohs(packet->header.seq) > ntohs(jb->highest_wrote_seq) ||
                (ntohs(jb->highest_wrote_seq) > USHRT_MAX - 100 && ntohs(packet->header.seq) < 100) ) {
                jb->highest_wrote_seq = packet->header.seq;
        }
@@ -631,7 +631,7 @@ static inline void add_node(switch_jb_t *jb, switch_rtp_packet_t *packet, switch
                        jb->highest_wrote_ts = packet->header.ts;
                }
        }
-       
+
        if (!jb->write_init) jb->write_init = 1;
 }
 
@@ -679,7 +679,7 @@ static inline switch_status_t jb_next_packet_by_seq(switch_jb_t *jb, switch_jb_n
                        jb->dropped = 0;
                        jb_debug(jb, 2, "%s", "DROPPED FRAME DETECTED RESYNCING\n");
                        jb->target_seq = 0;
-                       
+
                        if (jb->session) {
                                switch_core_session_request_video_refresh(jb->session);
                        }
@@ -713,7 +713,7 @@ static inline switch_status_t jb_next_packet_by_seq(switch_jb_t *jb, switch_jb_n
                        //if (jb->session) {
                        //      switch_core_session_request_video_refresh(jb->session);
                        //}
-                       
+
                        for (x = 0; x < 10; x++) {
                                increment_seq(jb);
                                if ((node = switch_core_inthash_find(jb->node_hash, jb->target_seq))) {
@@ -737,14 +737,14 @@ static inline switch_status_t jb_next_packet_by_seq(switch_jb_t *jb, switch_jb_n
        }
 
        *nodep = node;
-       
+
        if (node) {
                set_read_seq(jb, node->packet.header.seq);
                return SWITCH_STATUS_SUCCESS;
        }
 
        return SWITCH_STATUS_NOTFOUND;
-       
+
 }
 
 
@@ -769,7 +769,7 @@ static inline switch_status_t jb_next_packet_by_ts(switch_jb_t *jb, switch_jb_no
        }
 
        *nodep = node;
-       
+
        if (node) {
                set_read_ts(jb, node->packet.header.ts);
                node->packet.header.seq = htons(jb->psuedo_seq);
@@ -777,7 +777,7 @@ static inline switch_status_t jb_next_packet_by_ts(switch_jb_t *jb, switch_jb_no
        }
 
        return SWITCH_STATUS_NOTFOUND;
-       
+
 }
 
 static inline switch_status_t jb_next_packet(switch_jb_t *jb, switch_jb_node_t **nodep)
@@ -842,7 +842,7 @@ SWITCH_DECLARE(int) switch_jb_poll(switch_jb_t *jb)
                        }
                }
        }
-       
+
        return (jb->complete_frames >= jb->frame_len) || jb->flush;
 }
 
@@ -907,7 +907,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_peek_frame(switch_jb_t *jb, uint32_t t
                uint16_t want_seq = seq + peek;
                node = switch_core_inthash_find(jb->node_hash, htons(want_seq));
        } else if (ts && jb->samples_per_frame) {
-               uint32_t want_ts = ts + (peek * jb->samples_per_frame); 
+               uint32_t want_ts = ts + (peek * jb->samples_per_frame);
                node = switch_core_inthash_find(jb->node_hash_ts, htonl(want_ts));
        }
 
@@ -926,7 +926,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_peek_frame(switch_jb_t *jb, uint32_t t
        return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_jb_get_frames(switch_jb_t *jb, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len) 
+SWITCH_DECLARE(switch_status_t) switch_jb_get_frames(switch_jb_t *jb, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len)
 {
 
        switch_mutex_lock(jb->mutex);
@@ -966,7 +966,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_set_frames(switch_jb_t *jb, uint32_t m
        if (jb->frame_len < jb->min_frame_len) {
                jb->frame_len = jb->min_frame_len;
        }
-       
+
        if (jb->frame_len > jb->highest_frame_len) {
                jb->highest_frame_len = jb->frame_len;
        }
@@ -1015,7 +1015,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_destroy(switch_jb_t **jbp)
 {
        switch_jb_t *jb = *jbp;
        *jbp = NULL;
-       
+
        if (jb->type == SJB_VIDEO) {
                switch_core_inthash_destroy(&jb->missing_seq_hash);
        }
@@ -1056,7 +1056,7 @@ SWITCH_DECLARE(uint32_t) switch_jb_pop_nack(switch_jb_t *jb)
                uint16_t seq;
                //const char *token;
                switch_time_t then = 0;
-               
+
                switch_core_hash_this(hi, &var, NULL, &val);
                //token = (const char *) val;
 
@@ -1065,7 +1065,7 @@ SWITCH_DECLARE(uint32_t) switch_jb_pop_nack(switch_jb_t *jb)
                        //printf("WTf\n");
                //      continue;
                //}
-               
+
                seq = ntohs(*((uint16_t *) var));
                then = (intptr_t) val;
 
@@ -1073,7 +1073,7 @@ SWITCH_DECLARE(uint32_t) switch_jb_pop_nack(switch_jb_t *jb)
                        //jb_debug(jb, 3, "NACKABLE seq %u too soon to repeat\n", seq);
                        continue;
                }
-               
+
                //if (then != 1) {
                //      jb_debug(jb, 3, "NACKABLE seq %u not too soon to repeat %lu\n", seq, switch_time_now() - then);
                //}
@@ -1109,7 +1109,7 @@ SWITCH_DECLARE(uint32_t) switch_jb_pop_nack(switch_jb_t *jb)
 
                //jb_frame_inc(jb, 1);
        }
-       
+
        switch_mutex_unlock(jb->mutex);
 
 
@@ -1157,7 +1157,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp
                                }
 
                                jb_debug(jb, 2, "GOT %u WANTED %u; MARK SEQS MISSING %u - %u\n", got, want, want, got - 1);
-                       
+
                                for (i = want; i < got; i++) {
                                        jb_debug(jb, 2, "MARK MISSING %u ts:%u\n", i, ntohl(packet->header.ts));
                                        switch_core_inthash_insert(jb->missing_seq_hash, (uint32_t)htons(i), (void *)(intptr_t)1);
@@ -1175,7 +1175,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp
        if (switch_test_flag(jb, SJB_QUEUE_ONLY) && jb->complete_frames > jb->max_frame_len) {
                drop_oldest_frame(jb);
        }
-       
+
        switch_mutex_unlock(jb->mutex);
 
        return SWITCH_STATUS_SUCCESS;
@@ -1248,7 +1248,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
                if (jb->type == SJB_VIDEO && jb->channel && jb->video_low_bitrate) {
                        //switch_time_t now = switch_time_now();
                        //int ok = (now - jb->last_bitrate_change) > 10000;
-                       
+
                        if (switch_channel_test_flag(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE) && jb->frame_len == jb->min_frame_len) {
                                jb_debug(jb, 2, "%s", "Allow BITRATE changes\n");
                                switch_channel_clear_flag(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE);
@@ -1260,11 +1260,11 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
                                switch_core_session_message_t msg = { 0 };
 
                                jb->bitrate_control = jb->video_low_bitrate;
-                               
+
                                msg.message_id = SWITCH_MESSAGE_INDICATE_BITRATE_REQ;
                                msg.numeric_arg = jb->bitrate_control * 1024;
                                msg.from = __FILE__;
-                               
+
                                jb_debug(jb, 2, "Force BITRATE to %d\n", jb->bitrate_control);
                                switch_core_session_receive_message(jb->session, &msg);
                                switch_channel_set_flag(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE);
@@ -1274,7 +1274,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
                        }
                }
        }
-       
+
 
        jb->period_miss_pct = ((double)jb->period_miss_count / jb->period_count) * 100;
 
@@ -1282,15 +1282,15 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
                jb_debug(jb, 2, "Miss percent %02f too high, resetting buffer.\n", jb->period_miss_pct);
                switch_jb_reset(jb);
        }
-       
+
        if ((status = jb_next_packet(jb, &node)) == SWITCH_STATUS_SUCCESS) {
                jb_debug(jb, 2, "Found next frame cur ts: %u seq: %u\n", htonl(node->packet.header.ts), htons(node->packet.header.seq));
 
-               if (!jb->read_init || ntohs(node->packet.header.seq) > ntohs(jb->highest_read_seq) || 
+               if (!jb->read_init || ntohs(node->packet.header.seq) > ntohs(jb->highest_read_seq) ||
                        (ntohs(jb->highest_read_seq) > USHRT_MAX - 10 && ntohs(node->packet.header.seq) <= 10) ) {
                        jb->highest_read_seq = node->packet.header.seq;
                }
-               
+
                if (jb->type == SJB_TEXT || jb->type == SJB_AUDIO ||
                        (jb->read_init && htons(node->packet.header.seq) >= htons(jb->highest_read_seq) && (ntohl(node->packet.header.ts) > ntohl(jb->highest_read_ts)))) {
                        jb->complete_frames--;
@@ -1299,7 +1299,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
                } else if (!jb->read_init) {
                        jb->highest_read_ts = node->packet.header.ts;
                }
-               
+
                if (!jb->read_init) jb->read_init = 1;
        } else {
                if (jb->type == SJB_VIDEO) {
@@ -1321,7 +1321,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
                                switch_jb_reset(jb);
                                switch_goto_status(SWITCH_STATUS_RESTART, end);
                        case SWITCH_STATUS_NOTFOUND:
-                       default:                                                        
+                       default:
                                if (jb->consec_miss_count > jb->frame_len) {
                                        switch_jb_reset(jb);
                                        jb_frame_inc(jb, 1);
@@ -1335,10 +1335,10 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
                        }
                }
        }
-       
+
        if (node) {
                status = SWITCH_STATUS_SUCCESS;
-               
+
                *packet = node->packet;
                *len = node->len;
                jb->last_len = *len;
@@ -1363,13 +1363,13 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
                } else {
                        seq = jb->last_target_seq;
                }
-               
+
                packet->header.seq = seq;
                packet->header.ts = ts;
        }
 
        switch_mutex_unlock(jb->mutex);
-       
+
        if (jb->complete_frames > jb->max_frame_len) {
                thin_frames(jb, 8, 25);
        }
index 370433fe20f3e15cab16119ab2c85b5d9796b5dc..c1f27f3ce56e1081c0276eca3c3f4f83648c9698 100644 (file)
@@ -44,15 +44,15 @@ static int cJSON_strcasecmp(const char *s1,const char *s2)
        return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
 }
 
-static void *glue_malloc(size_t theSize) 
-{ 
-       return(malloc(theSize)); 
-} 
+static void *glue_malloc(size_t theSize)
+{
+       return(malloc(theSize));
+}
 
-static void glue_free(void *thePtr) 
-{ 
-       free(thePtr); 
-} 
+static void glue_free(void *thePtr)
+{
+       free(thePtr);
+}
 
 static void *(*cJSON_malloc)(size_t sz) = glue_malloc;
 static void (*cJSON_free)(void *ptr) = glue_free;
@@ -120,7 +120,7 @@ static const char *parse_number(cJSON *item,const char *num)
        }
 
        n=sign*n*pow(10.0,(scale+subscale*signsubscale));       /* number = +/- number.fraction * 10^+/- exponent */
-       
+
        item->valuedouble=n;
        item->valueint=(int)n;
        item->type=cJSON_Number;
@@ -163,12 +163,12 @@ static const char *parse_string(cJSON *item,const char *str)
 {
        const char *ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2;
        if (*str!='\"') {ep=str;return 0;}      /* not a string! */
-       
+
        while (*ptr!='\"' && *ptr && ++len) if (*ptr++ == '\\') ptr++;  /* Skip escaped quotes. */
-       
+
        out=(char*)cJSON_malloc(len+1); /* This is how long we need for the string, roughly. */
        if (!out) return 0;
-       
+
        ptr=str+1;ptr2=out;
        while (*ptr!='\"' && *ptr)
        {
@@ -199,7 +199,7 @@ static const char *parse_string(cJSON *item,const char *str)
                                        }
 
                                        len=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len;
-                                       
+
                                        switch (len) {
                                                case 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
                                                case 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
@@ -224,10 +224,10 @@ static const char *parse_string(cJSON *item,const char *str)
 static char *print_string_ptr(const char *str)
 {
        const char *ptr;char *ptr2,*out;int len=0;unsigned char token;
-       
+
        if (!str) return cJSON_strdup("");
        ptr=str;while ((token=*ptr) && ++len) {if (strchr("\"\\\b\f\n\r\t",token)) len++; else if (token<32) len+=5;ptr++;}
-       
+
        out=(char*)cJSON_malloc(len+3);
        if (!out) return 0;
 
@@ -353,7 +353,7 @@ static char *print_array(cJSON *item,int depth,int fmt)
        size_t len=5;
        cJSON *child=item->child;
        int numentries=0,i=0,fail=0;
-       
+
        /* How many entries in the array? */
        while (child) numentries++,child=child->next;
        /* Allocate an array to hold the values for each */
@@ -369,7 +369,7 @@ static char *print_array(cJSON *item,int depth,int fmt)
                if (ret) len+=strlen(ret)+2+(fmt?1:0); else fail=1;
                child=child->next;
        }
-       
+
        /* If we didn't fail, try to malloc the output string */
        if (!fail) out=(char*)cJSON_malloc(len);
        /* If that fails, we fail. */
@@ -382,7 +382,7 @@ static char *print_array(cJSON *item,int depth,int fmt)
                cJSON_free(entries);
                return 0;
        }
-       
+
        /* Compose the output array. */
        *out='[';
        ptr=out+1;*ptr=0;
@@ -394,7 +394,7 @@ static char *print_array(cJSON *item,int depth,int fmt)
        }
        cJSON_free(entries);
        *ptr++=']';*ptr++=0;
-       return out;     
+       return out;
 }
 
 /* Build an object from the text. */
@@ -402,11 +402,11 @@ static const char *parse_object(cJSON *item,const char *value)
 {
        cJSON *child;
        if (*value!='{')        {ep=value;return 0;}    /* not an object! */
-       
+
        item->type=cJSON_Object;
        value=skip(value+1);
        if (*value=='}') return value+1;        /* empty array. */
-       
+
        item->child=child=cJSON_New_Item();
        if (!item->child) return 0;
        value=skip(parse_string(child,skip(value)));
@@ -415,7 +415,7 @@ static const char *parse_object(cJSON *item,const char *value)
        if (*value!=':') {ep=value;return 0;}   /* fail! */
        value=skip(parse_value(child,skip(value+1)));   /* skip any spacing, get the value. */
        if (!value) return 0;
-       
+
        while (*value==',')
        {
                cJSON *new_item;
@@ -428,7 +428,7 @@ static const char *parse_object(cJSON *item,const char *value)
                value=skip(parse_value(child,skip(value+1)));   /* skip any spacing, get the value. */
                if (!value) return 0;
        }
-       
+
        if (*value=='}') return value+1;        /* end of array */
        ep=value;return 0;      /* malformed. */
 }
@@ -460,7 +460,7 @@ static char *print_object(cJSON *item,int depth,int fmt)
                if (str && ret) len+=strlen(ret)+strlen(str)+2+(fmt?2+depth:0); else fail=1;
                child=child->next;
        }
-       
+
        /* Try to allocate the output string */
        if (!fail) out=(char*)cJSON_malloc(len);
        if (!out) fail=1;
@@ -472,7 +472,7 @@ static char *print_object(cJSON *item,int depth,int fmt)
                cJSON_free(names);cJSON_free(entries);
                return 0;
        }
-       
+
        /* Compose the output: */
        *out='{';ptr=out+1;if (fmt)*ptr++='\n';*ptr=0;
        for (i=0;i<numentries;i++)
@@ -485,11 +485,11 @@ static char *print_object(cJSON *item,int depth,int fmt)
                if (fmt) *ptr++='\n';*ptr=0;
                cJSON_free(names[i]);cJSON_free(entries[i]);
        }
-       
+
        cJSON_free(names);cJSON_free(entries);
        if (fmt) for (i=0;i<depth-1;i++) *ptr++='\t';
        *ptr++='}';*ptr++=0;
-       return out;     
+       return out;
 }
 
 /* Get Array size/item / object item. */
@@ -498,7 +498,7 @@ SWITCH_DECLARE(cJSON *)cJSON_GetArrayItem(cJSON *array,int item)                            {cJSON *c=ar
 SWITCH_DECLARE(cJSON *)cJSON_GetObjectItem(const cJSON *object,const char *string)     {cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;}
 
 
-SWITCH_DECLARE(const char *)cJSON_GetObjectCstr(const cJSON *object, const char *string)       
+SWITCH_DECLARE(const char *)cJSON_GetObjectCstr(const cJSON *object, const char *string)
 {
        cJSON *cj = cJSON_GetObjectItem(object, string);
 
index e703432252ca7b6c6129cbf5a93243f22ff2a0d4..ed53f01021ac983f79c8803b7c3239aee4c35368 100644 (file)
 
 static switch_limit_interface_t *get_backend(const char *backend) {
        switch_limit_interface_t *limit = NULL;
-       
+
        if (!backend) {
                return NULL;
        }
-       
+
        if (!(limit = switch_loadable_module_get_limit_interface(backend))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unable to locate limit backend: %s\n", backend);
        }
-       
+
        return limit;
 }
 
@@ -81,7 +81,7 @@ static switch_status_t limit_state_handler(switch_core_session_t *session)
        switch_channel_state_t state = switch_channel_get_state(channel);
        const char *vval = switch_channel_get_variable(channel, LIMIT_IGNORE_TRANSFER_VARIABLE);
        const char *backendlist = switch_channel_get_variable(channel, LIMIT_BACKEND_VARIABLE);
-       
+
        if (zstr(backendlist)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Unset limit backendlist!\n");
                return SWITCH_STATUS_SUCCESS;
@@ -92,7 +92,7 @@ static switch_status_t limit_state_handler(switch_core_session_t *session)
                char *argv[6] = { 0 };
                char *mydata = strdup(backendlist);
                int x;
-               
+
                argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
                for (x = 0; x < argc; x++) {
                        switch_limit_release(argv[x], session, NULL, NULL);
@@ -100,10 +100,10 @@ static switch_status_t limit_state_handler(switch_core_session_t *session)
                switch_core_event_hook_remove_state_change(session, limit_state_handler);
                /* Remove limit_backend variable so we register another hook if limit is called again */
                switch_channel_set_variable(channel, LIMIT_BACKEND_VARIABLE, NULL);
-               
+
                free(mydata);
        }
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -112,7 +112,7 @@ SWITCH_DECLARE(switch_status_t) switch_limit_incr(const char *backend, switch_co
        switch_limit_interface_t *limit = NULL;
        switch_channel_t *channel = NULL;
        int status = SWITCH_STATUS_SUCCESS;
-       
+
        assert(session);
 
        channel = switch_core_session_get_channel(session);
@@ -125,7 +125,7 @@ SWITCH_DECLARE(switch_status_t) switch_limit_incr(const char *backend, switch_co
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "incr called: %s_%s max:%d, interval:%d\n",
                                          realm, resource, max, interval);
-       
+
        if ((status = limit->incr(session, realm, resource, max, interval)) == SWITCH_STATUS_SUCCESS) {
                /* race condition? what if another leg is doing the same thing? */
                const char *existing = switch_channel_get_variable(channel, LIMIT_BACKEND_VARIABLE);
@@ -138,9 +138,9 @@ SWITCH_DECLARE(switch_status_t) switch_limit_incr(const char *backend, switch_co
                        switch_core_event_hook_add_state_change(session, limit_state_handler);
                }
        }
-       
+
        release_backend(limit);
-       
+
 end:
        return status;
 }
@@ -148,15 +148,15 @@ end:
 SWITCH_DECLARE(switch_status_t) switch_limit_release(const char *backend, switch_core_session_t *session, const char *realm, const char *resource) {
        switch_limit_interface_t *limit = NULL;
        int status = SWITCH_STATUS_SUCCESS;
-       
+
        /* locate impl, call appropriate func */
        if (!(limit = get_backend(backend))) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Limit subsystem %s not found!\n", backend);
                switch_goto_status(SWITCH_STATUS_GENERR, end);
        }
-       
+
        status = limit->release(session, realm, resource);
-       
+
 end:
        release_backend(limit);
        return status;
@@ -165,15 +165,15 @@ end:
 SWITCH_DECLARE(int) switch_limit_usage(const char *backend, const char *realm, const char *resource, uint32_t *rcount) {
        switch_limit_interface_t *limit = NULL;
        int usage = 0;
-       
+
        /* locate impl, call appropriate func */
        if (!(limit = get_backend(backend))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Limit subsystem %s not found!\n", backend);
                goto end;
        }
-       
+
        usage = limit->usage(realm, resource, rcount);
-       
+
 end:
        release_backend(limit);
        return usage;
@@ -182,15 +182,15 @@ end:
 SWITCH_DECLARE(switch_status_t) switch_limit_reset(const char *backend) {
        switch_limit_interface_t *limit = NULL;
        int status = SWITCH_STATUS_SUCCESS;
-       
+
        /* locate impl, call appropriate func */
        if (!(limit = get_backend(backend))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Limit subsystem %s not found!\n", backend);
                switch_goto_status(SWITCH_STATUS_GENERR, end);
        }
-       
+
        status = limit->reset();
-       
+
 end:
        release_backend(limit);
        return status;
@@ -199,20 +199,20 @@ end:
 SWITCH_DECLARE(switch_status_t) switch_limit_interval_reset(const char *backend, const char *realm, const char *resource) {
        switch_limit_interface_t *limit = NULL;
        int status = SWITCH_STATUS_SUCCESS;
-       
+
        /* locate impl, call appropriate func */
        if (!(limit = get_backend(backend))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Limit subsystem %s not found!\n", backend);
                switch_goto_status(SWITCH_STATUS_GENERR, end);
        }
-       
+
        if (!limit->interval_reset) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Limit subsystem %s does not implement interval_reset!\n", backend);
                switch_goto_status(SWITCH_STATUS_GENERR, end);
        }
 
        status = limit->interval_reset(realm, resource);
-       
+
 end:
        release_backend(limit);
        return status;
@@ -221,15 +221,15 @@ end:
 SWITCH_DECLARE(char *) switch_limit_status(const char *backend) {
        switch_limit_interface_t *limit = NULL;
        char *status = NULL;
-       
+
        /* locate impl, call appropriate func */
        if (!(limit = get_backend(backend))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Limit subsystem %s not found!\n", backend);
                switch_goto_status(strdup("-ERR"), end);
        }
-       
+
        status = limit->status();
-       
+
 end:
        release_backend(limit);
        return status;
index c541193158149da50e63939f8a995799954f36a1..8a1d65379b00ef2e246ae4adb13416f5f9dde772 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Seven Du <dujinfang@gmail.com>
  *
@@ -52,7 +52,7 @@ typedef struct switch_codec_node_s {
        const char *interface_name;
        struct switch_codec_node_s *next;
 } switch_codec_node_t;
-                               
+
 
 struct switch_loadable_module {
        char *key;
@@ -195,7 +195,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
                                        if (impl->decoded_bytes_per_packet > SWITCH_RECOMMENDED_BUFFER_SIZE) {
                                                load_interface = 0;
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
-                                                                                 "Failed to load codec interface %s from %s due to bytes per frame %d exceeding buffer size %d.\n", 
+                                                                                 "Failed to load codec interface %s from %s due to bytes per frame %d exceeding buffer size %d.\n",
                                                                                  ptr->interface_name,
                                                                                  key, impl->decoded_bytes_per_packet, SWITCH_RECOMMENDED_BUFFER_SIZE);
                                                break;
@@ -207,7 +207,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
                                                                                          "Adding Codec %s %d %s %dhz %dms %dch %dbps\n",
                                                                                          impl->iananame, impl->ianacode,
-                                                                                         ptr->interface_name, impl->actual_samples_per_second, 
+                                                                                         ptr->interface_name, impl->actual_samples_per_second,
                                                                                          impl->microseconds_per_packet / 1000, impl->number_of_channels, impl->bits_per_second);
                                                } else {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
@@ -617,13 +617,13 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
 
        /*
 
-       const char *from; 
+       const char *from;
        const char *to;
        const char *subject;
        const char *body;
        const char *type;
        const char *hint;
-       */              
+       */
 
        dest_proto = switch_event_get_header(message_event, "dest_proto");
 
@@ -652,18 +652,18 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
                switch_mutex_lock(loadable_modules.mutex);
                for (hi = switch_core_hash_first(loadable_modules.chat_hash); hi; hi = switch_core_hash_next(&hi)) {
                        switch_core_hash_this(hi, &var, NULL, &val);
-                       
+
                        if ((ci = (switch_chat_interface_t *) val)) {
                                if (ci->chat_send && !strncasecmp(ci->interface_name, "GLOBAL_", 7)) {
                                        status = ci->chat_send(message_event);
-                                       
+
                                        if (status == SWITCH_STATUS_SUCCESS) {
                                                if (switch_true(switch_event_get_header(message_event, "final_delivery"))) {
-                                                       /* The event was handled by an extension in the chatplan, 
-                                                        * so the event will be duplicated, modified and queued again, 
+                                                       /* The event was handled by an extension in the chatplan,
+                                                        * so the event will be duplicated, modified and queued again,
                                                         * but it won't be processed by the chatplan again.
                                                         * So this copy of the event can be destroyed by the caller.
-                                                        */ 
+                                                        */
                                                        do_skip = 1;
                                                }
                                        } else if (status == SWITCH_STATUS_BREAK) {
@@ -681,7 +681,7 @@ static switch_status_t do_chat_send(switch_event_t *message_event)
                switch_safe_free(hi);
                switch_mutex_unlock(loadable_modules.mutex);
        }
-       
+
 
        if (!do_skip && !switch_stristr("GLOBAL", dest_proto)) {
                if ((ci = switch_loadable_module_get_chat_interface(dest_proto)) && ci->chat_send) {
@@ -743,7 +743,7 @@ void *SWITCH_THREAD_FUNC chat_thread_run(switch_thread_t *thread, void *obj)
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Chat Thread Ended\n");
 
-       return NULL;    
+       return NULL;
 }
 
 
@@ -755,7 +755,7 @@ static void chat_thread_start(int idx)
        }
 
        switch_mutex_lock(chat_globals.mutex);
-       
+
        if (idx >= chat_globals.msg_queue_len) {
                int i;
                chat_globals.msg_queue_len = idx + 1;
@@ -768,10 +768,10 @@ static void chat_thread_start(int idx)
 
                                switch_threadattr_create(&thd_attr, chat_globals.pool);
                                switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-                               switch_thread_create(&chat_globals.msg_queue_thread[i], 
-                                                                        thd_attr, 
-                                                                        chat_thread_run, 
-                                                                        chat_globals.msg_queue[i], 
+                               switch_thread_create(&chat_globals.msg_queue_thread[i],
+                                                                        thd_attr,
+                                                                        chat_thread_run,
+                                                                        chat_globals.msg_queue[i],
                                                                         chat_globals.pool);
                        }
                }
@@ -790,7 +790,7 @@ static void chat_queue_message(switch_event_t **eventp)
 
        event = *eventp;
        *eventp = NULL;
-       
+
        if (chat_globals.running == 0) {
                chat_process_event(&event);
                return;
@@ -800,10 +800,10 @@ static void chat_queue_message(switch_event_t **eventp)
 
        switch_mutex_lock(chat_globals.mutex);
        idx = IDX;
-       IDX++; 
+       IDX++;
        if (IDX >= chat_globals.msg_queue_len) IDX = 0;
        switch_mutex_unlock(chat_globals.mutex);
-       
+
        chat_thread_start(idx);
 
        if (switch_queue_trypush(chat_globals.msg_queue[idx], event) != SWITCH_STATUS_SUCCESS) {
@@ -838,7 +838,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_execute_chat_app(switch_event_t *mes
        }
 
        expanded = switch_event_expand_headers(message, data);
-       
+
        status = cai->chat_application_function(message, expanded);
 
        if (expanded != data) {
@@ -872,19 +872,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send_args(const char *dest_prot
                if (blocking) {
                        switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "blocking", "true");
                }
-               
+
                if (body) {
                        switch_event_add_body(message_event, "%s", body);
                }
        } else {
                abort();
-       }       
+       }
 
        if (dest_proto) {
                switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "dest_proto", dest_proto);
        }
 
-       
+
        if (blocking) {
                status = chat_process_event(&message_event);
        } else {
@@ -893,7 +893,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send_args(const char *dest_prot
        }
 
        return status;
-       
+
 }
 
 
@@ -1898,7 +1898,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo
                                        continue;
                                }
                                global = switch_true(sglobal);
-                               
+
                                if (path && zstr(path)) {
                                        path = SWITCH_GLOBAL_dirs.mod_dir;
                                }
@@ -2056,7 +2056,7 @@ SWITCH_DECLARE(void) switch_loadable_module_shutdown(void)
 
        chat_globals.running = 0;
 
-       for (i = 0; i < chat_globals.msg_queue_len; i++) {      
+       for (i = 0; i < chat_globals.msg_queue_len; i++) {
                switch_queue_push(chat_globals.msg_queue[i], NULL);
        }
 
@@ -2141,7 +2141,7 @@ SWITCH_DECLARE(switch_file_interface_t *) switch_loadable_module_get_file_interf
        }
 
        switch_mutex_unlock(loadable_modules.mutex);
-       
+
        if (i) PROTECT_INTERFACE(i);
 
        return i;
@@ -2153,7 +2153,7 @@ SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_inte
        switch_codec_node_t *node, *head;
 
        switch_mutex_lock(loadable_modules.mutex);
-       
+
        if ((head = switch_core_hash_find(loadable_modules.codec_hash, name))) {
                if (modname) {
                        for (node = head; node; node = node->next) {
@@ -2214,7 +2214,7 @@ static void do_print(const switch_codec_implementation_t **array, int arraylen)
        int i;
 
        for(i = 0; i < arraylen; i++) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                  "DEBUG %d %s:%d %d\n", i, array[i]->iananame, array[i]->ianacode, array[i]->microseconds_per_packet / 1000);
        }
 
@@ -2241,7 +2241,7 @@ static void switch_loadable_module_sort_codecs(const switch_codec_implementation
 
        for (i = 0; i < arraylen; i++) {
                int this_ptime = array[i]->microseconds_per_packet / 1000;
-               
+
                if (!strcasecmp(array[i]->iananame, "ilbc")) {
                        this_ptime = 20;
                }
@@ -2308,14 +2308,14 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme
        for (hi = switch_core_hash_first(loadable_modules.codec_hash); hi; hi = switch_core_hash_next(&hi)) {
                switch_core_hash_this(hi, NULL, NULL, &val);
                head = (switch_codec_node_t *) val;
-               
+
                for (node = head; node; node = node->next) {
                        codec_interface = (switch_codec_interface_t *) node->ptr;
 
                        /* Look for the default ptime of the codec because it's the safest choice */
                        for (imp = codec_interface->implementations; imp; imp = imp->next) {
                                uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode);
-                               
+
                                if (imp->microseconds_per_packet / 1000 == (int)default_ptime) {
                                        array[i++] = imp;
                                        goto found;
@@ -2326,11 +2326,11 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme
                }
 
        found:
-                       
+
                if (i > arraylen) {
                        break;
                }
-               
+
        }
        switch_safe_free(hi);
 
@@ -2375,7 +2375,7 @@ SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uin
                }
                cur = next;
        }
-       
+
        if ((p = strchr(name, '.'))) {
                *p++ = '\0';
                *modname = name;
@@ -2415,7 +2415,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                        if (ointerval == 0) {
                                ointerval = switch_default_ptime(name, 0);
                        }
-                       
+
                        if (orate == 0) {
                                orate = switch_default_rate(name, 0);
                        }
@@ -2423,7 +2423,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                        if (ochannels == 0) {
                                ochannels = 1;
                        }
-                       
+
                        switch_copy_string(jbuf, prefs[j], sizeof(jbuf));
                        jname = switch_parse_codec_buf(jbuf, &jinterval, &jrate, &jbit, &jchannels, &jmodname, &jfmtp);
 
@@ -2439,7 +2439,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                                jchannels = 1;
                        }
 
-                       if (!strcasecmp(name, jname) && ointerval == jinterval && orate == jrate && ochannels == jchannels && 
+                       if (!strcasecmp(name, jname) && ointerval == jinterval && orate == jrate && ochannels == jchannels &&
                                !strcasecmp(switch_str_nil(fmtp), switch_str_nil(jfmtp))) {
                                goto next_x;
                        }
@@ -2450,7 +2450,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                        for (imp = codec_interface->implementations; imp; imp = imp->next) {
                                uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode);
                                uint32_t default_rate = switch_default_rate(imp->iananame, imp->ianacode);
-                               
+
                                if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
                                        uint32_t crate = !strcasecmp(imp->iananame, "g722") ? imp->samples_per_second : imp->actual_samples_per_second;
 
@@ -2458,7 +2458,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                                                (interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval)) {
                                                continue;
                                        }
-                                       
+
                                        if (((!rate && crate != default_rate) || (rate && (uint32_t) imp->actual_samples_per_second != rate))) {
                                                continue;
                                        }
@@ -2499,7 +2499,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
 
                                        if (channels && imp->number_of_channels != channels) {
                                                continue;
-                                       }                                       
+                                       }
                                }
 
                                array[i++] = imp;
@@ -2547,7 +2547,7 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char *
                cmd_used = (char *) cmd;
                arg_used = (char *) arg;
        }
-                       
+
 
        if (!stream->param_event) {
                switch_event_create(&stream->param_event, SWITCH_EVENT_API);
@@ -2580,7 +2580,7 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char *
        if (cmd_used != cmd) {
                switch_safe_free(cmd_used);
        }
-       
+
        if (arg_used != arg) {
                switch_safe_free(arg_used);
        }
@@ -2598,7 +2598,7 @@ SWITCH_DECLARE(switch_status_t) switch_json_api_execute(cJSON *json, switch_core
 
        function = cJSON_GetObjectItem(json, "command");
 
-       if (function && function->valuestring 
+       if (function && function->valuestring
                && cJSON_GetObjectItem(json, "data") && (json_api = switch_loadable_module_get_json_api_interface(function->valuestring)) != 0) {
                if ((status = json_api->function(json, session, &json_reply)) != SWITCH_STATUS_SUCCESS) {
                        cJSON_AddItemToObject(json, "status", cJSON_CreateString("error"));
@@ -2606,7 +2606,7 @@ SWITCH_DECLARE(switch_status_t) switch_json_api_execute(cJSON *json, switch_core
                } else {
                        cJSON_AddItemToObject(json, "status", cJSON_CreateString("success"));
                }
-               
+
                if (!json_reply) {
                        json_reply = cJSON_CreateNull();
                }
@@ -2616,7 +2616,7 @@ SWITCH_DECLARE(switch_status_t) switch_json_api_execute(cJSON *json, switch_core
                } else {
                        cJSON_AddItemToObject(json, "response", json_reply);
                }
-               
+
                UNPROTECT_INTERFACE(json_api);
        } else {
                status = SWITCH_STATUS_FALSE;
@@ -2723,7 +2723,7 @@ struct switch_say_file_handle {
        struct switch_stream_handle stream;
        switch_event_t *param_event;
 };
-       
+
 SWITCH_DECLARE(char *) switch_say_file_handle_get_variable(switch_say_file_handle_t *sh, const char *var)
 {
        char *ret = NULL;
@@ -2733,7 +2733,7 @@ SWITCH_DECLARE(char *) switch_say_file_handle_get_variable(switch_say_file_handl
        }
 
        return ret;
-       
+
 }
 
 SWITCH_DECLARE(char *) switch_say_file_handle_get_path(switch_say_file_handle_t *sh)
@@ -2744,7 +2744,7 @@ SWITCH_DECLARE(char *) switch_say_file_handle_get_path(switch_say_file_handle_t
 SWITCH_DECLARE(char *) switch_say_file_handle_detach_path(switch_say_file_handle_t *sh)
 {
        char *path;
-       
+
        switch_assert(sh);
        path = (char *) sh->stream.data;
        sh->stream.data = NULL;
@@ -2755,7 +2755,7 @@ SWITCH_DECLARE(char *) switch_say_file_handle_detach_path(switch_say_file_handle
 SWITCH_DECLARE(void) switch_say_file_handle_destroy(switch_say_file_handle_t **sh)
 {
        switch_assert(sh);
-       
+
        switch_safe_free((*sh)->stream.data);
        switch_safe_free((*sh)->ext);
 
@@ -2778,7 +2778,7 @@ SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_ha
        memset(*sh, 0, sizeof(**sh));
 
        SWITCH_STANDARD_STREAM((*sh)->stream);
-       
+
        if (var_event) {
                (*sh)->param_event = *var_event;
                *var_event = NULL;
@@ -2796,7 +2796,7 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f
        va_list ap;
 
        va_start(ap, fmt);
-       
+
        if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) {
                if (!sh->cnt++) {
                        sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext);
@@ -2807,7 +2807,7 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f
                }
 
        }
-       
+
        va_end(ap);
 }
 
index c512b2d0c5787b778dddc2cb2180ea92a30e846e..09c2b49df2cccc9c44a5a887fcc153df333b74ee 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -76,10 +76,10 @@ static WORD
 #else
 static const char *
 #endif
-       
-       
-       
+
+
+
+
        COLORS[] =
        { SWITCH_SEQ_DEFAULT_COLOR, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN, SWITCH_SEQ_FGREEN,
 SWITCH_SEQ_FYELLOW };
index a0b72420b80f4ec203d97d6c7c82cb646f818334..5f576a0bfd0fc8490d4d6dd93861650774b66309 100644 (file)
@@ -700,7 +700,7 @@ static int vxprintf(void (*func) (void *, const char *, int),       /* Consumer of tex
                                        bufpt = buf;
                                }
                                j = 0;
-                               if (needQuote) 
+                               if (needQuote)
                                        bufpt[j++] = '\'';
                                for (i = 0; (ch = escarg[i]) != 0; i++) {
                                        bufpt[j++] = (char) ch;
index 4c386c825f41c1fa5bc951f4ed7178823cc92fa9..665b8489846340cf334c3d538198c2f62f22e1bd 100644 (file)
@@ -182,7 +182,7 @@ static int msrp_init_ssl()
 
        globals.ssl_ready = 0;
        msrp_deinit_ssl();
-       
+
        return 0;
 }
 
index e18ad261f75f01e42596adf482f007e2aa41eb54..93742bf3fdea16b6ee523d6688be3d132c36ed1c 100644 (file)
@@ -118,7 +118,7 @@ static int init_upnp(void)
        } else if (devlist && !dev && !trydev) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No InternetGatewayDevice found and I am NOT going to try your printer because printers should not route to the internet, that would be DAFT\n");
        }
-       
+
        if (dev) {
                descXML = miniwget(dev->descURL, &descXMLsize);
 
index cef334fb46d4d95630a18ecbab738b09eb91ec66..02d6ee5db07590479c3f89f9c5318afb4fcf0d91 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  * switch_odbc.c -- ODBC
@@ -516,7 +516,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_
                        err_str = strdup((char *)"SQL ERROR!");
                }
        }
-       
+
        if (err_str) {
                if (!switch_stristr("already exists", err_str) && !switch_stristr("duplicate key name", err_str)) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
@@ -639,7 +639,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c
 
        SQLFreeHandle(SQL_HANDLE_STMT, stmt);
        stmt = NULL; /* Make sure we don't try to free this handle again */
-       
+
        if (!err_cnt) {
                return SWITCH_ODBC_SUCCESS;
        }
index a7d5aa48f897a71e7f135f59cd32ccc1bb70b30f..44eb55986312db3e6e8d69369511fae6f769ecce 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -824,7 +824,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
                bytes_per_frame += 882;
                ms_per_frame += 10000;
 
-       }       
+       }
 
 
 
index 9fd6e38657b56c357c1c62779887275ceeaae1a7..7b9066bbbf69149394920ca31e765e1d0db270b1 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Eliot Gable <egable@gmail.com>
  * Seven Du <dujinfang@gmail.com>
@@ -123,7 +123,7 @@ static int db_is_up(switch_pgsql_handle_t *handle)
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No DB Connection\n");
                goto done;
        }
-  
+
        /* Try a non-blocking read on the connection to gobble up any EOF from a closed connection and mark the connection BAD if it is closed. */
        PQconsumeInput(handle->con);
 
@@ -294,7 +294,7 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_next_result_timed(switch_pgsq
        char *err_str;
        struct pollfd fds[2] = { {0} };
        int poll_res = 0;
-       
+
        if(!handle) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "**BUG** Null handle passed to switch_pgsql_next_result.\n");
                return SWITCH_PGSQL_FAIL;
@@ -380,7 +380,7 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_next_result_timed(switch_pgsq
        }
        memset(res, 0, sizeof(switch_pgsql_result_t));
 
-       
+
        res->result = PQgetResult(handle->con);
        if (res->result) {
                *result_out = res;
@@ -630,7 +630,7 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_exec_base_detailed(con
                        free(er);
                }
        }
-       
+
        if (err_str) {
                if (!switch_stristr("already exists", err_str) && !switch_stristr("duplicate key name", err_str)) {
                        switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
@@ -676,7 +676,7 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_callback_exec_detailed
        if (switch_pgsql_handle_exec_base(handle, sql, err) == SWITCH_PGSQL_FAIL) {
                goto error;
        }
-       
+
        if (switch_pgsql_next_result(handle, &result) == SWITCH_PGSQL_FAIL) {
                err_cnt++;
                err_str = switch_pgsql_handle_get_error(handle);
@@ -711,7 +711,7 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_callback_exec_detailed
                                        names[col] = malloc(len+1);
                                        names[col][len] = '\0';
                                        strncpy(names[col], tmp, len);
-                                       
+
                                        len = PQgetlength(result->result, row, col);
                                        vals[col] = malloc(len+1);
                                        vals[col][len] = '\0';
@@ -851,7 +851,7 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_flush(switch_pgsql_handle_t *
                PQclear(tmp);
                x++;
        }
-       
+
        if (x) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Flushing %d results\n", x);
        }
index 0a9553f75bc3d33bc23e2491e3ddb0fb6a720069..863c304913b18b34d22ea6e72c204011cce16c67 100644 (file)
@@ -2,23 +2,23 @@
  * Copyright (c) 2009, Sangoma Technologies
  * Moises Silva <moy@sangoma.com>
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -44,7 +44,7 @@
 #include <errno.h>
 #endif
 
-struct profile_timer 
+struct profile_timer
 {
        /* bool, just used to retrieve the values for the first time and not calculate the percentage of idle time */
        int valid_last_times;
@@ -82,14 +82,14 @@ struct profile_timer
 };
 
 #ifdef __linux__
-static int read_cpu_stats(switch_profile_timer_t *p, 
-               unsigned long long *user, 
-               unsigned long long *nice, 
-               unsigned long long *system, 
-               unsigned long long *idle, 
-               unsigned long long *iowait, 
-               unsigned long long *irq, 
-               unsigned long long *softirq, 
+static int read_cpu_stats(switch_profile_timer_t *p,
+               unsigned long long *user,
+               unsigned long long *nice,
+               unsigned long long *system,
+               unsigned long long *idle,
+               unsigned long long *iowait,
+               unsigned long long *irq,
+               unsigned long long *softirq,
                unsigned long long *steal)
 {
 // the output of proc should not change that often from one kernel to other
@@ -247,11 +247,11 @@ SWITCH_DECLARE(switch_bool_t) switch_get_system_idle_time(switch_profile_timer_t
        FILETIME kernelTime;
        FILETIME userTime;
        __int64 i64UserTime, i64KernelTime, i64IdleTime;
-  
+
        if (!GetSystemTimes(&idleTime, &kernelTime, &userTime)) {
                return SWITCH_FALSE;
        }
-  
+
        i64UserTime = (__int64)userTime.dwLowDateTime | ((__int64)userTime.dwHighDateTime << 32);
 
        i64KernelTime = (__int64)kernelTime.dwLowDateTime | ((__int64)kernelTime.dwHighDateTime << 32);
index 2f6b969fc84c771e92d1753b05de82327eeb1fe6..6a3e067867e29dc3260f6af7fdfe77a4187805a8 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Michael Jerris <mike@jerris.com>
  *
  *
@@ -190,9 +190,9 @@ SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_c
 }
 
 
-SWITCH_DECLARE(void) switch_capture_regex(switch_regex_t *re, int match_count, const char *field_data, 
+SWITCH_DECLARE(void) switch_capture_regex(switch_regex_t *re, int match_count, const char *field_data,
                                                                                  int *ovector, const char *var, switch_cap_callback_t callback, void *user_data)
-                                                                                 
+
 {
 
 
index 1338303309f9760e2db13bd64ac72640c6f771b2..e9850b6a49c731fd1a988770d35132b7dee682c2 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
@@ -64,7 +64,7 @@ SWITCH_DECLARE(switch_status_t) switch_resample_perform_create(switch_audio_resa
        switch_zmalloc(resampler, sizeof(*resampler));
 
        if (!channels) channels = 1;
-       
+
        resampler->resampler = speex_resampler_init(channels, from_rate, to_rate, quality, &err);
 
        if (!resampler->resampler) {
@@ -80,7 +80,7 @@ SWITCH_DECLARE(switch_status_t) switch_resample_perform_create(switch_audio_resa
        resampler->factor = (lto_rate / lfrom_rate);
        resampler->rfactor = (lfrom_rate / lto_rate);
        resampler->channels = channels;
-       
+
        //resampler->to_size = resample_buffer(to_rate, from_rate, (uint32_t) to_size);
 
        resampler->to_size = switch_resample_calc_buffer_size(resampler->to_rate, resampler->from_rate, to_size) / 2;
@@ -99,7 +99,7 @@ SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resam
                resampler->to = realloc(resampler->to, resampler->to_size * sizeof(int16_t) * resampler->channels);
                switch_assert(resampler->to);
        }
-       
+
        resampler->to_len = resampler->to_size;
        speex_resampler_process_interleaved_int(resampler->resampler, src, &srclen, resampler->to, &resampler->to_len);
        return resampler->to_len;
@@ -217,11 +217,11 @@ SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples
                        sum_rnd += rnd2;
                }
 
-               s = (int16_t) ((int16_t) sum_rnd / (int) divisor);              
+               s = (int16_t) ((int16_t) sum_rnd / (int) divisor);
 
                for (j = 0; j < channels; j++) {
                        *data = s;
-                       data++;                 
+                       data++;
                }
 
 
@@ -299,12 +299,12 @@ SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, u
                }
 
                for (i = 0; i < samples; i++) {
-                       for (j = 0; j < channels; j++) { 
+                       for (j = 0; j < channels; j++) {
                                data[k++] = data[i + samples];
                        }
                }
 
-#else 
+#else
                uint32_t k = 0, len = samples * 2 * orig_channels;
                int16_t *orig = NULL;
 
@@ -312,11 +312,11 @@ SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, u
                memcpy(orig, data, len);
 
                for (i = 0; i < samples; i++) {
-                       for (j = 0; j < channels; j++) { 
+                       for (j = 0; j < channels; j++) {
                                data[k++] = orig[i];
                        }
                }
-               
+
                free(orig);
 #endif
 
@@ -340,9 +340,9 @@ SWITCH_DECLARE(void) switch_change_sln_volume_granular(int16_t *data, uint32_t s
        } else {
                chart = neg;
        }
-       
+
        i = abs(vol) - 1;
-       
+
        switch_assert(i < 13);
 
        newrate = chart[i];
@@ -379,9 +379,9 @@ SWITCH_DECLARE(void) switch_change_sln_volume(int16_t *data, uint32_t samples, i
        } else {
                chart = neg;
        }
-       
+
        i = abs(vol) - 1;
-       
+
        switch_assert(i < 4);
 
        newrate = chart[i];
index a5c5a8d48bf75aa389c8f0242a18ab0a62988edc..61e5ac7f6bc5ac8d43f59edddb474973e48c6a7f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  * Seven Du <dujinfang@gmail.com>
@@ -307,7 +307,7 @@ typedef struct ts_normalize_s {
 } ts_normalize_t;
 
 struct switch_rtp {
-       /* 
+       /*
         * Two sockets are needed because we might be transcoding protocol families
         * (e.g. receive over IPv4 and send over IPv6). In case the protocol
         * families are equal, sock_input == sock_output and only one socket is
@@ -358,9 +358,9 @@ struct switch_rtp {
 
        switch_dtls_t *dtls;
        switch_dtls_t *rtcp_dtls;
-       
+
        rtp_hdr_t last_rtp_hdr;
-       
+
        uint16_t seq;
        uint32_t ssrc;
        uint32_t remote_ssrc;
@@ -572,7 +572,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
 #endif
 
        if (rtp_session->dtmf_data.in_digit_sanity && !--rtp_session->dtmf_data.in_digit_sanity) {
-               
+
                rtp_session->dtmf_data.last_digit = 0;
                rtp_session->dtmf_data.in_digit_ts = 0;
                rtp_session->dtmf_data.in_digit_queued = 0;
@@ -582,12 +582,12 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
        if (!bytes) return RESULT_CONTINUE;
 
 
-       /* RFC2833 ... like all RFC RE: VoIP, guaranteed to drive you to insanity! 
+       /* RFC2833 ... like all RFC RE: VoIP, guaranteed to drive you to insanity!
           We know the real rules here, but if we enforce them, it's an interop nightmare so,
           we put up with as much as we can so we don't have to deal with being punished for
           doing it right. Nice guys finish last!
        */
-       
+
        if (bytes > rtp_header_len && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] &&
                rtp_session->last_rtp_hdr.pt == rtp_session->recv_te) {
                switch_size_t len = bytes - rtp_header_len;
@@ -674,7 +674,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
                                if (rtp_session->jb && (rtp_session->rtp_bugs & RTP_BUG_FLUSH_JB_ON_DTMF)) {
                                        switch_jb_reset(rtp_session->jb);
                                }
-                               
+
                        }
 
                        /* only set sanity if we do NOT ignore the packet */
@@ -682,7 +682,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
                                rtp_session->dtmf_data.in_digit_sanity = 2000;
                        }
 
-                       if (rtp_session->dtmf_data.last_duration > duration && 
+                       if (rtp_session->dtmf_data.last_duration > duration &&
                                rtp_session->dtmf_data.last_duration > 0xFC17 && ts == rtp_session->dtmf_data.in_digit_ts) {
                                rtp_session->dtmf_data.flip++;
                        }
@@ -714,7 +714,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n",
                                                   dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration);
 #endif
-                                               
+
                                        if (!(rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) && !rtp_session->dtmf_data.in_digit_queued) {
 #ifdef DEBUG_2833
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8);
@@ -766,7 +766,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
                        /* Drat, they are sending audio still as well as DTMF ok fine..... *sigh* */
                        rtp_session->dtmf_data.in_interleaved = 1;
                }
-                       
+
                if (rtp_session->dtmf_data.in_interleaved || (rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION)) {
                        if (rtp_session->last_rtp_hdr.pt == rtp_session->recv_te) {
                                return RESULT_GOTO_RECVFROM;
@@ -802,9 +802,9 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice)
        }
 
        ice->next_run = now + RTP_STUN_FREQ;
-               
+
        if (ice == &rtp_session->rtcp_ice && rtp_session->rtcp_sock_output) {
-               sock_output = rtp_session->rtcp_sock_output;            
+               sock_output = rtp_session->rtcp_sock_output;
        }
 
        if (!sock_output) {
@@ -862,7 +862,7 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice)
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "%s send %s stun\n", rtp_session_name(rtp_session), rtp_type(rtp_session));
 #endif
        switch_socket_sendto(sock_output, ice->addr, 0, (void *) packet, &bytes);
-                                                
+
        ice->sending = 3;
 
        // end:
@@ -894,7 +894,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
        int is_rtcp = ice == &rtp_session->rtcp_ice;
        uint32_t elapsed;
        switch_time_t ref_point;
-                               
+
        //if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
        //      switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "WTF OK %s CALL\n", rtp_type(rtp_session));
        //}
@@ -916,7 +916,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                cpylen = sizeof(buf);
        }
 
-       
+
        memcpy(buf, data, cpylen);
        packet = switch_stun_packet_parse(buf, (uint32_t)cpylen);
        if (!packet) {
@@ -930,20 +930,20 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
        if (!rtp_session->first_stun) {
                rtp_session->first_stun = rtp_session->last_stun;
        }
-       
+
        if (ice->last_ok) {
                ref_point = ice->last_ok;
        } else {
                ref_point = rtp_session->first_stun;
-       } 
-       
+       }
+
        elapsed = (unsigned int) ((switch_micro_time_now() - ref_point) / 1000);
 
 
        end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
 
        switch_stun_packet_first_attribute(packet, attr);
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "%s STUN PACKET TYPE: %s\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "%s STUN PACKET TYPE: %s\n",
                                          rtp_type(rtp_session), switch_stun_value_to_name(SWITCH_STUN_TYPE_PACKET_TYPE, packet->header.type));
        do {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|---: %s STUN ATTR %d %x %s\n", rtp_type(rtp_session), attr->type, attr->type,
@@ -1002,7 +1002,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|------: %s\n", username);
                        }
                        break;
-                       
+
                case SWITCH_STUN_ATTR_PRIORITY:
                        {
                                uint32_t priority = 0;
@@ -1028,7 +1028,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
        if (packet->header.type != SWITCH_STUN_BINDING_REQUEST && packet->header.type != SWITCH_STUN_BINDING_RESPONSE) {
                goto end;
        }
-       
+
        if ((ice->type & ICE_VANILLA)) {
                char foo1[13] = "", foo2[13] = "";
                if (!ok) ok = !memcmp(packet->header.id, ice->last_sent_id, 12);
@@ -1042,7 +1042,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                                } else {
                                        ice->rready = 1;
                                }
-                               
+
                                if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
                                        switch_core_session_video_reinit(rtp_session->session);
                                }
@@ -1052,7 +1052,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                memcpy(foo1, packet->header.id, 12);
                memcpy(foo2, ice->last_sent_id, 12);
 
-               if (!ok && ice == &rtp_session->ice && rtp_session->rtcp_ice.ice_params && pri && 
+               if (!ok && ice == &rtp_session->ice && rtp_session->rtcp_ice.ice_params && pri &&
                        *pri == rtp_session->rtcp_ice.ice_params->cands[rtp_session->rtcp_ice.ice_params->chosen[1]][1].priority) {
                        ice = &rtp_session->rtcp_ice;
                        ok = 1;
@@ -1083,7 +1083,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                                char bufb[50];
                                char adj_port[6];
                                switch_channel_t *channel = NULL;
-                               
+
 
                                ice->missed_count++;
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "missed %d\n", ice->missed_count);
@@ -1107,28 +1107,28 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
 
                                                        ice = icep[j];
                                                        ok = 1;
-                                                       
+
                                                        if (j != IPR_RTP) {
                                                                break;
                                                        }
 
                                                        old = rtp_session->remote_port;
-                                                       
+
                                                        //tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
                                                        old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
-                                                       
+
                                                        host = ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_addr;
                                                        port = ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_port;
 
                                                        if (!host || !port) {
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error setting remote host!\n");
-                                                               return;                                                         
+                                                               return;
                                                        }
-                                                       
+
                                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO,
                                                                                          "%s ICE Auto Changing port from %s:%u to %s:%u\n", rtp_type(rtp_session), old_host, old, host, port);
 
-                                                       
+
                                                        if (channel) {
                                                                switch_channel_set_variable(channel, "remote_media_ip_reported", switch_channel_get_variable(channel, "remote_media_ip"));
                                                                switch_channel_set_variable(channel, "remote_media_ip", host);
@@ -1141,20 +1141,20 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                                                        }
                                                        rtp_session->auto_adj_used = 1;
 
-                                                       
+
                                                        switch_rtp_set_remote_address(rtp_session, host, port, 0, SWITCH_FALSE, &err);
-                                                       if (switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || 
+                                                       if (switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS ||
                                                                !ice->addr) {
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error setting remote host!\n");
                                                                return;
                                                        }
-                                                       
+
                                                        if ((rtp_session->rtp_bugs & RTP_BUG_ALWAYS_AUTO_ADJUST)) {
                                                                switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
                                                        } else {
                                                                switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
                                                        }
-                                                       
+
                                                }
                                        }
                                }
@@ -1163,7 +1163,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
        }
 
        if (ice->missed_count > 5 && !(ice->type & ICE_GOOGLE_JINGLE)) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "missed too many: %d, looking for new ICE dest.\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "missed too many: %d, looking for new ICE dest.\n",
                                                  ice->missed_count);
                ice->rready = 0;
                ok = 1;
@@ -1173,7 +1173,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
        //if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] || 1) {
        //      switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "WTF OK %s %d\n", rtp_type(rtp_session), ok);
        //}
-       
+
        if (ok) {
                const char *host = NULL, *host2 = NULL;
                switch_port_t port = 0, port2 = 0;
@@ -1225,7 +1225,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                        port2 = switch_sockaddr_get_port(ice->addr);
                        cmp = switch_cmp_addr(from_addr, ice->addr);
 
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG4, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG4,
                                                          "STUN from %s:%d %s\n", host, port, cmp ? "EXPECTED" : "IGNORED");
 
                        if (cmp) {
@@ -1257,13 +1257,13 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                                                if (!strcmp(ice->ice_params->cands[i][ice->proto].con_addr, host) &&
                                                        ice->ice_params->cands[i][ice->proto].cand_type &&
                                                        !strcmp(ice->ice_params->cands[i][ice->proto].cand_type, "relay")) {
-                                                       
+
                                                        if (elapsed < 1000) {
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING,
-                                                                                                 "Skiping RELAY stun/%s/dtls port change from %s:%u to %s:%u\n", is_rtcp ? "rtcp" : "rtp", 
+                                                                                                 "Skiping RELAY stun/%s/dtls port change from %s:%u to %s:%u\n", is_rtcp ? "rtcp" : "rtp",
                                                                                                  host2, port2,
                                                                                                  host, port);
-                                                       
+
                                                                goto end;
                                                        }
 
@@ -1273,7 +1273,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                                }
 
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE,
-                                                                 "Auto Changing %s stun/%s/dtls port from %s:%u to %s:%u\n", rtp_type(rtp_session), is_rtcp ? "rtcp" : "rtp", 
+                                                                 "Auto Changing %s stun/%s/dtls port from %s:%u to %s:%u\n", rtp_type(rtp_session), is_rtcp ? "rtcp" : "rtp",
                                                                  host2, port2,
                                                                  host, port);
 
@@ -1286,15 +1286,15 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
                        }
                }
        } else if (packet->header.type == SWITCH_STUN_BINDING_ERROR_RESPONSE) {
-               
+
                if (rtp_session->session) {
                        switch_core_session_message_t msg = { 0 };
                        msg.from = __FILE__;
                        msg.numeric_arg = packet->header.type;
                        msg.pointer_arg = packet;
                        msg.message_id = SWITCH_MESSAGE_INDICATE_STUN_ERROR;
-                       switch_core_session_receive_message(rtp_session->session, &msg);                        
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, 
+                       switch_core_session_receive_message(rtp_session->session, &msg);
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG,
                                                          "STUN/ICE binding error received on %s channel\n", rtp_type(rtp_session));
                }
 
@@ -1333,7 +1333,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
 {
        switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream);
        zrtp_session_info_t zrtp_session_info;
-       
+
        switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
        switch_event_t *fsevent = NULL;
        const char *type;
@@ -1360,7 +1360,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
                        }
 
                        if (!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
-                               
+
 
                                if (rtp_session->session) {
                                        switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
@@ -1531,7 +1531,7 @@ static uint8_t get_next_write_ts(switch_rtp_t *rtp_session, uint32_t timestamp)
                rtp_session->ts += rtp_session->samples_per_interval;
                if (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->ts > 0) {
                        rtp_session->ts = rtp_session->last_write_ts + rtp_session->samples_per_interval;
-               }               
+               }
        }
 
        return m;
@@ -1543,7 +1543,7 @@ static void do_mos(switch_rtp_t *rtp_session, int force) {
                rtp_session->stats.inbound.flaws = 0;
        }
 
-       if (rtp_session->stats.inbound.recved > 0 && 
+       if (rtp_session->stats.inbound.recved > 0 &&
                rtp_session->stats.inbound.flaws && (force || rtp_session->stats.inbound.last_flaw != rtp_session->stats.inbound.flaws)) {
                int R;
 
@@ -1555,13 +1555,13 @@ static void do_mos(switch_rtp_t *rtp_session, int force) {
                        if (diff < 1) diff = 1;
 
                        penalty = diff * 2;
-                       
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "%s %s %d consecutive flaws, adding %d flaw penalty\n", 
-                                                         rtp_session_name(rtp_session), rtp_type(rtp_session), 
+
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "%s %s %d consecutive flaws, adding %d flaw penalty\n",
+                                                         rtp_session_name(rtp_session), rtp_type(rtp_session),
                                                          rtp_session->consecutive_flaws, penalty);
                        rtp_session->bad_stream++;
                        rtp_session->stats.inbound.flaws += penalty;
-                       
+
                        if (rtp_session->stats.inbound.error_log) {
                                rtp_session->stats.inbound.error_log->flaws += penalty;
                                rtp_session->stats.inbound.error_log->consecutive_flaws++;
@@ -1569,7 +1569,7 @@ static void do_mos(switch_rtp_t *rtp_session, int force) {
                }
 
                R = (int)((double)((double)(rtp_session->stats.inbound.recved - rtp_session->stats.inbound.flaws) / (double)rtp_session->stats.inbound.recved) * 100.0);
-               
+
                if (R < 0 || R > 100) R = 100;
 
                rtp_session->stats.inbound.R = R;
@@ -1652,7 +1652,7 @@ static void check_jitter(switch_rtp_t *rtp_session)
        if (rtp_session->stats.inbound.last_processed_seq > 0 && seq > (int)(rtp_session->stats.inbound.last_processed_seq + 1)) {
                int lost = (seq - rtp_session->stats.inbound.last_processed_seq - 1);
 
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "%s Got: %s seq %d but expected: %d lost: %d\n", 
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "%s Got: %s seq %d but expected: %d lost: %d\n",
                                                  rtp_session_name(rtp_session),
                                                  rtp_type(rtp_session),
                                                  seq,
@@ -1673,7 +1673,7 @@ static void check_jitter(switch_rtp_t *rtp_session)
        } else {
                rtp_session->stats.inbound.last_loss = 0;
        }
-       
+
        rtp_session->stats.inbound.last_processed_seq = seq;
 
        /* Burst and Packet Loss */
@@ -1686,7 +1686,7 @@ static void check_jitter(switch_rtp_t *rtp_session)
        } else {
                do_mos(rtp_session, SWITCH_FALSE);
        }
-       
+
        if (rtp_session->stats.inbound.last_loss || rtp_session->bad_stream) {
                if (rtp_session->session && (!rtp_session->stats.inbound.error_log || rtp_session->stats.inbound.error_log->stop)) {
                        struct error_period *error = switch_core_session_alloc(rtp_session->session, sizeof(*error));
@@ -1711,12 +1711,12 @@ static void check_jitter(switch_rtp_t *rtp_session)
                rtp_session->recovering_stream = 0;
                rtp_session->clean_stream++;
        }
-       
+
 
        if ( diff_time < 0 ) {
                diff_time = -diff_time;
        }
-       
+
        rtp_session->stats.inbound.jitter_n++;
        rtp_session->stats.inbound.jitter_add += diff_time;
 
@@ -1725,7 +1725,7 @@ static void check_jitter(switch_rtp_t *rtp_session)
        } else {
                cur_diff = 0;
        }
-       
+
        rtp_session->stats.inbound.jitter_addsq += (cur_diff * cur_diff);
        rtp_session->stats.inbound.last_proc_time = current_time;
 
@@ -1739,9 +1739,9 @@ static void check_jitter(switch_rtp_t *rtp_session)
                }
 
                rtp_session->stats.inbound.variance = (double)rtp_session->stats.inbound.jitter_addsq / (double)rtp_session->stats.inbound.jitter_n;
-               
+
                //printf("CHECK %d +%ld +%ld %f %f\n", rtp_session->timer.samplecount, diff_time, (diff_time * diff_time), rtp_session->stats.inbound.mean_interval, rtp_session->stats.inbound.variance);
-               
+
                ipdv = rtp_session->old_mean - rtp_session->stats.inbound.mean_interval;
 
                if ( ipdv > IPDV_THRESHOLD ) { /* It shows Increasing Delays */
@@ -1806,7 +1806,7 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_
        } else {
                expected_pkt = stats->high_ext_seq_recv - stats->last_rpt_ext_seq;
        }
-       
+
        pkt_lost = expected_pkt - stats->period_pkt_count;
        stats->cum_lost=stats->cum_lost+pkt_lost;
        if (expected_pkt > 0 && pkt_lost > 0) {
@@ -1878,7 +1878,7 @@ static void rtcp_stats_init(switch_rtp_t *rtp_session)
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats_init: %s ssrc[%u] base_seq[%u]\n", rtp_type(rtp_session), stats->ssrc, stats->base_seq);
        }
 
-       if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && (switch_core_media_codec_get_cap(rtp_session->session, 
+       if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && (switch_core_media_codec_get_cap(rtp_session->session,
                                                                                                                        SWITCH_MEDIA_TYPE_AUDIO, SWITCH_CODEC_FLAG_HAS_ADJ_BITRATE))) {
                        kalman_estimator_t *estimators[KALMAN_SYSTEM_MODELS];
                        cusum_kalman_detector_t *detectors[KALMAN_SYSTEM_MODELS];
@@ -1985,7 +1985,7 @@ static void calc_bw_exp(uint32_t bps, uint8_t bits, rtcp_tmmbx_t *tmmbx)
                        break;
                }
        }
-       
+
        mantissa = (bps >> exp);
 
        tmmbx->parts[0] = (uint8_t) ((exp << 2) + ((mantissa >> 15) & 0x03));
@@ -2024,9 +2024,9 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
 
                get_next_write_ts(rtp_session, 0);
                rtp_session->send_msg.header.ts = htonl(rtp_session->ts);
-               
+
                switch_rtp_write_manual(rtp_session, (void *) data, 2, 0, rtp_session->cng_pt, ntohl(rtp_session->send_msg.header.ts), &frame_flags);
-               
+
                if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
                        rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
                }
@@ -2058,12 +2058,12 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
        }
 
        //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "TIME CHECK %d > %d\n", (int)((now - rtp_session->rtcp_last_sent) / 1000), rate);
-       
+
        if (!rtcp_ok && (!rtp_session->rtcp_last_sent || (int)((now - rtp_session->rtcp_last_sent) / 1000) > rate)) {
                //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "TIME UP\n");
                rtcp_ok = 1;
        }
-       
+
        if (rtcp_ok && using_ice(rtp_session)) {
                if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
                        if (!rtp_session->ice.rready) {
@@ -2077,7 +2077,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
        }
 
        //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "WTF %d %d %d %d\n", rate, rtp_session->rtcp_sent_packets, rtcp_ok, nack_ttl);
-       
+
        if (rtp_session->rtcp_sock_output && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] && rtcp_ok) {
                switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp;
                struct switch_rtcp_receiver_report *rr;
@@ -2094,12 +2094,12 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                        rtp_session->rtcp_last_sent = now;
                        rtp_session->rtcp_sent_packets++;
                }
-               
+
                rtp_session->rtcp_send_msg.header.version = 2;
                rtp_session->rtcp_send_msg.header.p = 0;
                rtp_session->rtcp_send_msg.header.count = 1;
 
-               
+
                if (!rtp_session->stats.rtcp.sent_pkt_count) {
                        rtp_session->rtcp_send_msg.header.type = _RTCP_PT_RR; /* Receiver report */
                        rr=(struct switch_rtcp_receiver_report*) rtp_session->rtcp_send_msg.body;
@@ -2126,19 +2126,19 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
 
                                p = (uint8_t *) (&rtp_session->rtcp_send_msg) + rtcp_bytes;
                                ext_hdr = (switch_rtcp_ext_hdr_t *) p;
-                       
+
                                ext_hdr->version = 2;
                                ext_hdr->p = 0;
                                ext_hdr->fmt = _RTCP_PSFB_PLI;
                                ext_hdr->pt = _RTCP_PT_PSFB;
-                       
+
                                ext_hdr->send_ssrc = htonl(rtp_session->ssrc);
                                ext_hdr->recv_ssrc = htonl(rtp_session->remote_ssrc);
-                       
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP PLI %u %u\n", 
+
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP PLI %u %u\n",
                                                                  rtp_session->ssrc, rtp_session->remote_ssrc);
-                       
-                               ext_hdr->length = htons((uint8_t)(sizeof(switch_rtcp_ext_hdr_t) / 4) - 1); 
+
+                               ext_hdr->length = htons((uint8_t)(sizeof(switch_rtcp_ext_hdr_t) / 4) - 1);
                                rtcp_bytes += sizeof(switch_rtcp_ext_hdr_t);
                                rtp_session->pli_count = 0;
                        }
@@ -2151,7 +2151,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                                        uint32_t *nack;
                                        p = (uint8_t *) (&rtp_session->rtcp_send_msg) + rtcp_bytes;
                                        ext_hdr = (switch_rtcp_ext_hdr_t *) p;
-                                       
+
                                        ext_hdr->version = 2;
                                        ext_hdr->p = 0;
                                        ext_hdr->fmt = _RTCP_RTPFB_NACK;
@@ -2163,16 +2163,16 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                                        nack = (uint32_t *) p;
                                        *nack = cur_nack[n];
 
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP NACK %u\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP NACK %u\n",
                                                                          ntohs(*nack & 0xFFFF));
-                               
+
                                        rtcp_bytes += sizeof(switch_rtcp_ext_hdr_t) + sizeof(cur_nack[n]);
                                        cur_nack[n] = 0;
                                }
 
                                nack_ttl = 0;
                        }
-                       
+
                        if (rtp_session->fir_count) {
                                switch_rtcp_ext_hdr_t *ext_hdr;
                                rtcp_fir_t *fir;
@@ -2180,7 +2180,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                                if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_OLD_FIR)) {
                                        p = (uint8_t *) (&rtp_session->rtcp_send_msg) + rtcp_bytes;
                                        ext_hdr = (switch_rtcp_ext_hdr_t *) p;
-                                       
+
                                        ext_hdr->version = 2;
                                        ext_hdr->pt = _RTCP_PT_FIR;
                                        rtcp_bytes += sizeof(switch_rtcp_ext_hdr_t);
@@ -2192,15 +2192,15 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
 
                                p += sizeof(switch_rtcp_ext_hdr_t);
                                fir = (rtcp_fir_t *) p;
-                       
+
                                ext_hdr->version = 2;
                                ext_hdr->p = 0;
                                ext_hdr->fmt = _RTCP_PSFB_FIR;
                                ext_hdr->pt = _RTCP_PT_PSFB;
-                       
+
                                ext_hdr->send_ssrc = htonl(rtp_session->ssrc);
                                ext_hdr->recv_ssrc = 0;
-                       
+
                                fir->ssrc = htonl(rtp_session->remote_ssrc);
                                fir->seq = rtp_session->fir_seq;
                                fir->r1 = fir->r2 = fir->r3 = 0;
@@ -2208,8 +2208,8 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP FIR SEQ %d\n", rtp_session->fir_seq);
 
                                rtp_session->fir_seq++;
-                       
-                               ext_hdr->length = htons((uint8_t)((sizeof(switch_rtcp_ext_hdr_t) + sizeof(rtcp_fir_t)) / 4) - 1); 
+
+                               ext_hdr->length = htons((uint8_t)((sizeof(switch_rtcp_ext_hdr_t) + sizeof(rtcp_fir_t)) / 4) - 1);
                                rtcp_bytes += sizeof(switch_rtcp_ext_hdr_t) + sizeof(rtcp_fir_t);
                                rtp_session->fir_count = 0;
                        }
@@ -2248,9 +2248,9 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
 
                                tmmbx->ssrc = htonl(rtp_session->remote_ssrc);
                                calc_bw_exp(bps, 17, tmmbx);
-                               
+
                                ext_hdr->length = htons((uint8_t)((sizeof(switch_rtcp_ext_hdr_t) + sizeof(rtcp_tmmbx_t)) / 4) - 1);
-                               rtcp_bytes += sizeof(switch_rtcp_ext_hdr_t) + sizeof(rtcp_tmmbx_t);                     
+                               rtcp_bytes += sizeof(switch_rtcp_ext_hdr_t) + sizeof(rtcp_tmmbx_t);
                        }
 
                }
@@ -2281,12 +2281,12 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                unit->type = _RTCP_SDES_NOTE;
                snprintf((char *)unit->value, 80, "FreeSWITCH.org -- Come to ClueCon.com");
                unit->length = strlen((char *)unit->value);
-               sdes_bytes += sizeof(switch_rtcp_sdes_unit_t) + unit->length;           
+               sdes_bytes += sizeof(switch_rtcp_sdes_unit_t) + unit->length;
 
                sdes_bytes ++;//END
 
                sdes_bytes += 4 - (sdes_bytes % 4);
-               
+
                sdes->length = htons((uint16_t)(sdes_bytes / 4) - 1);
                rtcp_bytes += sdes_bytes;
 
@@ -2304,7 +2304,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) {
                        int sbytes = (int) rtcp_bytes;
                        int stat = srtp_protect_rtcp(rtp_session->send_ctx[rtp_session->srtp_idx_rtcp], &rtp_session->rtcp_send_msg.header, &sbytes);
-                       
+
                        if (stat) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error: SRTP RTCP protection failed with code %d\n", stat);
                                goto end;
@@ -2347,7 +2347,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                        const char *old_host;
                        char bufb[50];
                        old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->rtcp_remote_addr);
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "%s SEND %s RTCP %s:%d %ld\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "%s SEND %s RTCP %s:%d %ld\n",
                                                          rtp_session_name(rtp_session),
                                                          rtp_type(rtp_session),
                                                          old_host,
@@ -2355,13 +2355,13 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
                                                          rtcp_bytes);
                }
 #endif
-               if (switch_socket_sendto(rtp_session->rtcp_sock_output, rtp_session->rtcp_remote_addr, 0, (void *)&rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) {                        
+               if (switch_socket_sendto(rtp_session->rtcp_sock_output, rtp_session->rtcp_remote_addr, 0, (void *)&rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG,"RTCP packet not written\n");
                } else {
                        rtp_session->stats.inbound.period_packet_count = 0;
                }
        }
-       
+
        if (rtp_session->ice.ice_user) {
                if (ice_out(rtp_session, &rtp_session->ice) == SWITCH_STATUS_GENERR) {
                        ret = -1;
@@ -2529,26 +2529,26 @@ SWITCH_DECLARE(void) switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, swit
 
 
 static switch_status_t enable_remote_rtcp_socket(switch_rtp_t *rtp_session, const char **err) {
-       
+
        switch_status_t status = SWITCH_STATUS_SUCCESS;
 
        if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) {
 
-               if (switch_sockaddr_info_get(&rtp_session->rtcp_remote_addr, rtp_session->eff_remote_host_str, SWITCH_UNSPEC, 
+               if (switch_sockaddr_info_get(&rtp_session->rtcp_remote_addr, rtp_session->eff_remote_host_str, SWITCH_UNSPEC,
                                                                         rtp_session->remote_rtcp_port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !rtp_session->rtcp_remote_addr) {
                        *err = "RTCP Remote Address Error!";
                        return SWITCH_STATUS_FALSE;
                } else {
                        const char *host;
                        char bufa[50];
-                       
+
                        host = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_remote_addr);
 
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG,
                                                          "Setting RTCP remote addr to %s:%d %d\n", host, rtp_session->remote_rtcp_port, rtp_session->rtcp_remote_addr->family);
                }
 
-               if (rtp_session->rtcp_sock_input && switch_sockaddr_get_family(rtp_session->rtcp_remote_addr) == 
+               if (rtp_session->rtcp_sock_input && switch_sockaddr_get_family(rtp_session->rtcp_remote_addr) ==
                        switch_sockaddr_get_family(rtp_session->rtcp_local_addr)) {
                        rtp_session->rtcp_sock_output = rtp_session->rtcp_sock_input;
                } else {
@@ -2567,9 +2567,9 @@ static switch_status_t enable_remote_rtcp_socket(switch_rtp_t *rtp_session, cons
        } else {
                *err = "RTCP NOT ACTIVE!";
        }
-       
+
        return status;
-       
+
 }
 
 static switch_status_t enable_local_rtcp_socket(switch_rtp_t *rtp_session, const char **err) {
@@ -2585,22 +2585,22 @@ static switch_status_t enable_local_rtcp_socket(switch_rtp_t *rtp_session, const
                        *err = "RTCP Local Address Error!";
                        goto done;
                }
-               
+
                if (switch_socket_create(&rtcp_new_sock, switch_sockaddr_get_family(rtp_session->rtcp_local_addr), SOCK_DGRAM, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS) {
                        *err = "RTCP Socket Error!";
                        goto done;
                }
-               
+
                if (switch_socket_opt_set(rtcp_new_sock, SWITCH_SO_REUSEADDR, 1) != SWITCH_STATUS_SUCCESS) {
                        *err = "RTCP Socket Error!";
                        goto done;
                }
-               
+
                if (switch_socket_bind(rtcp_new_sock, rtp_session->rtcp_local_addr) != SWITCH_STATUS_SUCCESS) {
                        *err = "RTCP Bind Error!";
                        goto done;
                }
-               
+
                if (switch_sockaddr_info_get(&rtp_session->rtcp_from_addr, switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr),
                                                                                         SWITCH_UNSPEC, switch_sockaddr_get_port(rtp_session->from_addr) + 1, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS) {
                        *err = "RTCP From Address Error!";
@@ -2614,9 +2614,9 @@ static switch_status_t enable_local_rtcp_socket(switch_rtp_t *rtp_session, const
                switch_socket_create_pollset(&rtp_session->rtcp_read_pollfd, rtp_session->rtcp_sock_input, SWITCH_POLLIN | SWITCH_POLLERR, rtp_session->pool);
 
  done:
-               
+
                if (*err) {
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error allocating rtcp [%s]\n", *err);
                        status = SWITCH_STATUS_FALSE;
                }
@@ -2624,7 +2624,7 @@ static switch_status_t enable_local_rtcp_socket(switch_rtp_t *rtp_session, const
                if (rtcp_new_sock) {
                        switch_socket_close(rtcp_new_sock);
                }
-                       
+
                if (rtcp_old_sock) {
                        switch_socket_close(rtcp_old_sock);
                }
@@ -2677,7 +2677,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
                goto done;
        }
 
-       
+
        if (rtp_session->sock_input) {
                switch_rtp_kill_socket(rtp_session);
        }
@@ -2709,7 +2709,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
                        *err = "Multicast Socket interface Error";
                        goto done;
                }
-               
+
                if (switch_mcast_join(new_sock, rtp_session->local_addr, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                        *err = "Multicast Error";
                        goto done;
@@ -2727,7 +2727,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
                                                *err = "Mutlicast TTL set failed";
                                                goto done;
                                        }
-                                       
+
                                }
                        }
 
@@ -2781,7 +2781,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
                status = SWITCH_STATUS_SUCCESS;
                *err = "Success";
        }
-       
+
        switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_IO);
 
  done:
@@ -2810,7 +2810,7 @@ SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session
        }
 
        if (rtp_session->missed_count >= max) {
-               
+
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING,
                                                  "new max missed packets(%d->%d) greater than current missed packets(%d). RTP will timeout.\n",
                                                  rtp_session->missed_count, max, rtp_session->missed_count);
@@ -2855,12 +2855,12 @@ SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session)
        rtp_session->rtcp_sent_packets = 0;
        rtp_session->rtcp_last_sent = 0;
        rtp_session->ice_adj = 0;
-       
+
        //switch_rtp_del_dtls(rtp_session, DTLS_TYPE_RTP|DTLS_TYPE_RTCP);
        switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_PAUSE);
        switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_MUTE);
        rtcp_stats_init(rtp_session);
-       
+
        if (rtp_session->ice.ready) {
                switch_rtp_reset_vb(rtp_session);
                rtp_session->ice.ready = rtp_session->ice.rready = 0;
@@ -2894,7 +2894,7 @@ static void ping_socket(switch_rtp_t *rtp_session)
        }
 }
 
-SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session) 
+SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session)
 {
        switch_socket_t *sock;
 
@@ -2929,7 +2929,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session)
                        switch_socket_shutdown(rtp_session->rtcp_sock_input, SWITCH_SHUTDOWN_READWRITE);
                }
 
-               if (rtp_session->rtcp_sock_output && rtp_session->rtcp_sock_output != rtp_session->rtcp_sock_input && 
+               if (rtp_session->rtcp_sock_output && rtp_session->rtcp_sock_output != rtp_session->rtcp_sock_input &&
                        rtp_session->rtcp_sock_output != rtp_session->sock_input) {
                        switch_socket_shutdown(rtp_session->rtcp_sock_output, SWITCH_SHUTDOWN_READWRITE);
                }
@@ -2937,7 +2937,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session)
                if ((sock = rtp_session->rtcp_sock_input)) {
                        rtp_session->rtcp_sock_input = NULL;
                        switch_socket_close(sock);
-                       
+
                        if (rtp_session->rtcp_sock_output && rtp_session->rtcp_sock_output != sock) {
                                if ((sock = rtp_session->rtcp_sock_output)) {
                                        rtp_session->rtcp_sock_output = NULL;
@@ -2951,7 +2951,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session)
        switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA);
        switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, FALSE);
        switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
-               
+
        WRITE_DEC(rtp_session);
        READ_DEC(rtp_session);
 
@@ -2959,7 +2959,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session)
        switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
 
        switch_rtp_break(rtp_session);
-       
+
        return SWITCH_STATUS_SUCCESS;
 
 }
@@ -3014,7 +3014,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_
 
 
        if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) {
-               if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {     
+               if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
                        rtp_session->rtcp_remote_addr = rtp_session->remote_addr;
                        rtp_session->rtcp_sock_output = rtp_session->sock_output;
                }/* else {
@@ -3024,7 +3024,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_
                                rtp_session->remote_rtcp_port = rtp_session->eff_remote_port + 1;
                        }
                        status = enable_remote_rtcp_socket(rtp_session, err);
-                       
+
                        if (rtp_session->rtcp_dtls) {
                                //switch_sockaddr_info_get(&rtp_session->rtcp_dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool);
                                rtp_session->rtcp_dtls->remote_addr = rtp_session->rtcp_remote_addr;
@@ -3077,7 +3077,7 @@ static int dtls_state_setup(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
                uint8_t raw_key_data[cr_kslen*2] = { 0 };
                unsigned char *local_key, *remote_key, *local_salt, *remote_salt;
                unsigned char local_key_buf[cr_kslen] = {0}, remote_key_buf[cr_kslen] = {0};
-               
+
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, "%s Fingerprint Verified.\n", rtp_type(rtp_session));
 
 #ifdef HAVE_OPENSSL_DTLS_SRTP
@@ -3089,13 +3089,13 @@ static int dtls_state_setup(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
 #else
                return -1;
 #endif
-               
+
                if ((dtls->type & DTLS_TYPE_CLIENT)) {
                        local_key = raw_key_data;
                        remote_key = local_key + cr_keylen;
                        local_salt = remote_key + cr_keylen;
                        remote_salt = local_salt + cr_saltlen;
-                       
+
                } else {
                        remote_key = raw_key_data;
                        local_key = remote_key + cr_keylen;
@@ -3108,7 +3108,7 @@ static int dtls_state_setup(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
 
                memcpy(remote_key_buf, remote_key, cr_keylen);
                memcpy(remote_key_buf + cr_keylen, remote_salt, cr_saltlen);
-               
+
                if (dtls == rtp_session->rtcp_dtls && rtp_session->rtcp_dtls != rtp_session->dtls) {
                        switch_rtp_add_crypto_key(rtp_session, SWITCH_RTP_CRYPTO_SEND_RTCP, 0, AES_CM_128_HMAC_SHA1_80, local_key_buf, cr_kslen);
                        switch_rtp_add_crypto_key(rtp_session, SWITCH_RTP_CRYPTO_RECV_RTCP, 0, AES_CM_128_HMAC_SHA1_80, remote_key_buf, cr_kslen);
@@ -3129,7 +3129,7 @@ static int dtls_state_ready(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
        if (dtls->new_state) {
                if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
                        switch_core_session_t *other_session;
-                       
+
                        if (rtp_session->session && switch_core_session_get_partner(rtp_session->session, &other_session) == SWITCH_STATUS_SUCCESS) {
                                switch_core_session_request_video_refresh(other_session);
                                switch_core_session_rwunlock(other_session);
@@ -3201,7 +3201,7 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
        switch_size_t bytes;
        unsigned char buf[4096] = "";
        int ready = rtp_session->ice.ice_user ? (rtp_session->ice.rready && rtp_session->ice.ready) : 1;
-       
+
 
        if (!dtls->bytes && !ready) {
                return 0;
@@ -3211,7 +3211,7 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
                ret = SSL_get_error(dtls->ssl, ret);
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "%s DTLS packet read err %d\n", rtp_type(rtp_session), ret);
        }
-       
+
        if (dtls_states[dtls->state]) {
                r = dtls_states[dtls->state](rtp_session, dtls);
        }
@@ -3225,7 +3225,7 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
        }
 
 
-       
+
        return r;
 }
 
@@ -3246,7 +3246,7 @@ static int cb_verify_peer(int preverify_ok, X509_STORE_CTX *ctx)
 
        if ((cert = SSL_get_peer_certificate(dtls->ssl))) {
                switch_core_cert_extract_fingerprint(cert, dtls->remote_fp);
-               
+
                r = switch_core_cert_verify(dtls->remote_fp);
 
                X509_free(cert);
@@ -3294,11 +3294,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, d
                if (rtp_session->dtls && rtp_session->dtls == rtp_session->rtcp_dtls) {
                        rtp_session->rtcp_dtls = NULL;
                }
-               
+
                if (rtp_session->dtls) {
                        free_dtls(&rtp_session->dtls);
                }
-               
+
                if (rtp_session->jb) {
                        switch_jb_reset(rtp_session->jb);
                }
@@ -3363,13 +3363,13 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
        if (!switch_rtp_ready(rtp_session)) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if (!((type & DTLS_TYPE_RTP) || (type & DTLS_TYPE_RTCP)) || !((type & DTLS_TYPE_CLIENT) || (type & DTLS_TYPE_SERVER))) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "INVALID TYPE!\n");
        }
 
        switch_rtp_del_dtls(rtp_session, type);
-       
+
        if ((type & DTLS_TYPE_RTP) && (type & DTLS_TYPE_RTCP)) {
                kind = "RTP/RTCP";
        } else if ((type & DTLS_TYPE_RTP)) {
@@ -3378,7 +3378,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
                kind = "RTCP";
        }
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO,
                                          "Activate %s %s DTLS %s\n", kind, rtp_type(rtp_session), (type & DTLS_TYPE_SERVER) ? "server" : "client");
 
        if (((type & DTLS_TYPE_RTP) && rtp_session->dtls) || ((type & DTLS_TYPE_RTCP) && rtp_session->rtcp_dtls)) {
@@ -3398,7 +3398,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
        }
 
        dtls->ca = switch_core_sprintf(rtp_session->pool, "%s%sca-bundle.crt", SWITCH_GLOBAL_dirs.certs_dir, SWITCH_PATH_SEPARATOR);
-               
+
        dtls->ssl_ctx = SSL_CTX_new((type & DTLS_TYPE_SERVER) ? DTLSv1_server_method() : DTLSv1_client_method());
        switch_assert(dtls->ssl_ctx);
 
@@ -3413,7 +3413,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
        SSL_CTX_set_mode(dtls->ssl_ctx, SSL_MODE_AUTO_RETRY);
 
        //SSL_CTX_set_verify(dtls->ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
-       SSL_CTX_set_verify(dtls->ssl_ctx, SSL_VERIFY_NONE, NULL); 
+       SSL_CTX_set_verify(dtls->ssl_ctx, SSL_VERIFY_NONE, NULL);
 
        SSL_CTX_set_cipher_list(dtls->ssl_ctx, "ECDH:!RC4:!SSLv3:RSA_WITH_AES_128_CBC_SHA");
        //SSL_CTX_set_cipher_list(dtls->ssl_ctx, "ECDHE-RSA-AES256-GCM-SHA384");
@@ -3424,14 +3424,14 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
        //SSL_CTX_set_tlsext_use_srtp(dtls->ssl_ctx, "SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32");
        SSL_CTX_set_tlsext_use_srtp(dtls->ssl_ctx, "SRTP_AES128_CM_SHA1_80");
 #endif
-       
+
        dtls->type = type;
        dtls->read_bio = BIO_new(BIO_s_mem());
        switch_assert(dtls->read_bio);
 
        dtls->write_bio = BIO_new(BIO_s_mem());
        switch_assert(dtls->write_bio);
-               
+
        BIO_set_mem_eof_return(dtls->read_bio, -1);
        BIO_set_mem_eof_return(dtls->write_bio, -1);
 
@@ -3450,7 +3450,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
                return SWITCH_STATUS_FALSE;
        }
 
-       if (!zstr(dtls->ca) && switch_file_exists(dtls->ca, rtp_session->pool) == SWITCH_STATUS_SUCCESS 
+       if (!zstr(dtls->ca) && switch_file_exists(dtls->ca, rtp_session->pool) == SWITCH_STATUS_SUCCESS
                && (ret = SSL_CTX_load_verify_locations(dtls->ssl_ctx, dtls->ca, NULL)) != 1) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "%s DTLS check chain cert failed [%d]\n",
                                                  rtp_type(rtp_session) ,
@@ -3489,7 +3489,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
        dtls->local_fp = local_fp;
        dtls->remote_fp = remote_fp;
        dtls->rtp_session = rtp_session;
-               
+
        switch_core_cert_expand_fingerprint(remote_fp, remote_fp->str);
 
        if ((type & DTLS_TYPE_RTP)) {
@@ -3516,9 +3516,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
 
        rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_BREAK] = 1;
        switch_rtp_break(rtp_session);
-               
+
        return SWITCH_STATUS_SUCCESS;
-       
+
 }
 
 
@@ -3534,7 +3534,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
        srtp_policy_t *policy;
        err_status_t stat;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
-       
+
        switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
        switch_event_t *fsevent = NULL;
        int idx = 0;
@@ -3645,7 +3645,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
        case AES_CM_128_NULL_AUTH:
                crypto_policy_set_aes_cm_128_null_auth(&policy->rtp);
                crypto_policy_set_aes_cm_128_null_auth(&policy->rtcp);
-               
+
                if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
                        switch_channel_set_variable(channel, "rtp_has_crypto", "AES_CM_128_NULL_AUTH");
                }
@@ -3656,7 +3656,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
 
        policy->key = (uint8_t *) crypto_key->key;
        policy->next = NULL;
-       
+
        policy->window_size = 1024;
        policy->allow_repeat_tx = 1;
 
@@ -3675,7 +3675,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
                        }
 
                        if (status == SWITCH_STATUS_SUCCESS) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, "Activating %s Secure %s RECV\n", 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, "Activating %s Secure %s RECV\n",
                                                                  rtp_type(rtp_session), idx ? "RTCP" : "RTP");
                                rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] = 1;
                        } else {
@@ -3762,11 +3762,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_ses
                if ((status = switch_core_timer_init(&rtp_session->timer,
                                                                                         rtp_session->timer_name, ms_per_packet / 1000,
                                                                                         samples_per_interval, rtp_session->pool)) == SWITCH_STATUS_SUCCESS) {
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG,
                                                          "RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet / 1000);
                } else {
-                       
+
                        memset(&rtp_session->timer, 0, sizeof(rtp_session->timer));
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR,
                                                          "Problem RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet / 1000);
@@ -3779,7 +3779,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_ses
        return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_rtp_set_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc) 
+SWITCH_DECLARE(switch_status_t) switch_rtp_set_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc)
 {
        rtp_session->ssrc = ssrc;
        rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc);
@@ -3787,7 +3787,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_ssrc(switch_rtp_t *rtp_session, u
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc) 
+SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc)
 {
        rtp_session->remote_ssrc = ssrc;
        rtp_session->flags[SWITCH_RTP_FLAG_DETECT_SSRC] = 0;
@@ -3823,7 +3823,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
        rtp_session->recv_te = INVALID_PT;
        rtp_session->cng_pt = INVALID_PT;
        rtp_session->session = session;
-       
+
        switch_mutex_init(&rtp_session->flag_mutex, SWITCH_MUTEX_NESTED, pool);
        switch_mutex_init(&rtp_session->read_mutex, SWITCH_MUTEX_NESTED, pool);
        switch_mutex_init(&rtp_session->write_mutex, SWITCH_MUTEX_NESTED, pool);
@@ -3990,7 +3990,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
        rtp_session->stats.inbound.jitter_addsq = 0;
        rtp_session->stats.inbound.min_variance = 0;
        rtp_session->stats.inbound.max_variance = 0;
-       
+
        /* Burst and Packet Loss */
        rtp_session->stats.inbound.lossrate = 0;
        rtp_session->stats.inbound.burstrate = 0;
@@ -4116,7 +4116,7 @@ SWITCH_DECLARE(switch_jb_t *) switch_rtp_get_jitter_buffer(switch_rtp_t *rtp_ses
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_pause_jitter_buffer(switch_rtp_t *rtp_session, switch_bool_t pause)
 {
-       
+
        if (!switch_rtp_ready(rtp_session) || !rtp_session->jb) {
                return SWITCH_STATUS_FALSE;
        }
@@ -4130,25 +4130,25 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_pause_jitter_buffer(switch_rtp_t *rtp
        }
 
        rtp_session->pause_jb = pause ? 1 : 0;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t *rtp_session)
 {
-       
+
        if (!switch_rtp_ready(rtp_session) || !rtp_session->jb) {
                return SWITCH_STATUS_FALSE;
        }
 
        rtp_session->flags[SWITCH_RTP_FLAG_KILL_JB]++;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len)
 {
-       
+
        if (rtp_session->vb) {
                return switch_jb_get_frames(rtp_session->vb, min_frame_len, max_frame_len, cur_frame_len, highest_frame_len);
        }
@@ -4165,13 +4165,13 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *r
        if (!max_frames) {
                max_frames = rtp_session->last_max_vb_frames;
        }
-       
+
        if (!max_frames || frames >= max_frames) {
                max_frames = frames * 10;
        }
 
        rtp_session->last_max_vb_frames = max_frames;
-       
+
        if (!rtp_session->vb) {
                switch_jb_create(&rtp_session->vb, rtp_session->flags[SWITCH_RTP_FLAG_TEXT] ? SJB_TEXT : SJB_VIDEO, frames, max_frames, rtp_session->pool);
                switch_jb_set_session(rtp_session->vb, rtp_session->session);
@@ -4183,7 +4183,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *r
        switch_core_session_request_video_refresh(rtp_session->session);
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Setting video buffer %u Frames.\n", frames);
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -4197,7 +4197,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp
 
        if (name) x = atoi(name);
        if (x < 0) x = 0;
-       
+
        if (rtp_session->jb) {
                switch_jb_debug_level(rtp_session->jb, x);
        } else if (rtp_session->vb) {
@@ -4207,10 +4207,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp
        return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, 
-                                                                                                                                 uint32_t queue_frames, 
-                                                                                                                                 uint32_t max_queue_frames, 
-                                                                                                                                 uint32_t samples_per_packet, 
+SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session,
+                                                                                                                                 uint32_t queue_frames,
+                                                                                                                                 uint32_t max_queue_frames,
+                                                                                                                                 uint32_t samples_per_packet,
                                                                                                                                  uint32_t samples_per_second)
 {
        switch_status_t status = SWITCH_STATUS_FALSE;
@@ -4243,7 +4243,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *
        }
 
 
-       
+
        return status;
 }
 
@@ -4254,7 +4254,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi
        if (!rtp_session->ms_per_packet) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] = 1;
 
        if (!(rtp_session->remote_rtcp_port = remote_port)) {
@@ -4265,9 +4265,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi
                rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]++;
        }
 
-       
+
        if (send_rate == -1) {
-               
+
                rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] = 1;
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "RTCP passthru enabled. Remote Port: %d\n", rtp_session->remote_rtcp_port);
        } else {
@@ -4278,7 +4278,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi
 
        if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
 
-               if (switch_sockaddr_info_get(&rtp_session->rtcp_remote_addr, rtp_session->eff_remote_host_str, SWITCH_UNSPEC, 
+               if (switch_sockaddr_info_get(&rtp_session->rtcp_remote_addr, rtp_session->eff_remote_host_str, SWITCH_UNSPEC,
                                                                         rtp_session->remote_rtcp_port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !rtp_session->rtcp_remote_addr) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "RTCP MUX Remote Address Error!");
                        return SWITCH_STATUS_FALSE;
@@ -4290,7 +4290,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi
                rtp_session->rtcp_sock_output = rtp_session->sock_output;
 
                rtp_session->rtcp_recv_msg_p = (rtcp_msg_t *) &rtp_session->recv_msg;
-               
+
                return SWITCH_STATUS_SUCCESS;
 
                //return enable_remote_rtcp_socket(rtp_session, &err);
@@ -4302,8 +4302,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi
 
 }
 
-SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin, 
-                                                                                                               const char *password, const char *rpassword, ice_proto_t proto, 
+SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin,
+                                                                                                               const char *password, const char *rpassword, ice_proto_t proto,
                                                                                                                switch_core_media_ice_type_t type, ice_t *ice_params)
 {
        char ice_user[80];
@@ -4313,12 +4313,12 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
        char *host = NULL;
        switch_port_t port = 0;
        char bufc[50];
-                                
+
 
        switch_mutex_lock(rtp_session->ice_mutex);
 
        if (proto == IPR_RTP) {
-               ice = &rtp_session->ice;                
+               ice = &rtp_session->ice;
                rtp_session->flags[SWITCH_RTP_FLAG_PAUSE] = 0;
                rtp_session->flags[SWITCH_RTP_FLAG_MUTE] = 0;
        } else {
@@ -4326,7 +4326,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
        }
 
        ice->proto = proto;
-       
+
        if ((type & ICE_VANILLA)) {
                switch_snprintf(ice_user, sizeof(ice_user), "%s:%s", login, rlogin);
                switch_snprintf(user_ice, sizeof(user_ice), "%s:%s", rlogin, login);
@@ -4354,7 +4354,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
        if (rpassword) {
                ice->rpass = switch_core_strdup(rtp_session->pool, rpassword);
        }
-       
+
        if ((ice->type & ICE_VANILLA) && ice->ice_params) {
                host = ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_addr;
                port = ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_port;
@@ -4374,7 +4374,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
                port = switch_sockaddr_get_port(ice->addr);
        }
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE, "Activating %s %s ICE: %s %s:%d\n", 
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE, "Activating %s %s ICE: %s %s:%d\n",
                                          proto == IPR_RTP ? "RTP" : "RTCP", rtp_type(rtp_session), ice_user, host, port);
 
 
@@ -4499,7 +4499,7 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session)
                if (rtp_session->sock_output && rtp_session->sock_output != rtp_session->sock_input) {
                        switch_socket_shutdown(rtp_session->sock_output, SWITCH_SHUTDOWN_READWRITE);
                }
-               
+
                if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) {
                        if (rtp_session->rtcp_sock_input) {
                                ping_socket(rtp_session);
@@ -4534,7 +4534,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_sync_stats(switch_rtp_t *rtp_session)
        if (!rtp_session) {
                return SWITCH_STATUS_FALSE;
        }
-       
+
        if (rtp_session->flags[SWITCH_RTP_FLAG_VAD]) {
                switch_channel_t *channel = switch_core_session_get_channel(rtp_session->vad_data.session);
 
@@ -4691,7 +4691,7 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
        return;
 }
 
-SWITCH_DECLARE(void) switch_rtp_set_interdigit_delay(switch_rtp_t *rtp_session, uint32_t delay) 
+SWITCH_DECLARE(void) switch_rtp_set_interdigit_delay(switch_rtp_t *rtp_session, uint32_t delay)
 {
        rtp_session->interdigit_delay = delay;
 }
@@ -4753,7 +4753,7 @@ SWITCH_DECLARE(void) switch_rtp_set_flags(switch_rtp_t *rtp_session, switch_rtp_
                                rtp_session->rtcp_autoadj_threshold = 1;
                                rtp_session->rtcp_autoadj_tally = 0;
 
-                               
+
                                rtp_flush_read_buffer(rtp_session, SWITCH_RTP_FLUSH_ONCE);
                        } else if (i == SWITCH_RTP_FLAG_NOBLOCK && rtp_session->sock_input) {
                                switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, TRUE);
@@ -4796,7 +4796,7 @@ SWITCH_DECLARE(void) switch_rtp_set_flag(switch_rtp_t *rtp_session, switch_rtp_f
                rtp_session->rtcp_autoadj_window = 20;
                rtp_session->rtcp_autoadj_threshold = 1;
                rtp_session->rtcp_autoadj_tally = 0;
-               
+
                if (rtp_session->session) {
                        switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
                        const char *x = switch_channel_get_variable(channel, "rtp_auto_adjust_threshold");
@@ -4846,7 +4846,7 @@ SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp
 static void set_dtmf_delay(switch_rtp_t *rtp_session, uint32_t ms, uint32_t max_ms)
 {
        int upsamp, max_upsamp;
-               
+
 
        if (!max_ms) max_ms = ms;
 
@@ -4861,7 +4861,7 @@ static void set_dtmf_delay(switch_rtp_t *rtp_session, uint32_t ms, uint32_t max_
                rtp_session->last_write_ts += upsamp;
        }
 
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Queue digit delay of %dms\n", ms);       
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Queue digit delay of %dms\n", ms);
 }
 
 static void do_2833(switch_rtp_t *rtp_session)
@@ -4922,7 +4922,7 @@ static void do_2833(switch_rtp_t *rtp_session)
                if (loops != 1) {
                        rtp_session->sending_dtmf = 0;
                        rtp_session->need_mark = 1;
-                       
+
                        if (rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER]) {
                                rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
                        }
@@ -4960,7 +4960,7 @@ static void do_2833(switch_rtp_t *rtp_session)
                                rtp_session->queue_delay = 0;
                        }
                }
-               
+
                if (rtp_session->queue_delay) {
                        return;
                }
@@ -4985,9 +4985,9 @@ static void do_2833(switch_rtp_t *rtp_session)
                                free(rdigit);
                                return;
                        }
-                       
 
-                       
+
+
                        memset(rtp_session->dtmf_data.out_digit_packet, 0, 4);
                        rtp_session->dtmf_data.out_digit_sofar = samples;
                        rtp_session->dtmf_data.out_digit_sub_sofar = samples;
@@ -5009,10 +5009,10 @@ static void do_2833(switch_rtp_t *rtp_session)
                                                                                        rtp_session->rtp_bugs & RTP_BUG_CISCO_SKIP_MARK_BIT_2833 ? 0 : 1,
                                                                                        rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
 
-                       
+
                        rtp_session->stats.outbound.raw_bytes += wrote;
                        rtp_session->stats.outbound.dtmf_packet_count++;
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%u dur=%d/%d/%d seq=%d lw=%u\n",
                                                          rtp_session->dtmf_data.out_digit,
                                                          rtp_session->dtmf_data.timestamp_dtmf,
@@ -5073,7 +5073,7 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
        switch_size_t bytes;
        uint32_t flushed = 0;
        switch_size_t bytes_out = 0;
-       
+
        if (!switch_rtp_ready(rtp_session)) {
                return 0;
        }
@@ -5082,14 +5082,14 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
 
        if (!force) {
                if ((rtp_session->jb && !rtp_session->pause_jb && jb_valid(rtp_session)) ||
-                       rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] || 
+                       rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] ||
                        rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] ||
                        rtp_session->flags[SWITCH_RTP_FLAG_DTMF_ON]
                        ) {
                        return bytes_in;
                }
        }
-       
+
        READ_INC(rtp_session);
 
        if (switch_rtp_ready(rtp_session) ) {
@@ -5109,7 +5109,7 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
                        bytes_out = bytes_in;
                        goto end;
                }
-               
+
                if (rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session),
                                                          SWITCH_LOG_CONSOLE, "%s FLUSH\n",
@@ -5136,7 +5136,7 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
                        if (switch_rtp_ready(rtp_session)) {
                                bytes = sizeof(rtp_msg_t);
                                switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes);
-                               
+
                                if (bytes) {
                                        int do_cng = 0;
 
@@ -5171,7 +5171,7 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
                        switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
                        switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, FALSE);
                }
-       
+
 
                if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->session) {
                        //int type = 1; // sum flags: 1 encoder; 2; decoder
@@ -5181,7 +5181,7 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
        }
 
  end:
-       
+
        READ_DEC(rtp_session);
 
        return bytes_out;
@@ -5197,7 +5197,7 @@ static int check_recv_payload(switch_rtp_t *rtp_session)
 
                switch_mutex_lock(rtp_session->flag_mutex);
 
-               for (pmap = *rtp_session->pmaps; pmap && pmap->allocated; pmap = pmap->next) {                                  
+               for (pmap = *rtp_session->pmaps; pmap && pmap->allocated; pmap = pmap->next) {
                        if (!pmap->negotiated) {
                                continue;
                        }
@@ -5221,7 +5221,7 @@ static int get_recv_payload(switch_rtp_t *rtp_session)
 
                switch_mutex_lock(rtp_session->flag_mutex);
 
-               for (pmap = *rtp_session->pmaps; pmap && pmap->allocated; pmap = pmap->next) {                                  
+               for (pmap = *rtp_session->pmaps; pmap && pmap->allocated; pmap = pmap->next) {
                        if (pmap->negotiated) {
                                r = pmap->pt;
                                break;
@@ -5235,7 +5235,7 @@ static int get_recv_payload(switch_rtp_t *rtp_session)
 
 #define return_cng_frame() do_cng = 1; goto timer_check
 
-static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes, switch_frame_flag_t *flags, 
+static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes, switch_frame_flag_t *flags,
                                                                           payload_map_t **pmapP, switch_status_t poll_status, switch_bool_t return_jb_packet)
 {
        switch_status_t status = SWITCH_STATUS_FALSE;
@@ -5246,7 +5246,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
        switch_size_t xcheck_jitter = 0;
        int tries = 0;
        int block = 0;
-       
+
        switch_assert(bytes);
  more:
 
@@ -5261,7 +5261,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                *bytes = 0;
                return SWITCH_STATUS_BREAK;
        }
-               
+
        if (block) {
                int to = 20000;
                int fdr = 0;
@@ -5273,9 +5273,9 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                to = rtp_session->timer.interval * 1000;
                        }
                }
-               
+
                poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, to);
-               
+
                if (rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] && rtp_session->timer.interval) {
                        switch_core_timer_sync(&rtp_session->timer);
                }
@@ -5286,7 +5286,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
 
                block = 0;
        }
-       
+
        *bytes = sizeof(rtp_msg_t);
        sync = 0;
 
@@ -5307,7 +5307,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
 
        if (*bytes) {
                b = (unsigned char *) &rtp_session->recv_msg;
-               
+
                /* version 2 probably rtp, zrtp cookie present means zrtp */
                rtp_session->has_rtp = (rtp_session->recv_msg.header.version == 2 || ntohl(*(int *)(b+4)) == ZRTP_MAGIC_COOKIE);
 
@@ -5340,40 +5340,40 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                        rtp_session->has_ice = 0;
                                        break;
                                default:
-                                       if (rtp_session->rtcp_recv_msg_p->header.version == 2 && 
+                                       if (rtp_session->rtcp_recv_msg_p->header.version == 2 &&
                                                rtp_session->rtcp_recv_msg_p->header.type > 199 && rtp_session->rtcp_recv_msg_p->header.type < 208) {
                                                rtp_session->has_rtcp = 1;
                                                rtp_session->has_rtp = 0;
                                                rtp_session->has_ice = 0;
                                        }
                                        break;
-                               }                                               
+                               }
                        }
                }
 
                if (rtp_session->has_rtp || rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) {
                        rtp_session->missed_count = 0;
-                       switch_cp_addr(rtp_session->rtp_from_addr, rtp_session->from_addr);     
+                       switch_cp_addr(rtp_session->rtp_from_addr, rtp_session->from_addr);
                }
-               
+
                if (rtp_session->has_rtp) {
                        rtp_session->last_rtp_hdr = rtp_session->recv_msg.header;
 
-               
+
                        if (bytes && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] &&
-                               rtp_session->last_rtp_hdr.pt != 13 && 
-                               rtp_session->last_rtp_hdr.pt != rtp_session->recv_te && 
+                               rtp_session->last_rtp_hdr.pt != 13 &&
+                               rtp_session->last_rtp_hdr.pt != rtp_session->recv_te &&
                                rtp_session->last_rtp_hdr.pt != rtp_session->cng_pt) {
                                int accept_packet = 1;
-                       
+
 
                                if (rtp_session->pmaps && *rtp_session->pmaps) {
                                        payload_map_t *pmap;
                                        accept_packet = 0;
 
                                        switch_mutex_lock(rtp_session->flag_mutex);
-                                       for (pmap = *rtp_session->pmaps; pmap && pmap->allocated; pmap = pmap->next) {                                  
-                                       
+                                       for (pmap = *rtp_session->pmaps; pmap && pmap->allocated; pmap = pmap->next) {
+
                                                if (!pmap->negotiated) {
                                                        continue;
                                                }
@@ -5388,20 +5388,20 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                        }
                                        switch_mutex_unlock(rtp_session->flag_mutex);
                                }
-                       
+
                                if (!accept_packet && !(rtp_session->rtp_bugs & RTP_BUG_ACCEPT_ANY_PAYLOAD) && !(rtp_session->rtp_bugs & RTP_BUG_ACCEPT_ANY_PACKETS)) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, 
-                                                                         "Invalid Packet SEQ: %d TS: %d PT:%d ignored\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1,
+                                                                         "Invalid Packet SEQ: %d TS: %d PT:%d ignored\n",
                                                                          ntohs(rtp_session->recv_msg.header.seq), ntohl(rtp_session->last_rtp_hdr.ts), rtp_session->last_rtp_hdr.pt);
                                        *bytes = 0;
                                }
                        }
-       
+
                        if (rtp_session->flags[SWITCH_RTP_FLAG_DETECT_SSRC]) {
                                //if (rtp_session->remote_ssrc != rtp_session->stats.rtcp.peer_ssrc && rtp_session->stats.rtcp.peer_ssrc) {
                                //      rtp_session->remote_ssrc = rtp_session->stats.rtcp.peer_ssrc;
                                //}
-                               
+
                                if (rtp_session->remote_ssrc != rtp_session->last_rtp_hdr.ssrc && rtp_session->last_rtp_hdr.ssrc) {
                                        rtp_session->remote_ssrc = ntohl(rtp_session->last_rtp_hdr.ssrc);
                                }
@@ -5422,7 +5422,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                //}
                return SWITCH_STATUS_GENERR;
        }
-       
+
        if (rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) {
                goto udptl;
        }
@@ -5435,7 +5435,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                //      switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "WTF BYTES %ld b=%d\n", *bytes, *b);
                //}
 
-               
+
                if (rtp_session->has_ice) {
                        if (rtp_session->ice.ice_user) {
                                handle_ice(rtp_session, &rtp_session->ice, (void *) &rtp_session->recv_msg, *bytes);
@@ -5446,7 +5446,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
        }
 
        if (rtp_session->dtls) {
-               
+
                if (rtp_session->rtcp_dtls && rtp_session->rtcp_dtls != rtp_session->dtls) {
                        rtp_session->rtcp_dtls->bytes = 0;
                        rtp_session->rtcp_dtls->data = NULL;
@@ -5461,8 +5461,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                }
        }
 
-       if (status == SWITCH_STATUS_SUCCESS && *bytes) { 
-               if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { 
+       if (status == SWITCH_STATUS_SUCCESS && *bytes) {
+               if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
                        *flags &= ~SFF_RTCP;
                        if (rtp_session->has_rtcp) {
                                *flags |= SFF_RTCP;
@@ -5471,15 +5471,15 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV]) {
                                        int sbytes = (int) *bytes;
                                        err_status_t stat = 0;
-                                       
-                                       
+
+
                                        if ((stat = srtp_unprotect_rtcp(rtp_session->recv_ctx[rtp_session->srtp_idx_rtcp], &rtp_session->rtcp_recv_msg_p->header, &sbytes))) {
                                                //++rtp_session->srtp_errs[rtp_session->srtp_idx_rtp]++;
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "RTCP UNPROTECT ERR\n");
                                        } else {
                                                //rtp_session->srtp_errs[rtp_session->srtp_idx_rtp] = 0;
                                        }
-                                       
+
                                        *bytes = sbytes;
                                }
 #endif
@@ -5488,7 +5488,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                }
        }
 
-       
+
 
        if ((*bytes && (!rtp_write_ready(rtp_session, *bytes, __LINE__) || !rtp_session->has_rtp || rtp_session->has_rtcp)) || sync) {
                rtp_session->hot_hits = 0;
@@ -5516,7 +5516,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                                  my_host, switch_sockaddr_get_port(rtp_session->local_addr),
                                                  old_host, rtp_session->remote_port,
                                                  tx_host, switch_sockaddr_get_port(rtp_session->rtp_from_addr),
-                                                 rtp_session->last_rtp_hdr.pt, ntohl(rtp_session->last_rtp_hdr.ts), ntohs(rtp_session->last_rtp_hdr.seq), 
+                                                 rtp_session->last_rtp_hdr.pt, ntohl(rtp_session->last_rtp_hdr.ts), ntohs(rtp_session->last_rtp_hdr.seq),
                                                  rtp_session->last_rtp_hdr.m);
 
        }
@@ -5525,7 +5525,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
        {
                int r = (rand() % 10000) + 1;
                if (r <= 200) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ALERT, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ALERT,
                                                          "Simulate dropped packet ......... ts: %u seq: %u\n", ntohl(rtp_session->last_rtp_hdr.ts), ntohs(rtp_session->last_rtp_hdr.seq));
                        *bytes = 0;
                }
@@ -5544,7 +5544,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                uint16_t seq = ntohs((uint16_t) rtp_session->last_rtp_hdr.seq);
                ts = ntohl(rtp_session->last_rtp_hdr.ts);
 
-#ifdef DEBUG_MISSED_SEQ                
+#ifdef DEBUG_MISSED_SEQ
                if (rtp_session->last_seq && rtp_session->last_seq+1 != seq) {
                        //2012-11-28 18:33:11.799070 [ERR] switch_rtp.c:2883 Missed -65536 RTP frames from sequence [65536] to [-1] (missed). Time since last read [20021]
                        switch_size_t flushed_packets_diff = rtp_session->stats.inbound.flush_packet_count - rtp_session->last_flush_packet_count;
@@ -5555,7 +5555,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                                                  rtp_session->last_seq+1, (flushed_packets_diff == 1) ? " (flushed by FS)" : " (missed)",
                                                                  rtp_session->last_read_time ? now-rtp_session->last_read_time : 0);
                        } else { /* We missed multiple packets */
-                               if (flushed_packets_diff == 0) { 
+                               if (flushed_packets_diff == 0) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
                                                                          "Missed %ld RTP frames from sequence [%d] to [%d] (missed). Time since last read [%ld]\n",
                                                                          num_missed, rtp_session->last_seq+1, seq-1,
@@ -5583,11 +5583,11 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                }
 #endif
                rtp_session->last_seq = seq;
-       
+
 
                rtp_session->last_flush_packet_count = rtp_session->stats.inbound.flush_packet_count;
-               
-               
+
+
                if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && now - rtp_session->last_read_time > 5000000) {
                        switch_rtp_video_refresh(rtp_session);
                }
@@ -5600,8 +5600,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
        }
 
 
-       if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] && !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && 
-               *bytes && rtp_session->last_rtp_hdr.pt != rtp_session->recv_te && 
+       if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] && !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] &&
+               *bytes && rtp_session->last_rtp_hdr.pt != rtp_session->recv_te &&
                ts && !rtp_session->jb && !rtp_session->pause_jb && jb_valid(rtp_session) && ts == rtp_session->last_cng_ts) {
                /* we already sent this frame..... */
                *bytes = 0;
@@ -5613,12 +5613,12 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
 #ifdef ENABLE_ZRTP
                        /* ZRTP Recv */
                        if (zrtp_on) {
-                               
+
                                unsigned int sbytes = (int) *bytes;
                                zrtp_status_t stat = 0;
-                               
+
                                stat = zrtp_process_srtp(rtp_session->zrtp_stream, (void *) &rtp_session->recv_msg, &sbytes);
-                               
+
                                switch (stat) {
                                case zrtp_status_ok:
                                        *bytes = sbytes;
@@ -5635,11 +5635,11 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                }
                        }
 #endif
-                       
+
 #ifdef ENABLE_SRTP
-                       if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && rtp_session->has_rtp && 
-                               (check_recv_payload(rtp_session) || 
-                                rtp_session->last_rtp_hdr.pt == rtp_session->recv_te || 
+                       if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && rtp_session->has_rtp &&
+                               (check_recv_payload(rtp_session) ||
+                                rtp_session->last_rtp_hdr.pt == rtp_session->recv_te ||
                                 rtp_session->last_rtp_hdr.pt == rtp_session->cng_pt)) {
                                //if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && (!rtp_session->ice.ice_user || rtp_session->has_rtp)) {
                                int sbytes = (int) *bytes;
@@ -5649,15 +5649,15 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                        switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV_RESET);
                                        srtp_dealloc(rtp_session->recv_ctx[rtp_session->srtp_idx_rtp]);
                                        rtp_session->recv_ctx[rtp_session->srtp_idx_rtp] = NULL;
-                                       if ((stat = srtp_create(&rtp_session->recv_ctx[rtp_session->srtp_idx_rtp], 
+                                       if ((stat = srtp_create(&rtp_session->recv_ctx[rtp_session->srtp_idx_rtp],
                                                                                        &rtp_session->recv_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->recv_ctx[rtp_session->srtp_idx_rtp]) {
-                                               
+
                                                rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] = 0;
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP RECV\n");
                                                rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] = 0;
                                                return SWITCH_STATUS_FALSE;
                                        } else {
-                                               
+
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, "RE-Activating Secure RTP RECV\n");
                                                rtp_session->srtp_errs[rtp_session->srtp_idx_rtp] = 0;
                                        }
@@ -5716,10 +5716,10 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                        if (!rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] &&
                                rtp_session->has_rtp && rtp_session->recv_msg.header.x) { /* header extensions */
                                uint16_t length;
-                       
+
                                rtp_session->recv_msg.ext = (switch_rtp_hdr_ext_t *) RTP_BODY(rtp_session);
                                length = ntohs((uint16_t)rtp_session->recv_msg.ext->length);
-               
+
                                if (length < SWITCH_RTP_MAX_BUF_LEN_WORDS) {
                                        rtp_session->recv_msg.ebody = (char *)rtp_session->recv_msg.ext + (length * 4) + 4;
                                        if (*bytes > (length * 4 + 4)) {
@@ -5732,10 +5732,10 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
 
 
 #ifdef DEBUG_CHROME
-                       
+
                        if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->has_rtp) {
-               
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, 
+
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
                                                                  "VIDEO: seq: %d ts: %u len: %ld %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x mark: %d\n",
                                                                  ntohs(rtp_session->last_rtp_hdr.seq), ntohl(rtp_session->last_rtp_hdr.ts), *bytes,
                                                                  *((uint8_t *)RTP_BODY(rtp_session)), *((uint8_t *)RTP_BODY(rtp_session) + 1),
@@ -5744,17 +5744,17 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                                                  *((uint8_t *)RTP_BODY(rtp_session) + 6), *((uint8_t *)RTP_BODY(rtp_session) + 7),
                                                                  *((uint8_t *)RTP_BODY(rtp_session) + 8), *((uint8_t *)RTP_BODY(rtp_session) + 9),
                                                                  *((uint8_t *)RTP_BODY(rtp_session) + 10), rtp_session->last_rtp_hdr.m);
-                       
+
                        }
-#endif         
+#endif
 
 
 
                }
 
-               
+
                rtp_session->stats.inbound.raw_bytes += *bytes;
-               
+
                if (rtp_session->last_rtp_hdr.pt == rtp_session->recv_te) {
                        rtp_session->stats.inbound.dtmf_packet_count++;
                } else if (rtp_session->last_rtp_hdr.pt == rtp_session->cng_pt || rtp_session->last_rtp_hdr.pt == 13) {
@@ -5767,8 +5767,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                rtp_session->stats.inbound.packet_count++;
        }
 
-       if (!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && 
-               ((rtp_session->recv_te && rtp_session->last_rtp_hdr.pt == rtp_session->recv_te) || 
+       if (!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] &&
+               ((rtp_session->recv_te && rtp_session->last_rtp_hdr.pt == rtp_session->recv_te) ||
                 (*bytes < rtp_header_len && *bytes > 0 && !(rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] || rtp_session->flags[SWITCH_RTP_FLAG_UDPTL])))) {
                return SWITCH_STATUS_BREAK;
        }
@@ -5776,7 +5776,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
        if (ts) {
                rtp_session->last_read_ts = ts;
        }
-       
+
        if (rtp_session->flags[SWITCH_RTP_FLAG_BYTESWAP] && check_recv_payload(rtp_session)) {
                switch_swap_linear((int16_t *)RTP_BODY(rtp_session), (int) *bytes - rtp_header_len);
        }
@@ -5792,7 +5792,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                        switch_jb_destroy(&rtp_session->vb);
                }
        }
-       
+
        if (rtp_session->has_rtp && *bytes) {
                uint32_t read_ssrc = ntohl(rtp_session->last_rtp_hdr.ssrc);
 
@@ -5801,12 +5801,12 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                }
 
                if (rtp_session->vb && jb_valid(rtp_session)) {
-                       status = switch_jb_put_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, *bytes);                 
+                       status = switch_jb_put_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, *bytes);
 
                        if (status == SWITCH_STATUS_TOO_LATE) {
                                goto more;
                        }
-                       
+
                        status = SWITCH_STATUS_FALSE;
                        *bytes = 0;
 
@@ -5835,7 +5835,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                goto more;
                        }
 
-                       
+
                        status = SWITCH_STATUS_FALSE;
                        *bytes = 0;
 
@@ -5843,7 +5843,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                return status;
                        }
                } else {
-                       if (rtp_session->last_rtp_hdr.m && rtp_session->last_rtp_hdr.pt != rtp_session->recv_te && 
+                       if (rtp_session->last_rtp_hdr.m && rtp_session->last_rtp_hdr.pt != rtp_session->recv_te &&
                                !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && !(rtp_session->rtp_bugs & RTP_BUG_IGNORE_MARK_BIT)) {
                                switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
                        } else if (rtp_session->last_jb_read_ssrc && rtp_session->last_jb_read_ssrc != read_ssrc) {
@@ -5896,7 +5896,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                break;
                        }
                }
-               
+
                if (rtp_session->vb && jb_valid(rtp_session)) {
                        switch_status_t vstatus = switch_jb_get_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, bytes);
                        status = vstatus;
@@ -5924,7 +5924,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                                        rtp_session->last_rtp_hdr.pt = pt;
                                }
                        }
-                               
+
                        if (vstatus == SWITCH_STATUS_SUCCESS) {
                                rtp_session->last_rtp_hdr = rtp_session->recv_msg.header;
 
@@ -5962,7 +5962,7 @@ static void handle_nack(switch_rtp_t *rtp_session, uint32_t nack)
        }
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Got NACK [%u][0x%x] for seq %u\n", nack, nack, ntohs(seq));
-       
+
        if (switch_jb_get_packet_by_seq(rtp_session->vbw, seq, (switch_rtp_packet_t *) send_msg, &bytes) == SWITCH_STATUS_SUCCESS) {
 
                if (rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]) {
@@ -5998,7 +5998,7 @@ static void handle_nack(switch_rtp_t *rtp_session, uint32_t nack)
                                                                          old_host, rtp_session->remote_port,
                                                                          tx_host, switch_sockaddr_get_port(rtp_session->rtcp_from_addr),
                                                                          send_msg->header.pt, ntohl(send_msg->header.ts), ntohs(send_msg->header.seq), send_msg->header.m);
-                                       
+
                                }
                                //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "RE----SEND %u\n", ntohs(send_msg->header.seq));
 
@@ -6016,17 +6016,17 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
        int i;
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3,
-                                         "RTCP packet bytes %" SWITCH_SIZE_T_FMT " type %d pad %d\n", 
+                                         "RTCP packet bytes %" SWITCH_SIZE_T_FMT " type %d pad %d\n",
                                          bytes, msg->header.type, msg->header.p);
-       
+
        if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && (msg->header.type == _RTCP_PT_RTPFB || msg->header.type == _RTCP_PT_PSFB || msg->header.type < 200)) {
-               rtcp_ext_msg_t *extp = (rtcp_ext_msg_t *) msg;                  
+               rtcp_ext_msg_t *extp = (rtcp_ext_msg_t *) msg;
 
                if (extp->header.fmt != 15) { // <---- REMOVE WHEN BRIA STOPS SENDING UNSOLICITED REMB
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "PICKED UP %s XRTCP type: %d fmt: %d\n", 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "PICKED UP %s XRTCP type: %d fmt: %d\n",
                                                          rtp_type(rtp_session), msg->header.type, extp->header.fmt);
                }
-               
+
                if (msg->header.type == _RTCP_PT_FIR ||
                        (msg->header.type == _RTCP_PT_PSFB && (extp->header.fmt == _RTCP_PSFB_FIR || extp->header.fmt == _RTCP_PSFB_PLI))) {
 
@@ -6049,7 +6049,7 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
                if (msg->header.type == _RTCP_PT_RTPFB && extp->header.fmt == _RTCP_RTPFB_NACK) {
                        uint32_t *nack = (uint32_t *) extp->body;
                        int i;
-                       
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Got NACK count %d\n", ntohs(extp->header.length) - 2);
 
 
@@ -6076,11 +6076,11 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
                        sec = (uint32_t)(now/1000000);              /* converted to second (NTP most significant bits) */
                        ntp_sec = sec+NTP_TIME_OFFSET;  /* 32bits most significant */
                        ntp_usec = (uint32_t)(now - (sec*1000000)); /* micro seconds */
-                       lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; // 0.065536 is used for convertion from useconds 
+                       lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; // 0.065536 is used for convertion from useconds
 
                        if (msg->header.type == _RTCP_PT_SR) { /* Sender report */
                                struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)msg->body;
-                               
+
                                rtp_session->stats.rtcp.packet_count += ntohl(sr->sender_info.pc);
                                rtp_session->stats.rtcp.octet_count += ntohl(sr->sender_info.oc);
                                packet_ssrc = sr->ssrc;
@@ -6152,7 +6152,7 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
                                        }
 
                                        if (rtp_session->flags[SWITCH_RTP_FLAG_ADJ_BITRATE_CAP] && rtp_session->flags[SWITCH_RTP_FLAG_ESTIMATORS] && !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
-                                               
+
                                                /* SWITCH_RTP_FLAG_ADJ_BITRATE_CAP : Can the codec change its bitrate on the fly per API command ? */
 #ifdef DEBUG_ESTIMATORS_
                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "Current packet loss: [%d %%] Current RTT: [%f ms]\n", percent_fraction, rtt_now);
@@ -6178,9 +6178,9 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
                                                        packet_loss_increase = 1;
                                                }
 #ifdef DEBUG_ESTIMATORS_
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "ESTIMATORS: Packet loss will be: [%f] RTT will be: [%f ms]\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "ESTIMATORS: Packet loss will be: [%f] RTT will be: [%f ms]\n",
                                                                                                                                        rtp_session->estimators[EST_LOSS]->val_estimate_last, rtp_session->estimators[EST_RTT]->val_estimate_last);
-#endif 
+#endif
 
                                                if (rtp_session->rtcp_frame.reports[i].loss_avg != old_avg) {
                                                        /*getting bad*/
@@ -6190,33 +6190,33 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
 #ifdef DEBUG_ESTIMATORS_
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "Slow link conditions: Loss average: [%d %%], Previous loss: [%d %%]. \
                                                                                                                                        Going to minimum bitrate!",rtp_session->rtcp_frame.reports[i].loss_avg, old_avg);
-#endif 
-                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
+#endif
+                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
                                                                                        SWITCH_IO_WRITE, SCC_AUDIO_ADJUST_BITRATE, SCCT_STRING, "minimum", SCCT_NONE, NULL, NULL, NULL);
                                                                /* if after going to minimum bitrate we still have packet loss then we increase ptime. TODO */
 
                                                        } else if (packet_loss_increase && (rtp_session->estimators[EST_LOSS]->val_estimate_last >= 5)) {
                                                                /* sudden change in the mean value of packet loss percentage */
-                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
-                                                               SWITCH_IO_WRITE, SCC_AUDIO_ADJUST_BITRATE, 
-                                                               SCCT_STRING, "decrease", 
+                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
+                                                               SWITCH_IO_WRITE, SCC_AUDIO_ADJUST_BITRATE,
+                                                               SCCT_STRING, "decrease",
                                                                SCCT_NONE, NULL, NULL, NULL);
 #ifdef DEBUG_ESTIMATORS_
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3,"Sudden change in the mean value of packet loss percentage !\n");
 #endif
-                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
-                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT, 
-                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg, 
+                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
+                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT,
+                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg,
                                                                SCCT_NONE, NULL, NULL, NULL);
 
                                                        } else if (!rtt_increase && rtp_session->estimators[EST_LOSS]->val_estimate_last >= rtp_session->rtcp_frame.reports[i].loss_avg ) {
                                                                /* lossy because of congestion (queues full somewhere -> some packets are dropped , but RTT is good ), packet loss with many small gaps */
 #ifdef DEBUG_ESTIMATORS_
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "packet loss, but RTT is not bad\n");
-#endif 
-                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
-                                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT, 
-                                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg, 
+#endif
+                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
+                                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT,
+                                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg,
                                                                                SCCT_NONE, NULL, NULL, NULL);
 
                                                        } else if ((rtp_session->estimators[EST_LOSS]->val_estimate_last < 1) && packet_loss_increase) {
@@ -6224,46 +6224,46 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "small packet loss average\n");
 #endif
                                                                /*small loss_avg*/
-                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
-                                                                                       SWITCH_IO_WRITE, SCC_AUDIO_ADJUST_BITRATE, 
-                                                                                       SCCT_STRING, "default", 
+                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
+                                                                                       SWITCH_IO_WRITE, SCC_AUDIO_ADJUST_BITRATE,
+                                                                                       SCCT_STRING, "default",
                                                                                        SCCT_NONE, NULL, NULL, NULL);
 
-                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
-                                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT, 
-                                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg, 
+                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
+                                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT,
+                                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg,
                                                                                SCCT_NONE, NULL, NULL, NULL);
 
-                                                       } else if ((rtp_session->estimators[EST_LOSS]->val_estimate_last < 5) && 
+                                                       } else if ((rtp_session->estimators[EST_LOSS]->val_estimate_last < 5) &&
                                                                        (rtp_session->rtcp_frame.reports[i].rtt_avg < rtp_session->estimators[EST_RTT]->val_estimate_last))  {
 
                                                                /* estimate that packet loss will decrease, we can increase the bitrate */
-                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
-                                                                                       SWITCH_IO_WRITE, SCC_AUDIO_ADJUST_BITRATE, 
-                                                                                       SCCT_STRING, "increase", 
+                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
+                                                                                       SWITCH_IO_WRITE, SCC_AUDIO_ADJUST_BITRATE,
+                                                                                       SCCT_STRING, "increase",
                                                                                        SCCT_NONE, NULL, NULL, NULL);
 
-                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
-                                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT, 
-                                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg, 
+                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
+                                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT,
+                                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg,
                                                                                SCCT_NONE, NULL, NULL, NULL);
 
                                                        } else {
                                                                /* *do nothing about bitrate, just pass the packet loss to the codec */
 #ifdef DEBUG_ESTIMATORS_
                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3,"do nothing about bitrate, just pass the packet loss to the codec\n");
-#endif 
-                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
-                                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT, 
-                                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg, 
+#endif
+                                                               switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
+                                                                               SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT,
+                                                                               (void *)&rtp_session->rtcp_frame.reports[i].loss_avg,
                                                                                SCCT_NONE, NULL, NULL, NULL);
                                                        }
                                                }
                                        } else {
                                                if (!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->rtcp_frame.reports[i].loss_avg != old_avg) {
-                                                       switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, 
-                                                       SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT, 
-                                                       (void *)&rtp_session->rtcp_frame.reports[i].loss_avg, 
+                                                       switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO,
+                                                       SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT,
+                                                       (void *)&rtp_session->rtcp_frame.reports[i].loss_avg,
                                                        SCCT_NONE, NULL, NULL, NULL);
                                                }
                                        }
@@ -6279,7 +6279,7 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
                        rtp_session->rtcp_fresh_frame = 1;
                        rtp_session->stats.rtcp.peer_ssrc = ntohl(packet_ssrc);
                }
-       
+
 
        if (msg->header.type > 194 && msg->header.type < 255) {
                status = SWITCH_STATUS_SUCCESS;
@@ -6295,7 +6295,7 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz
        switch_size_t remain = *bytes;
        switch_status_t status = SWITCH_STATUS_FALSE;
        rtcp_msg_t *msg = rtp_session->rtcp_recv_msg_p;
-       
+
        if (msg->header.version != 2) {
                if (msg->header.version == 0) {
                        if (rtp_session->ice.ice_user) {
@@ -6313,18 +6313,18 @@ static switch_status_t process_rtcp_packet(switch_rtp_t *rtp_session, switch_siz
                len = ((switch_size_t)ntohs(msg->header.length) * 4) + 4;
 
                if (msg->header.version != 2 || !(msg->header.type > 191 && msg->header.type < 210)) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, 
-                                                         "INVALID RTCP PACKET TYPE %d VER %d LEN %" SWITCH_SIZE_T_FMT "\n", msg->header.type, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING,
+                                                         "INVALID RTCP PACKET TYPE %d VER %d LEN %" SWITCH_SIZE_T_FMT "\n", msg->header.type,
                                                          msg->header.version, len);
                        status = SWITCH_STATUS_BREAK;
                        break;
                }
 
-               //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, 
+               //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT,
                //"WTF BYTES %ld REMAIN %ld PACKET TYPE %d LEN %ld\n", *bytes, remain, msg->header.type, len);
 
                if (len > remain) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, 
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING,
                                                          "RTCP INVALID LENGTH %" SWITCH_SIZE_T_FMT "\n", len);
                        len = remain;
                }
@@ -6356,21 +6356,21 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
 
        *bytes = sizeof(rtcp_msg_t);
 
-       if ((status = switch_socket_recvfrom(rtp_session->rtcp_from_addr, rtp_session->rtcp_sock_input, 0, (void *) rtp_session->rtcp_recv_msg_p, bytes)) 
+       if ((status = switch_socket_recvfrom(rtp_session->rtcp_from_addr, rtp_session->rtcp_sock_input, 0, (void *) rtp_session->rtcp_recv_msg_p, bytes))
                != SWITCH_STATUS_SUCCESS) {
                *bytes = 0;
        }
 
        if (rtp_session->rtcp_dtls) {
                char *b = (char *) rtp_session->rtcp_recv_msg_p;
-               
+
                if (*b == 0 || *b == 1) {
                        if (rtp_session->rtcp_ice.ice_user) {
                                handle_ice(rtp_session, &rtp_session->rtcp_ice, (void *) rtp_session->rtcp_recv_msg_p, *bytes);
                        }
                        *bytes = 0;
                }
-               
+
                if (*bytes && (*b >= 20) && (*b <= 64)) {
                        rtp_session->rtcp_dtls->bytes = *bytes;
                        rtp_session->rtcp_dtls->data = (void *) rtp_session->rtcp_recv_msg_p;
@@ -6378,9 +6378,9 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
                        rtp_session->rtcp_dtls->bytes = 0;
                        rtp_session->rtcp_dtls->data = NULL;
                }
-               
+
                do_dtls(rtp_session, rtp_session->rtcp_dtls);
-               
+
 
                if (rtp_session->rtcp_dtls->bytes) {
                        *bytes = 0;
@@ -6394,7 +6394,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
                //if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && (!rtp_session->ice.ice_user || rtp_session->rtcp_recv_msg_p->header.version == 2)) {
                int sbytes = (int) *bytes;
                err_status_t stat = 0;
-               
+
 
                if ((stat = srtp_unprotect_rtcp(rtp_session->recv_ctx[rtp_session->srtp_idx_rtcp], &rtp_session->rtcp_recv_msg_p->header, &sbytes))) {
                        //++rtp_session->srtp_errs[rtp_session->srtp_idx_rtp]++;
@@ -6402,9 +6402,9 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
                } else {
                        //rtp_session->srtp_errs[rtp_session->srtp_idx_rtp] = 0;
                }
-               
+
                *bytes = sbytes;
-               
+
        }
 #endif
 
@@ -6415,9 +6415,9 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
                if (bytes) {
                        unsigned int sbytes = (int) *bytes;
                        zrtp_status_t stat = 0;
-                       
+
                        stat = zrtp_process_srtcp(rtp_session->zrtp_stream, (void *) rtp_session->rtcp_recv_msg_p, &sbytes);
-                       
+
                        switch (stat) {
                        case zrtp_status_ok:
                                *bytes = sbytes;
@@ -6446,7 +6446,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
                                        const char *tx_host;
                                        const char *old_host;
                                        char bufa[50], bufb[50];
-                                       
+
                                        tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_from_addr);
                                        old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->rtcp_remote_addr);
 
@@ -6454,12 +6454,12 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
                                                                          "Auto Changing %s RTCP port from %s:%u to %s:%u\n", rtp_type(rtp_session), old_host, old, tx_host,
                                                                          switch_sockaddr_get_port(rtp_session->rtcp_from_addr));
 
-                                       
+
                                        rtp_session->eff_remote_host_str = switch_core_strdup(rtp_session->pool, tx_host);
                                        rtp_session->remote_rtcp_port = switch_sockaddr_get_port(rtp_session->rtcp_from_addr);
                                        status = enable_remote_rtcp_socket(rtp_session, &err);
                                        rtp_session->rtcp_auto_adj_used = 1;
-                                       
+
                                        if ((rtp_session->rtp_bugs & RTP_BUG_ALWAYS_AUTO_ADJUST)) {
                                                switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_AUTOADJ);
                                        } else {
@@ -6467,7 +6467,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
                                        }
                                }
                        } else {
-                               
+
                                if ((rtp_session->rtp_bugs & RTP_BUG_ALWAYS_AUTO_ADJUST)) {
                                        switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_AUTOADJ);
                                } else {
@@ -6476,10 +6476,10 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
                                        switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_AUTOADJ);
                                }
                                rtp_session->rtcp_auto_adj_used = 0;
-                               
+
                        }
        }
-       
+
        if (*bytes) {
                return process_rtcp_packet(rtp_session, bytes);
        }
@@ -6487,10 +6487,10 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
        return status;
 }
 
-static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_type, 
+static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_type,
                                                   payload_map_t **pmapP, switch_frame_flag_t *flags, switch_io_flag_t io_flags)
 {
-       
+
        switch_channel_t *channel = NULL;
        switch_size_t bytes = 0;
        switch_size_t rtcp_bytes = 0;
@@ -6532,11 +6532,11 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                bytes = 0;
 
                if (rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] &&
-                       !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] && 
-                       !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && 
+                       !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] &&
+                       !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] &&
                        !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] &&
                        rtp_session->read_pollfd) {
-                       
+
                        if (rtp_session->jb && !rtp_session->pause_jb && jb_valid(rtp_session)) {
                                while (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
                                        status = read_rtp_packet(rtp_session, &bytes, flags, pmapP, SWITCH_STATUS_SUCCESS, SWITCH_FALSE);
@@ -6558,9 +6558,9 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                                break;
                                        }
                                }
-                               
+
                        } else if ((rtp_session->flags[SWITCH_RTP_FLAG_AUTOFLUSH] || rtp_session->flags[SWITCH_RTP_FLAG_STICKY_FLUSH])) {
-                               
+
                                if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
                                        status = read_rtp_packet(rtp_session, &bytes, flags, pmapP, SWITCH_STATUS_SUCCESS, SWITCH_FALSE);
                                        if (status == SWITCH_STATUS_GENERR) {
@@ -6582,15 +6582,15 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                        if (bytes) {
                                                if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
                                                        rtp_session->hot_hits++;//+= rtp_session->samples_per_interval;
-                                                       
-                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10, "%s Hot Hit %d\n", 
+
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10, "%s Hot Hit %d\n",
                                                                                          rtp_session_name(rtp_session),
-                                                                                         rtp_session->hot_hits); 
+                                                                                         rtp_session->hot_hits);
                                                } else {
                                                        rtp_session->hot_hits = 0;
                                                }
                                        }
-                                       
+
                                        if (rtp_session->hot_hits > 1 && !rtp_session->sync_packets) {// >= (rtp_session->samples_per_second * 30)) {
                                                hot_socket = 1;
                                        }
@@ -6601,7 +6601,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
 
                        if (rtp_session->flags[SWITCH_RTP_FLAG_TEXT]) {
                                ///NOOP
-                       } else if (hot_socket && (rtp_session->hot_hits % 10) != 0) { 
+                       } else if (hot_socket && (rtp_session->hot_hits % 10) != 0) {
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10, "%s timer while HOT\n", rtp_session_name(rtp_session));
                                switch_core_timer_next(&rtp_session->timer);
                        } else if (hot_socket) {
@@ -6610,7 +6610,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                switch_core_timer_sync(&rtp_session->timer);
                                reset_jitter_seq(rtp_session);
                        } else {
-                               
+
                                if (rtp_session->sync_packets) {
 
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10,
@@ -6618,7 +6618,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                                                          rtp_session_name(rtp_session),
                                                                          rtp_session->sync_packets, (rtp_session->ms_per_packet * rtp_session->sync_packets) / 1000);
                                        if (!rtp_session->flags[SWITCH_RTP_FLAG_PAUSE]) {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "%s syncing %d %s packet(s)\n", 
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG3, "%s syncing %d %s packet(s)\n",
                                                                                 rtp_session_name(rtp_session),
                                                                                  rtp_session->sync_packets, rtp_type(rtp_session));
 
@@ -6642,7 +6642,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                        }
 
                                }
-                               
+
                                rtp_session->sync_packets = 0;
                        }
                }
@@ -6660,17 +6660,17 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                if (!switch_rtp_ready(rtp_session)) {
                        break;
                }
-               
+
                if (!rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] && rtp_session->read_pollfd) {
                        int pt = poll_sec * 1000000;
 
                        do_2833(rtp_session);
 
-                       if (rtp_session->dtmf_data.out_digit_dur > 0 || rtp_session->dtmf_data.in_digit_sanity || rtp_session->sending_dtmf || 
+                       if (rtp_session->dtmf_data.out_digit_dur > 0 || rtp_session->dtmf_data.in_digit_sanity || rtp_session->sending_dtmf ||
                                switch_queue_size(rtp_session->dtmf_data.dtmf_queue) || switch_queue_size(rtp_session->dtmf_data.dtmf_inqueue)) {
                                pt = 20000;
                        }
-                       
+
                        if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA]) {
                                pt = 200000;
                        }
@@ -6684,7 +6684,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                        if ((io_flags & SWITCH_IO_FLAG_NOBLOCK)) {
                                pt = 0;
                        }
-                       
+
                        poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt);
 
 
@@ -6700,8 +6700,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                        }
 
                }
-               
-                       
+
+
                if (poll_status == SWITCH_STATUS_SUCCESS || (rtp_session->vb && switch_jb_poll(rtp_session->vb))) {
 
                        got_rtp_poll = 1;
@@ -6709,7 +6709,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                        if (read_pretriggered) {
                                read_pretriggered = 0;
                        } else {
-                               
+
                                status = read_rtp_packet(rtp_session, &bytes, flags, pmapP, poll_status, SWITCH_TRUE);
 
                                if (status == SWITCH_STATUS_GENERR) {
@@ -6717,7 +6717,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                        goto end;
                                }
 
-                               if (rtp_session->max_missed_packets && read_loops == 1 && !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && 
+                               if (rtp_session->max_missed_packets && read_loops == 1 && !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] &&
                                        !rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) {
                                        if (bytes && status == SWITCH_STATUS_SUCCESS) {
                                                rtp_session->missed_count = 0;
@@ -6726,10 +6726,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                                goto end;
                                        }
                                }
-                               
+
                                if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
-                                       //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "Read bytes (%i) %ld\n", status, bytes); 
-                                       
+                                       //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "Read bytes (%i) %ld\n", status, bytes);
+
                                        if (bytes == 0) {
                                                if (check_rtcp_and_ice(rtp_session) == -1) {
                                                        ret = -1;
@@ -6761,7 +6761,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                ret = -1;
                                goto end;
                        }
-                       
+
                        if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) {
                                char tmp[128] = "";
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n",
@@ -6787,19 +6787,19 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                ret = -1;
                                goto end;
                        }
-                       
-                       
-                       if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) && 
+
+
+                       if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) &&
                                (rtp_session->dtmf_data.out_digit_dur == 0) && !rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) {
                                return_cng_frame();
                        }
                }
-               
+
        rtcp:
 
                if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) {
                        rtcp_poll_status = SWITCH_STATUS_FALSE;
-                       
+
                        if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX] && has_rtcp) {
                                if (rtp_session->rtcp_recv_msg_p->header.version == 2) { //rtcp muxed
                                        rtp_session->rtcp_from_addr = rtp_session->from_addr;
@@ -6808,20 +6808,20 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                }
 
                                has_rtcp = 0;
-                               
+
                        } else if (rtp_session->rtcp_read_pollfd) {
                                rtcp_poll_status = switch_poll(rtp_session->rtcp_read_pollfd, 1, &rtcp_fdr, 0);
                        }
-                                               
+
                        if (rtcp_poll_status == SWITCH_STATUS_SUCCESS) {
-                               
+
                                if (!rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
                                        rtcp_status = read_rtcp_packet(rtp_session, &rtcp_bytes, flags);
                                }
-                               
+
                                if (rtcp_status == SWITCH_STATUS_SUCCESS) {
                                        switch_rtp_reset_media_timer(rtp_session);
-                                       
+
                                        if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU]) {
                                                switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
                                                const char *uuid = switch_channel_get_partner_uuid(channel);
@@ -6831,12 +6831,12 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                                        switch_rtp_t *other_rtp_session = NULL;
 
                                                        if ((other_session = switch_core_session_locate(uuid))) {
-                                                               switch_channel_t *other_channel = switch_core_session_get_channel(other_session);                                       
-                                                               if ((other_rtp_session = switch_channel_get_private(other_channel, "__rtcp_audio_rtp_session")) && 
+                                                               switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+                                                               if ((other_rtp_session = switch_channel_get_private(other_channel, "__rtcp_audio_rtp_session")) &&
                                                                        other_rtp_session->rtcp_sock_output &&
                                                                        switch_rtp_test_flag(other_rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) {
                                                                        other_rtp_session->rtcp_send_msg = rtp_session->rtcp_recv_msg;
-                                                                       
+
 #ifdef ENABLE_SRTP
                                                                        if (switch_rtp_test_flag(other_rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) {
                                                                                int sbytes = (int) rtcp_bytes;
@@ -6854,9 +6854,9 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                                                        if (zrtp_on && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA]) {
                                                                                unsigned int sbytes = (unsigned int) bytes;
                                                                                zrtp_status_t stat = zrtp_status_fail;
-                                                                       
+
                                                                                stat = zrtp_process_rtcp(other_rtp_session->zrtp_stream, (void *) &other_rtp_session->rtcp_send_msg, &sbytes);
-                                                                       
+
                                                                                switch (stat) {
                                                                                case zrtp_status_ok:
                                                                                        break;
@@ -6871,27 +6871,27 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                                                                default:
                                                                                        break;
                                                                                }
-                                                                       
+
                                                                                bytes = sbytes;
                                                                        }
 #endif
-                                                                       if (switch_socket_sendto(other_rtp_session->rtcp_sock_output, other_rtp_session->rtcp_remote_addr, 0, 
+                                                                       if (switch_socket_sendto(other_rtp_session->rtcp_sock_output, other_rtp_session->rtcp_remote_addr, 0,
                                                                                                                         (const char*)&other_rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) {
                                                                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG,"RTCP packet not written\n");
                                                                        }
-                                                               
-                                                               
+
+
                                                                }
                                                                switch_core_session_rwunlock(other_session);
                                                        }
                                                }
-                                       
+
                                        }
 
                                        if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
                                                process_rtcp_packet(rtp_session, &rtcp_bytes);
                                                ret = 1;
-                                       
+
                                                if (!rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] && rtp_session->timer.interval) {
                                                        switch_core_timer_sync(&rtp_session->timer);
                                                        reset_jitter_seq(rtp_session);
@@ -6902,7 +6902,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                        }
                }
 
-               if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) && 
+               if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) &&
                        (rtp_session->dtmf_data.out_digit_dur == 0) && !got_rtp_poll) {
                        return_cng_frame();
                }
@@ -6919,12 +6919,12 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                        bytes = do_flush(rtp_session, SWITCH_FALSE, bytes);
                        switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
                }
-               
+
                if ((!bytes && rtp_session->flags[SWITCH_RTP_FLAG_BREAK]) || (bytes && bytes == 4 && *((int *) &rtp_session->recv_msg) == UINT_MAX)) {
                        switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_BREAK);
 
-                       if (!rtp_session->flags[SWITCH_RTP_FLAG_NOBLOCK] || !rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] || 
-                               rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] || rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] || 
+                       if (!rtp_session->flags[SWITCH_RTP_FLAG_NOBLOCK] || !rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] ||
+                               rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] || rtp_session->flags[SWITCH_RTP_FLAG_UDPTL] ||
                                (bytes && bytes < 5) || (!bytes && poll_loop)) {
                                bytes = 0;
                                reset_jitter_seq(rtp_session);
@@ -6940,7 +6940,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                        goto recvfrom;
                }
 
-               if (bytes && rtp_session->last_rtp_hdr.m && rtp_session->last_rtp_hdr.pt != rtp_session->recv_te && 
+               if (bytes && rtp_session->last_rtp_hdr.m && rtp_session->last_rtp_hdr.pt != rtp_session->recv_te &&
                        !rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] &&
                        !rtp_session->flags[SWITCH_RTP_FLAG_TEXT] &&
                        !(rtp_session->rtp_bugs & RTP_BUG_IGNORE_MARK_BIT)) {
@@ -7051,10 +7051,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                        if (rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) {
 #if 0
                                if (rtp_session->has_rtp && check_recv_payload(rtp_session)) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING,
                                                                          "Ignoring udptl packet of size of %ld bytes that looks strikingly like a RTP packet.\n", (long)bytes);
                                        bytes = 0;
-                                       goto do_continue;                                       
+                                       goto do_continue;
                                }
 #endif
                                *flags |= SFF_UDPTL_PACKET;
@@ -7072,7 +7072,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                bytes = 0;
                                goto do_continue;
                        }
-                       
+
                        if (rtp_session->last_rtp_hdr.pt && (rtp_session->last_rtp_hdr.pt == rtp_session->cng_pt || rtp_session->last_rtp_hdr.pt == 13)) {
                                return_cng_frame();
                        }
@@ -7124,7 +7124,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
 
        result_continue:
        timer_check:
-               
+
                if (rtp_session->flags[SWITCH_RTP_FLAG_MUTE]) {
                        do_cng++;
                }
@@ -7158,12 +7158,12 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                        continue;
                                }
 
-                               
 
-                               if (!rtp_session->flags[SWITCH_RTP_FLAG_PAUSE] && !rtp_session->flags[SWITCH_RTP_FLAG_DTMF_ON] && !rtp_session->dtmf_data.in_digit_ts 
+
+                               if (!rtp_session->flags[SWITCH_RTP_FLAG_PAUSE] && !rtp_session->flags[SWITCH_RTP_FLAG_DTMF_ON] && !rtp_session->dtmf_data.in_digit_ts
                                        && rtp_session->cng_count > (rtp_session->one_second * 2) && rtp_session->jitter_lead > JITTER_LEAD_FRAMES) {
 
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "%s %s timeout\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "%s %s timeout\n",
                                                                          rtp_session_name(rtp_session), rtp_type(rtp_session));
 
                                        if (rtp_session->stats.inbound.error_log) {
@@ -7251,7 +7251,7 @@ SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session,
 
        switch_mutex_lock(rtp_session->dtmf_data.dtmf_mutex);
        if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_inqueue, &pop) == SWITCH_STATUS_SUCCESS) {
-               
+
                _dtmf = (switch_dtmf_t *) pop;
                *dtmf = *_dtmf;
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "RTP RECV DTMF %c:%d\n", dtmf->digit, dtmf->duration);
@@ -7397,14 +7397,14 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp
                frame->ssrc = ntohl(rtp_session->last_rtp_hdr.ssrc);
                frame->m = rtp_session->last_rtp_hdr.m ? SWITCH_TRUE : SWITCH_FALSE;
        }
-       
+
 #ifdef ENABLE_ZRTP
        if (zrtp_on && rtp_session->flags[SWITCH_ZRTP_FLAG_SECURE_MITM_RECV]) {
                zrtp_session_info_t zrtp_session_info;
 
                if (rtp_session->zrtp_session && (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info))) {
                        if (zrtp_session_info.sas_is_ready) {
-                               
+
                                switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
 
                                const char *uuid = switch_channel_get_partner_uuid(channel);
@@ -7492,19 +7492,19 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_sessi
 static int rtp_write_ready(switch_rtp_t *rtp_session, uint32_t bytes, int line)
 {
        if (!rtp_session) return 0;
-       
+
        if (rtp_session->ice.ice_user && !(rtp_session->ice.rready || rtp_session->ice.ready)) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG3, "Skip sending %s packet %ld bytes (ice not ready @ line %d!)\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG3, "Skip sending %s packet %ld bytes (ice not ready @ line %d!)\n",
                                                  rtp_type(rtp_session), (long)bytes, line);
                return 0;
        }
 
        if (rtp_session->dtls && rtp_session->dtls->state != DS_READY) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG3, "Skip sending %s packet %ld bytes (dtls not ready @ line %d!)\n", 
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG3, "Skip sending %s packet %ld bytes (dtls not ready @ line %d!)\n",
                                                  rtp_type(rtp_session), (long)bytes, line);
                return 0;
        }
-       
+
        return 1;
 }
 
@@ -7578,22 +7578,22 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                                || rtp_session->ts == rtp_session->samples_per_interval)) {
                                m++;
                        }
-                       
-                       if (rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] && 
+
+                       if (rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] &&
                                (rtp_session->timer.samplecount - rtp_session->last_write_samplecount) > rtp_session->samples_per_interval * 10) {
                                m++;
                        }
-                       
+
                        if (!rtp_session->flags[SWITCH_RTP_FLAG_USE_TIMER] &&
                                ((unsigned) ((switch_micro_time_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet * 10)) {
                                m++;
                        }
-                       
+
                        if (rtp_session->cn && payload != rtp_session->cng_pt) {
                                rtp_session->cn = 0;
                                m++;
                        }
-                       
+
                        if (rtp_session->need_mark && !rtp_session->sending_dtmf) {
                                m++;
                                rtp_session->need_mark = 0;
@@ -7604,13 +7604,13 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                        rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 1;
                        rtp_session->ts = 0;
                }
-       
+
                /* If the marker was set, and the timestamp seems to have started over - set a new SSRC, to indicate this is a new stream */
-               if (m && !switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND) && (rtp_session->rtp_bugs & RTP_BUG_CHANGE_SSRC_ON_MARKER) && 
+               if (m && !switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND) && (rtp_session->rtp_bugs & RTP_BUG_CHANGE_SSRC_ON_MARKER) &&
                        (rtp_session->flags[SWITCH_RTP_FLAG_RESET] || (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->last_write_ts > 0))) {
                        switch_rtp_set_ssrc(rtp_session, (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL)));
                }
-               
+
                if (!switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) && !switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) {
                        send_msg->header.m = (m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) ? 1 : 0;
                }
@@ -7618,7 +7618,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
 
 
        if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_GEN_TS_DELTA) || switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
-               /* Normalize the timestamps to our own base by generating a made up starting point then adding the measured deltas to that base 
+               /* Normalize the timestamps to our own base by generating a made up starting point then adding the measured deltas to that base
                   so if the timestamps and ssrc of the source change, it will not break the other end's jitter bufffer / decoder etc *cough* CHROME *cough*
                 */
 
@@ -7645,11 +7645,11 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                        rtp_session->ts_norm.last_ssrc = send_msg->header.ssrc;
                        rtp_session->ts_norm.last_frame = ntohl(send_msg->header.ts);
                }
-               
+
 
                if (ntohl(send_msg->header.ts) != rtp_session->ts_norm.last_frame) {
                        int32_t delta = (int32_t) (ntohl(send_msg->header.ts) - rtp_session->ts_norm.last_frame);
-                       
+
                        if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) && delta > 0 && delta < 90000) {
                                rtp_session->ts_norm.delta = delta;
                        }
@@ -7668,7 +7668,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                                }
                        }
                }
-               
+
                rtp_session->ts_norm.last_frame = ntohl(send_msg->header.ts);
                send_msg->header.ts = htonl(rtp_session->ts_norm.ts);
        }
@@ -7688,7 +7688,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                uint32_t len = sizeof(decoded);
                time_t now = switch_epoch_time_now(NULL);
                send = 0;
-               
+
                if (rtp_session->vad_data.scan_freq && rtp_session->vad_data.next_scan <= now) {
                        rtp_session->vad_data.bg_count = rtp_session->vad_data.bg_level = 0;
                        rtp_session->vad_data.next_scan = now + rtp_session->vad_data.scan_freq;
@@ -7729,7 +7729,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                                        } else {
                                                if (score > rtp_session->vad_data.bg_level && !switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING)) {
                                                        uint32_t diff = score - rtp_session->vad_data.bg_level;
-                                                       
+
                                                        if (rtp_session->vad_data.hangover_hits) {
                                                                rtp_session->vad_data.hangover_hits--;
                                                        }
@@ -7765,10 +7765,10 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                                                                        rtp_session->vad_data.total_talk_time += (rtp_session->vad_data.stop_talking - rtp_session->vad_data.start_talking);
 
                                                                        switch_clear_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING);
-                                                                       
+
                                                                        rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = rtp_session->vad_data.cng_count = 0;
                                                                        if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_EVENTS_NOTALK)) {
-                                                                               
+
                                                                                if ((rtp_session->vad_data.fire_events & VAD_FIRE_NOT_TALK)) {
                                                                                        switch_event_t *event;
                                                                                        if (switch_event_create(&event, SWITCH_EVENT_NOTALK) == SWITCH_STATUS_SUCCESS) {
@@ -7824,28 +7824,28 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
 
 
                        if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND_RESET] || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
-                               
+
                                switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
                                srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]);
                                rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL;
-                               if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp], 
+                               if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp],
                                                                                &rtp_session->send_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR,
                                                                          "Error! RE-Activating %s Secure RTP SEND\n", rtp_type(rtp_session));
                                        rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] = 0;
                                        ret = -1;
                                        goto end;
                                } else {
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, 
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO,
                                                                          "RE-Activating %s Secure RTP SEND\n", rtp_type(rtp_session));
                                }
                        }
 
 
                        stat = srtp_protect(rtp_session->send_ctx[rtp_session->srtp_idx_rtp], &send_msg->header, &sbytes);
-                       
+
                        if (stat) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR,
                                                                  "Error: %s SRTP protection failed with code %d\n", rtp_type(rtp_session), stat);
                        }
 
@@ -7857,7 +7857,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                if (zrtp_on && !rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA]) {
                        unsigned int sbytes = (int) bytes;
                        zrtp_status_t stat = zrtp_status_fail;
-                       
+
 
                        stat = zrtp_process_rtp(rtp_session->zrtp_stream, (void *) send_msg, &sbytes);
 
@@ -7911,7 +7911,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
                                                          send_msg->header.pt, ntohl(send_msg->header.ts), ntohs(send_msg->header.seq), send_msg->header.m);
 
                }
-               
+
                if (rtp_session->flags[SWITCH_RTP_FLAG_NACK]) {
                        switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
 
@@ -7940,9 +7940,9 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
 #ifdef RTP_WRITE_PLOSS
                {
                        int r = (rand() % 10000) + 1;
-                       
+
                        if (r <= 200) {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ALERT, 
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ALERT,
                                                                  "Simulate dropping packet ......... ts: %u seq: %u\n", ntohl(send_msg->header.ts), ntohs(send_msg->header.seq));
                        } else {
                                if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) send_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
@@ -7975,7 +7975,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
 
                rtp_session->stats.outbound.raw_bytes += bytes;
                rtp_session->stats.outbound.packet_count++;
-               
+
                if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) {
                        rtp_session->stats.rtcp.sent_pkt_count++;
                }
@@ -8038,7 +8038,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session,
        if (switch_true(switch_channel_get_variable(switch_core_session_get_channel(rtp_session->session), "fire_not_talk_events"))) {
                rtp_session->vad_data.fire_events |= VAD_FIRE_NOT_TALK;
        }
-       
+
 
        if (switch_core_codec_init(&rtp_session->vad_data.vad_codec,
                                                           codec->implementation->iananame,
@@ -8092,7 +8092,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
        if (!rtp_write_ready(rtp_session, frame->datalen, __LINE__)) {
                return 0;
        }
-       
+
        //if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
        //      rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++;
        //      rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]++;
@@ -8101,7 +8101,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
 
        if (switch_test_flag(frame, SFF_PROXY_PACKET) || switch_test_flag(frame, SFF_UDPTL_PACKET) ||
                rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] || rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) {
-               
+
                //if (rtp_session->flags[SWITCH_RTP_FLAG_PROXY_MEDIA] || rtp_session->flags[SWITCH_RTP_FLAG_UDPTL]) {
                switch_size_t bytes;
                //char bufa[50];
@@ -8120,7 +8120,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
                        if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->payload > 0) {
                                send_msg->header.pt = rtp_session->payload;
                        }
-               
+
                        send_msg->header.ssrc = htonl(rtp_session->ssrc);
                        send_msg->header.seq = htons(++rtp_session->seq);
                }
@@ -8165,7 +8165,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
 
                if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
                        if (zrtp_session_info.sas_is_ready) {
-                               
+
                                switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
 
                                const char *uuid = switch_channel_get_partner_uuid(channel);
@@ -8203,12 +8203,12 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
        }
 #endif
 
-       fwd = (rtp_session->flags[SWITCH_RTP_FLAG_RAW_WRITE] && 
+       fwd = (rtp_session->flags[SWITCH_RTP_FLAG_RAW_WRITE] &&
                   (switch_test_flag(frame, SFF_RAW_RTP) || switch_test_flag(frame, SFF_RAW_RTP_PARSE_FRAME))) ? 1 : 0;
 
-       if (!fwd && !rtp_session->sending_dtmf && !rtp_session->queue_delay && 
+       if (!fwd && !rtp_session->sending_dtmf && !rtp_session->queue_delay &&
                rtp_session->flags[SWITCH_RTP_FLAG_RAW_WRITE] && (rtp_session->rtp_bugs & RTP_BUG_GEN_ONE_GEN_ALL)) {
-               
+
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "Generating RTP locally but timestamp passthru is configured, disabling....\n");
                rtp_session->flags[SWITCH_RTP_FLAG_RAW_WRITE] = 0;
                rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 1;
@@ -8242,7 +8242,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
 
                wrote = switch_rtp_write_manual(rtp_session, frame->data, frame->datalen,
                                                                                frame->m, frame->payload, (uint32_t) (frame->timestamp), &frame->flags);
-               
+
                rtp_session->stats.outbound.raw_bytes += wrote;
                rtp_session->stats.outbound.media_bytes += wrote;
                rtp_session->stats.outbound.media_packet_count++;
@@ -8386,7 +8386,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
 SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session, void *data, switch_size_t *bytes, switch_bool_t process_encryption)
 {
        switch_status_t status = SWITCH_STATUS_FALSE;
-       
+
        switch_assert(bytes);
 
        if (!switch_rtp_ready(rtp_session) || !rtp_session->remote_addr || *bytes > SWITCH_RTP_MAX_BUF_LEN) {
@@ -8403,7 +8403,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session,
                process_encryption = SWITCH_FALSE;
 #ifdef ENABLE_SRTP
                if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND]) {
-               
+
                        int sbytes = (int) *bytes;
                        err_status_t stat;
 
@@ -8411,7 +8411,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session,
                                switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
                                srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]);
                                rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL;
-                               if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp], 
+                               if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp],
                                                                                &rtp_session->send_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n");
                                        rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] = 0;
index 16fc59df406a347f010eafa5f57eabe8d6f34eff..e715e2ab6559c2e6d0a379ad5ccddde46c3e5f74 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  *
  *
- * switch_scheduler.c -- Switch Scheduler 
+ * switch_scheduler.c -- Switch Scheduler
  *
  */
 
@@ -300,7 +300,7 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_del_task_group(const char *group)
        if (zstr(group)) {
                return 0;
        }
-       
+
        hash = switch_ci_hashfunc_default(group, &hlen);
 
        switch_mutex_lock(globals.task_mutex);
@@ -356,7 +356,7 @@ SWITCH_DECLARE(void) switch_scheduler_task_thread_stop(void)
                        }
                }
        }
-       
+
        switch_core_destroy_memory_pool(&globals.memory_pool);
 
 }
index 293b7505ffcba2b9e221cf9383506df9d7586e54..122ae79a73cbc4c25ead4b6451650bbc48929a65 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Christopher M. Rienzo <chris@rienzo.com>
  *
@@ -102,7 +102,7 @@ static speex_codec_settings_t default_codec_settings = {
 
 struct speex_context {
        switch_codec_t *codec;
-       speex_codec_settings_t codec_settings; 
+       speex_codec_settings_t codec_settings;
        unsigned int flags;
 
        /* Encoder */
index b27bca66e397641be68da44143343adbcb6e77b6..0e2e9adb9ffa53719140e0617ce7093942ec46ca 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Fanzhou Zhao <fanzhou@gmail.com> 2006-08-22 (Bugfix 2357-2358)
  *
@@ -331,7 +331,7 @@ SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t *buf, ui
                        break;
                }
        } while (xlen < packet->header.length);
-       
+
        if ((uint32_t) (packet->header.length + 20) > (uint32_t) (len - bytes_left)) {
                /*
                 * the packet length is longer than the length of all attributes?
@@ -339,7 +339,7 @@ SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t *buf, ui
                 */
                packet->header.length = (uint16_t) ((len - bytes_left) - 20);
        }
-       
+
        return packet;
 }
 
@@ -452,7 +452,7 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_s
 {
        switch_stun_packet_attribute_t *attribute;
        switch_stun_ip_t *ip;
-       
+
        attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length));
        attribute->type = htons(SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS);
 
@@ -486,7 +486,7 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_xor_binded_address(swit
 {
        switch_stun_packet_attribute_t *attribute;
        switch_stun_ip_t *ip;
-       
+
        attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length));
        attribute->type = htons(SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS);
 
@@ -713,7 +713,7 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
        unsigned int elapsed = 0;
        int funny = 0;
        int size = sizeof(buf);
-       int xlen = sizeof(switch_stun_packet_header_t); 
+       int xlen = sizeof(switch_stun_packet_header_t);
 
        switch_assert(err);
 
index 1521f0b1863884854366f796049c9501794342a1..db4277fee7d9ae05af67bd4174e57da6b7337e2c 100644 (file)
@@ -208,7 +208,7 @@ int fs_switch_ivr_collect_digits_count(switch_core_session_t *session,
   switch_core_session_t *peer_session,
   switch_input_callback_function_t dtmf_callback,
   void *session_data,
-  void *peer_session_data)  
+  void *peer_session_data)
   {
   switch_status_t status;
 
index 8554c5c9f3b3f83010ae9560dec65ca0bf6c0916..efa7205b4ea06a205daf3a43ccf357e9abc4c264 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Massimo Cetra <devel@navynet.it> - Timezone functionality
  *
@@ -220,7 +220,7 @@ SWITCH_DECLARE(void) switch_time_calibrate_clock(void)
        if (res > 900 && res < 1100) {
                one_k = 1;
        }
-       
+
        if (res > 1500) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
                                                  "Timer resolution of %ld microseconds detected!\n"
@@ -382,7 +382,7 @@ static switch_status_t timer_generic_sync(switch_timer_t *timer)
 {
        switch_time_t now = switch_micro_time_now();
        int64_t elapsed = (now - timer->start);
-       
+
        timer->tick = (elapsed / timer->interval) / 1000;
        timer->samplecount = (uint32_t)(timer->tick * timer->samples);
 
@@ -429,7 +429,7 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval
        }
 
        it->fd = fd;
-       
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -489,7 +489,7 @@ static switch_status_t _timerfd_check(switch_timer_t *timer, switch_bool_t step)
 
        timerfd_gettime(it->fd, &val);
        diff = val.it_interval.tv_nsec / 1000;
-       
+
        if (diff > 0) {
                /* still pending */
                timer->diff = diff;
@@ -532,7 +532,7 @@ static switch_time_t time_now(int64_t offset)
                if (offset == 0) {
                        return switch_time_now();
                } else if (offset < 0) offset = 0;
-               
+
 
                if (win32_use_qpc) {
                        /* Use QueryPerformanceCounter */
@@ -1040,7 +1040,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
                        spec.it_interval.tv_nsec = runtime.microseconds_per_tick * 1000;
                        spec.it_value.tv_sec = 0;
                        spec.it_value.tv_nsec = 100000;
-               
+
                        if (timerfd_settime(tfd, 0, &spec, NULL)) {
                                close(tfd);
                                tfd = -1;
@@ -1056,7 +1056,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
        runtime.profile_timer = switch_new_profile_timer();
        switch_get_system_idle_time(runtime.profile_timer, &runtime.profile_time);
 
-       if (runtime.timer_affinity > -1) { 
+       if (runtime.timer_affinity > -1) {
                switch_core_thread_set_cpu_affinity(runtime.timer_affinity);
        }
 
@@ -1111,7 +1111,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
                        spec.it_interval.tv_nsec = runtime.microseconds_per_tick * 1000;
                        timerfd_settime(tfd, 0, &spec, NULL);
                }
-               
+
                last_MICROSECONDS_PER_TICK = runtime.microseconds_per_tick;
 #endif
 
@@ -1222,7 +1222,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
                                switch_get_system_idle_time(runtime.profile_timer, &runtime.profile_time);
                                profile_tick = 0;
                        }
-                       
+
                        if (runtime.sps <= 0) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Rate of %d!\n", runtime.sps_total);
                        }
@@ -1238,7 +1238,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
                        }
 
                        sps_interval_ticks++;
-                       
+
                        if (runtime.sps_last > runtime.sps_peak_fivemin) {
                                runtime.sps_peak_fivemin = runtime.sps_last;
                        }
@@ -1290,7 +1290,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
        }
 
        globals.use_cond_yield = 0;
-       
+
        for (x = (runtime.microseconds_per_tick / 1000); x <= MAX_ELEMENTS; x += (runtime.microseconds_per_tick / 1000)) {
                if (TIMER_MATRIX[x].mutex && switch_mutex_trylock(TIMER_MATRIX[x].mutex) == SWITCH_STATUS_SUCCESS) {
                        switch_thread_cond_broadcast(TIMER_MATRIX[x].cond);
@@ -1315,7 +1315,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
        return SWITCH_STATUS_TERM;
 }
 
-/* 
+/*
    This converts a struct tm to a switch_time_exp_t
    We have to use UNIX structures to do our exams
    and use switch_* functions for the output.
@@ -1365,7 +1365,7 @@ SWITCH_DECLARE(const char *) switch_lookup_timezone(const char *tz_name)
        if (zstr(tz_name) || !TIMEZONES_LIST.hash) {
                return NULL;
        }
-       
+
        if ((value = switch_core_hash_find(TIMEZONES_LIST.hash, tz_name)) == NULL) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timezone '%s' not found!\n", tz_name);
        }
@@ -1602,9 +1602,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(softtimer_shutdown)
 
 
 /*
- *    This file was originally written for NetBSD and is in the public domain, 
+ *    This file was originally written for NetBSD and is in the public domain,
  *    so clarified as of 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
- *    
+ *
  *    Iw was modified by Massimo Cetra in order to be used with Callweaver and Freeswitch.
  */
 
@@ -1784,7 +1784,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(softtimer_shutdown)
 
 
 /* **************************************************************************
-           
+
    ************************************************************************** */
 
 static const char gmt[] = "GMT";
@@ -1837,7 +1837,7 @@ static const int year_lengths[2] = {
 
 
 /* **************************************************************************
-           
+
    ************************************************************************** */
 
 
@@ -2314,7 +2314,7 @@ static int tzparse(const char *name, register struct state *const sp, const int
 }
 
 /* **************************************************************************
-           
+
    ************************************************************************** */
 #if (_MSC_VER >= 1400)                 // VC8+
 #define switch_assert(expr) assert(expr);__analysis_assume( expr )
@@ -2425,7 +2425,7 @@ static void timesub(const time_t *const timep, const long offset, register const
 }
 
 /* **************************************************************************
-           
+
    ************************************************************************** */
 
 static void tztime(const time_t *const timep, const char *tzstring, struct tm *const tmp)
index 262ab4cab559184cbff2bc73e898842c77432592..a32a9396b2386eb0fb643ef1b4e891d2ddbc5399 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Juan Jose Comellas <juanjo@comellas.org>
  * Seven Du <dujinfang@gmail.com>
@@ -124,7 +124,7 @@ static switch_frame_t *find_free_frame(switch_frame_buffer_t *fb, switch_frame_t
 
        for (np = fb->head; np; np = np->next) {
                x++;
-               
+
                if (!np->inuse && ((orig->packet && np->frame->packet) || (!orig->packet && !np->frame->packet))) {
 
                        if (np == fb->head) {
@@ -140,13 +140,13 @@ static switch_frame_t *find_free_frame(switch_frame_buffer_t *fb, switch_frame_t
                        fb->total--;
                        np->prev = np->next = NULL;
                        break;
-               }               
+               }
        }
-       
+
        if (!np) {
                np = switch_core_alloc(fb->pool, sizeof(*np));
                np->frame = switch_core_alloc(fb->pool, sizeof(*np->frame));
-               
+
                if (orig->packet) {
                        np->frame->packet = switch_core_alloc(fb->pool, SWITCH_RTP_MAX_BUF_LEN);
                } else {
@@ -188,7 +188,7 @@ static switch_frame_t *find_free_frame(switch_frame_buffer_t *fb, switch_frame_t
        if (orig->img && !switch_test_flag(orig, SFF_ENCODED)) {
                switch_img_copy(orig->img, &np->frame->img);
        }
-       
+
        switch_mutex_unlock(fb->mutex);
 
        return np->frame;
@@ -203,11 +203,11 @@ SWITCH_DECLARE(switch_status_t) switch_frame_buffer_free(switch_frame_buffer_t *
 
        old_frame = *frameP;
        *frameP = NULL;
-       
+
        node = (switch_frame_node_t *) old_frame->extra_data;
        node->inuse = 0;
        switch_img_free(&node->frame->img);
-       
+
        fb->total++;
 
        if (fb->head) {
@@ -220,7 +220,7 @@ SWITCH_DECLARE(switch_status_t) switch_frame_buffer_free(switch_frame_buffer_t *
 
        switch_assert(node->next != node);
        switch_assert(node->prev != node);
-       
+
 
        switch_mutex_unlock(fb->mutex);
 
@@ -238,7 +238,7 @@ SWITCH_DECLARE(switch_status_t) switch_frame_buffer_dup(switch_frame_buffer_t *f
        switch_assert(orig->buflen);
 
        new_frame = find_free_frame(fb, orig);
-               
+
        *clone = new_frame;
 
        return SWITCH_STATUS_SUCCESS;
@@ -379,7 +379,7 @@ SWITCH_DECLARE(int) switch_strcasecmp_any(const char *str, ...)
                        break;
                }
        }
-       
+
        va_end(ap);
 
        return r;
@@ -408,7 +408,7 @@ SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param,
                        } else {
                                e = ptr + strlen(ptr);
                        }
-                       
+
                        mlen = (e - ptr) + 1;
 
                        if (pool) {
@@ -754,7 +754,7 @@ SWITCH_DECLARE(switch_size_t) switch_fd_read_dline(int fd, char **buf, switch_si
 
                if (total + 2 >= ilen) {
                        if (ilen + DLINE_BLOCK_SIZE > DLINE_MAX_SIZE) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Single line limit reached!\n"); 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Single line limit reached!\n");
                                break;
                        }
 
@@ -800,10 +800,10 @@ SWITCH_DECLARE(switch_size_t) switch_fp_read_dline(FILE *fd, char **buf, switch_
        //while ((c = fgetc(fd)) != EOF) {
 
        while (fread(&c, 1, 1, fd) == 1) {
-               
+
                if (total + 2 >= ilen) {
                        if (ilen + DLINE_BLOCK_SIZE > DLINE_MAX_SIZE) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Single line limit reached!\n"); 
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Single line limit reached!\n");
                                break;
                        }
 
@@ -1252,7 +1252,7 @@ SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip)
                        strncmp(ip, "192.168.", 8) &&  /* 192.168.0.0     -   192.168.255.255 (192.168/16 prefix) */
                        strncmp(ip, "127.", 4) &&      /* 127.0.0.0       -   127.255.255.255 (127/8 prefix)      */
                        strncmp(ip, "255.", 4) &&
-                       strncmp(ip, "0.", 2) &&       
+                       strncmp(ip, "0.", 2) &&
                        strncmp(ip, "1.", 2) &&
                        strncmp(ip, "2.", 2) &&
                        strncmp(ip, "172.16.", 7) &&   /* 172.16.0.0      -   172.31.255.255  (172.16/12 prefix)  */
@@ -1340,7 +1340,7 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str)
        while ((*sp == 13 ) || (*sp == 10 ) || (*sp == 9 ) || (*sp == 32) || (*sp == 11) ) {
                sp++;
        }
-       
+
        if (zstr(sp)) {
                return strdup(SWITCH_BLANK_STRING);
        }
@@ -2682,7 +2682,7 @@ static unsigned int separate_string_blank_delim(char *buf, char **array, unsigne
        for (i = 0; i < count; ++i) {
                array[i] = cleanup_separated_string(array[i], 0);
        }
-       
+
        return count;
 }
 
@@ -2695,7 +2695,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char
 
        if (*buf == '^' && *(buf+1) == '^') {
                char *p = buf + 2;
-               
+
                if (p && *p && *(p+1)) {
                        buf = p;
                        delim = *buf++;
@@ -2863,7 +2863,7 @@ SWITCH_DECLARE(int) switch_wait_sock(switch_os_socket_t sock, uint32_t ms, switc
 
        if (sock == SWITCH_SOCK_INVALID) {
                return SWITCH_SOCK_INVALID;
-       }       
+       }
 
        pfds[0].fd = sock;
 
@@ -2895,7 +2895,7 @@ SWITCH_DECLARE(int) switch_wait_sock(switch_os_socket_t sock, uint32_t ms, switc
        if ((flags & SWITCH_POLL_PRI)) {
                pfds[0].events |= POLLPRI;
        }
-       
+
        s = poll(pfds, 1, ms);
 
        if (s < 0) {
@@ -2943,14 +2943,14 @@ SWITCH_DECLARE(int) switch_wait_socklist(switch_waitlist_t *waitlist, uint32_t l
        int s = 0, r = 0, i;
 
        pfds = calloc(len, sizeof(struct pollfd));
-       
+
        for (i = 0; i < len; i++) {
                if (waitlist[i].sock == SWITCH_SOCK_INVALID) {
                        break;
                }
 
                pfds[i].fd = waitlist[i].sock;
-               
+
                if ((waitlist[i].events & SWITCH_POLL_READ)) {
                        pfds[i].events |= POLLIN;
                }
@@ -2979,7 +2979,7 @@ SWITCH_DECLARE(int) switch_wait_socklist(switch_waitlist_t *waitlist, uint32_t l
                        pfds[i].events |= POLLPRI;
                }
        }
-       
+
        s = poll(pfds, len, ms);
 
        if (s < 0) {
@@ -3059,14 +3059,14 @@ SWITCH_DECLARE(int) switch_wait_sock(switch_os_socket_t sock, uint32_t ms, switc
        /* Wouldn't you rather know?? */
        assert(sock <= FD_SETSIZE);
 #endif
-       
+
        if ((flags & SWITCH_POLL_READ)) {
 
 #ifdef WIN32
 #pragma warning( push )
 #pragma warning( disable : 4127 )
        FD_SET(sock, rfds);
-#pragma warning( pop ) 
+#pragma warning( pop )
 #else
        FD_SET(sock, rfds);
 #endif
@@ -3078,7 +3078,7 @@ SWITCH_DECLARE(int) switch_wait_sock(switch_os_socket_t sock, uint32_t ms, switc
 #pragma warning( push )
 #pragma warning( disable : 4127 )
        FD_SET(sock, wfds);
-#pragma warning( pop ) 
+#pragma warning( pop )
 #else
        FD_SET(sock, wfds);
 #endif
@@ -3090,7 +3090,7 @@ SWITCH_DECLARE(int) switch_wait_sock(switch_os_socket_t sock, uint32_t ms, switc
 #pragma warning( push )
 #pragma warning( disable : 4127 )
        FD_SET(sock, efds);
-#pragma warning( pop ) 
+#pragma warning( pop )
 #else
        FD_SET(sock, efds);
 #endif
@@ -3098,7 +3098,7 @@ SWITCH_DECLARE(int) switch_wait_sock(switch_os_socket_t sock, uint32_t ms, switc
 
        tv.tv_sec = ms / 1000;
        tv.tv_usec = (ms % 1000) * ms;
-       
+
        s = select(sock + 1, (flags & SWITCH_POLL_READ) ? rfds : NULL, (flags & SWITCH_POLL_WRITE) ? wfds : NULL, (flags & SWITCH_POLL_ERROR) ? efds : NULL, &tv);
 
        if (s < 0) {
@@ -3164,14 +3164,14 @@ SWITCH_DECLARE(int) switch_wait_socklist(switch_waitlist_t *waitlist, uint32_t l
                assert(waitlist[i].sock <= FD_SETSIZE);
 #endif
                flags |= waitlist[i].events;
-       
+
                if ((waitlist[i].events & SWITCH_POLL_READ)) {
 
 #ifdef WIN32
 #pragma warning( push )
 #pragma warning( disable : 4127 )
                        FD_SET(waitlist[i].sock, rfds);
-#pragma warning( pop ) 
+#pragma warning( pop )
 #else
                        FD_SET(waitlist[i].sock, rfds);
 #endif
@@ -3183,7 +3183,7 @@ SWITCH_DECLARE(int) switch_wait_socklist(switch_waitlist_t *waitlist, uint32_t l
 #pragma warning( push )
 #pragma warning( disable : 4127 )
                        FD_SET(waitlist[i].sock, wfds);
-#pragma warning( pop ) 
+#pragma warning( pop )
 #else
                        FD_SET(waitlist[i].sock, wfds);
 #endif
@@ -3195,7 +3195,7 @@ SWITCH_DECLARE(int) switch_wait_socklist(switch_waitlist_t *waitlist, uint32_t l
 #pragma warning( push )
 #pragma warning( disable : 4127 )
                        FD_SET(waitlist[i].sock, efds);
-#pragma warning( pop ) 
+#pragma warning( pop )
 #else
                        FD_SET(waitlist[i].sock, efds);
 #endif
@@ -3204,7 +3204,7 @@ SWITCH_DECLARE(int) switch_wait_socklist(switch_waitlist_t *waitlist, uint32_t l
 
        tv.tv_sec = ms / 1000;
        tv.tv_usec = (ms % 1000) * ms;
-       
+
        s = select(max_fd + 1, (flags & SWITCH_POLL_READ) ? rfds : NULL, (flags & SWITCH_POLL_WRITE) ? wfds : NULL, (flags & SWITCH_POLL_ERROR) ? efds : NULL, &tv);
 
        if (s < 0) {
@@ -3752,7 +3752,7 @@ SWITCH_DECLARE(const char *) switch_dow_int2str(int val) {
 SWITCH_DECLARE(int) switch_dow_str2int(const char *exp) {
        int ret = -1;
        int x;
-       
+
        for (x = 0; x < switch_arraylen(DOW); x++) {
                if (!strncasecmp(DOW[x], exp, 3)) {
                        ret = x + 1;
@@ -3776,10 +3776,10 @@ typedef enum {
        DOW_COMA = ','
 } dow_t;
 
-static inline dow_t _dow_read_token(const char **s) 
+static inline dow_t _dow_read_token(const char **s)
 {
        int i;
-       
+
        if (**s == '-') {
                (*s)++;
                return DOW_HYPHEN;
@@ -3804,11 +3804,11 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val)
 {
        dow_t cur, prev = DOW_EOF, range_start = DOW_EOF;
        const char *p = exp;
-               
+
        while ((cur = _dow_read_token(&p)) != DOW_EOF) {
                if (cur == DOW_COMA) {
                        /* Reset state */
-                       cur = prev = DOW_EOF;   
+                       cur = prev = DOW_EOF;
                } else if (cur == DOW_HYPHEN) {
                        /* Save the previous token and move to the next one */
                        range_start = prev;
@@ -3826,7 +3826,7 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val)
                                return SWITCH_TRUE;
                        }
                }
-               
+
                prev = cur;
        }
 
@@ -3979,7 +3979,7 @@ SWITCH_DECLARE(char *) switch_format_number(const char *num)
        }
 
        len = strlen(p);
-       
+
        /* region 1, TBD add more....*/
        if (len == 11 && p[0] == '1') {
                r = switch_mprintf("%c (%c%c%c) %c%c%c-%c%c%c%c", p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10]);
@@ -4321,11 +4321,11 @@ static void process(GumboNode *node, switch_stream_handle_t *stream)
        } else if (node->type == GUMBO_NODE_ELEMENT && node->v.element.tag != GUMBO_TAG_SCRIPT && node->v.element.tag != GUMBO_TAG_STYLE) {
                GumboVector *children = &node->v.element.children;
                int i;
-               
+
                if (node->v.element.tag != GUMBO_TAG_UNKNOWN && node->v.element.tag <= GUMBO_TAG_LAST) {
                        GumboAttribute* attr = NULL;
                        const char *aval = NULL;
-                       
+
                        if (node->v.element.tag == GUMBO_TAG_SPAN) {
                                if ((attr = gumbo_get_attribute(&node->v.element.attributes, "class"))) {
                                        aval = attr->value;
@@ -4341,13 +4341,13 @@ static void process(GumboNode *node, switch_stream_handle_t *stream)
                                                len++;
                                        }
                                }
-                               
+
                                for (x = 0; x < len*2; x++) {
                                        stream->write_function(stream, "%s", " ");
                                }
                        } else {
                                for (i = 0; i < children->length; ++i) {
-                                       process((GumboNode*) children->data[i], stream);                                
+                                       process((GumboNode*) children->data[i], stream);
                                }
                        }
 
@@ -4376,7 +4376,7 @@ SWITCH_DECLARE(char *)switch_html_strip(const char *str)
                if (!strncasecmp(p, "Content-Type:", 13)) {
                        got_ct++;
                }
-               
+
                if (!got_ct) continue;
 
                if (*p == '\n') {
index fa96b823d8db5edbe6fb8ef29d9dd9ec0cd8b9ec..396af88771060ca2cf82a9084fcf06267905c070 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
index 6c7760ea53b99d63a4949af2176017019cbab551..ab2de6d501e33503109950c4642fe46ca69b79a6 100644 (file)
@@ -225,7 +225,7 @@ typedef struct {
 
 
 #define __IS_VP8_KEY_FRAME(byte) !(((byte) & 0x01))
-static inline int IS_VP8_KEY_FRAME(uint8_t *data) 
+static inline int IS_VP8_KEY_FRAME(uint8_t *data)
 {
        uint8_t S;
        uint8_t DES;
@@ -247,7 +247,7 @@ static inline int IS_VP8_KEY_FRAME(uint8_t *data)
                if (X & 0x40) data++; // L
                if (X & 0x30) data++; // T/K
        }
-       
+
        if (S && (PID == 0)) {
                return __IS_VP8_KEY_FRAME(*data);
        } else {
@@ -336,7 +336,7 @@ static switch_status_t init_decoder(switch_codec_t *codec)
                        return SWITCH_STATUS_FALSE;
                }
 
-               
+
                context->last_ts = 0;
                context->last_received_timestamp = 0;
                context->last_received_complete_picture = 0;
@@ -370,7 +370,7 @@ static switch_status_t init_encoder(switch_codec_t *codec)
        int token_parts = 1;
        int cpus = switch_core_cpu_count();
        int sane, threads = 1;
-       
+
        if (!context->codec_settings.video.width) {
                context->codec_settings.video.width = 1280;
        }
@@ -382,7 +382,7 @@ static switch_status_t init_encoder(switch_codec_t *codec)
        if (context->codec_settings.video.bandwidth == -1) {
                context->codec_settings.video.bandwidth = 0;
        }
-       
+
        if (context->codec_settings.video.bandwidth) {
                context->bandwidth = context->codec_settings.video.bandwidth;
        } else {
@@ -400,23 +400,23 @@ static switch_status_t init_encoder(switch_codec_t *codec)
        context->pkt = NULL;
 
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(codec->session), SWITCH_LOG_NOTICE,
-                                         "VPX reset encoder picture from %dx%d to %dx%d %u BW\n", 
+                                         "VPX reset encoder picture from %dx%d to %dx%d %u BW\n",
                                          config->g_w, config->g_h, context->codec_settings.video.width, context->codec_settings.video.height, context->bandwidth);
 
        context->start_time = switch_micro_time_now();
-       
+
        config->g_timebase.num = 1;
        config->g_timebase.den = 1000;
        config->g_pass = VPX_RC_ONE_PASS;
        config->g_w = context->codec_settings.video.width;
-       config->g_h = context->codec_settings.video.height;     
+       config->g_h = context->codec_settings.video.height;
        config->rc_target_bitrate = context->bandwidth;
        config->g_lag_in_frames = 0;
        config->kf_max_dist = 360;//2000;
        threads = cpus / 4;
        if (threads < 1) threads = 1;
        config->g_threads = threads;
-       
+
        if (context->is_vp9) {
                //config->rc_dropframe_thresh = 2;
                token_parts = (cpus > 1) ? 3 : 0;
@@ -545,7 +545,7 @@ static switch_status_t init_encoder(switch_codec_t *codec)
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s init error: [%d:%s]\n", vpx_codec_iface_name(context->encoder_interface), context->encoder.err, context->encoder.err_detail);
                        return SWITCH_STATUS_FALSE;
                }
-               
+
                context->encoder_init = 1;
 
                if (context->is_vp9) {
@@ -566,7 +566,7 @@ static switch_status_t init_encoder(switch_codec_t *codec)
                        //Set cpu usage, a bit lower than normal (-6) but higher than android (-12)
                        vpx_codec_control(&context->encoder, VP8E_SET_CPUUSED, -6);
                        vpx_codec_control(&context->encoder, VP8E_SET_TOKEN_PARTITIONS, token_parts);
-                       
+
                        // Enable noise reduction
                        vpx_codec_control(&context->encoder, VP8E_SET_NOISE_SENSITIVITY, 1);
                        //Set max data rate for Intra frames.
@@ -822,7 +822,7 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
                context->need_key_frame = 3;
        }
 
-       
+
        if (!context->encoder_init) {
                if (init_encoder(codec) != SWITCH_STATUS_SUCCESS) {
                        return SWITCH_STATUS_FALSE;
@@ -871,7 +871,7 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
        context->enc_iter = NULL;
        context->last_ts = frame->timestamp;
        context->last_ms = now;
-               
+
        return consume_partition(context, frame);
 }
 
@@ -885,7 +885,7 @@ static switch_status_t buffer_vp8_packets(vpx_context_t *context, switch_frame_t
 #if 0
        int key = 0;
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
                                          "VIDEO VPX: seq: %d ts: %u len: %ld %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x mark: %d\n",
                                          frame->seq, frame->timestamp, frame->datalen,
                                          *((uint8_t *)data), *((uint8_t *)data + 1),
@@ -896,14 +896,14 @@ static switch_status_t buffer_vp8_packets(vpx_context_t *context, switch_frame_t
                                          *((uint8_t *)data + 10), frame->m);
 #endif
 
-       
+
        DES = *data;
        data++;
        S = (DES & 0x10);
        //      PID = DES & 0x07;
 
        //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DATA LEN %d S BIT %d PID: %d\n", frame->datalen, S, PID);
-                       
+
        if (DES & 0x80) { // X
                uint8_t X = *data;
                //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "X BIT SET\n");
@@ -948,7 +948,7 @@ static switch_status_t buffer_vp8_packets(vpx_context_t *context, switch_frame_t
 
        len = frame->datalen - (data - (uint8_t *)frame->data);
        //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "POST PARSE: DATA LEN %d KEY %d KEYBYTE = %0x\n", len, key, *data);
-       
+
        if (len <= 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid packet %d\n", len);
                return SWITCH_STATUS_RESTART;
@@ -1156,7 +1156,7 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
                init_decoder(codec);
                context->need_decoder_reset = 0;
        }
-       
+
        if (!context->decoder_init) {
                init_decoder(codec);
        }
@@ -1167,7 +1167,7 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
        }
 
        decoder = &context->decoder;
-       
+
        // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "len: %d ts: %u mark:%d\n", frame->datalen, frame->timestamp, frame->m);
 
        // context->last_received_timestamp = frame->timestamp;
@@ -1176,7 +1176,7 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
        if (is_start) {
                context->got_start_frame = 1;
        }
-       
+
        if (is_keyframe) {
                if (context->got_key_frame <= 0) {
                        context->got_key_frame = 1;
@@ -1239,7 +1239,7 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "VPX control error!\n");
                        switch_goto_status(SWITCH_STATUS_RESTART, end);
                }
-               
+
                if (corrupted) {
                        frame->img = NULL;
 #ifdef DEBUG_VP9
@@ -1252,9 +1252,9 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "decoded: %dx%d\n", frame->img->d_w, frame->img->d_h);
 #endif
                }
-               
+
                switch_buffer_zero(context->vpx_packet_buffer);
-               
+
                if (!frame->img) {
                        //context->need_decoder_reset = 1;
                        context->got_key_frame = 0;
@@ -1291,14 +1291,14 @@ end:
 }
 
 
-static switch_status_t switch_vpx_control(switch_codec_t *codec, 
-                                                                                 switch_codec_control_command_t cmd, 
+static switch_status_t switch_vpx_control(switch_codec_t *codec,
+                                                                                 switch_codec_control_command_t cmd,
                                                                                  switch_codec_control_type_t ctype,
                                                                                  void *cmd_data,
                                                                                  switch_codec_control_type_t atype,
                                                                                  void *cmd_arg,
                                                                                  switch_codec_control_type_t *rtype,
-                                                                                 void **ret_data) 
+                                                                                 void **ret_data)
 {
 
        vpx_context_t *context = (vpx_context_t *)codec->private_info;
@@ -1316,7 +1316,7 @@ static switch_status_t switch_vpx_control(switch_codec_t *codec,
                }
                break;
        case SCC_VIDEO_GEN_KEYFRAME:
-               context->need_key_frame = 1;            
+               context->need_key_frame = 1;
                break;
        case SCC_VIDEO_BANDWIDTH:
                {
@@ -1349,7 +1349,7 @@ static switch_status_t switch_vpx_destroy(switch_codec_t *codec)
        vpx_context_t *context = (vpx_context_t *)codec->private_info;
 
        if (context) {
-               
+
                switch_img_free(&context->patch_img);
 
                if ((codec->flags & SWITCH_CODEC_FLAG_ENCODE)) {
index ffcdd8b15f0a51f9a4904a14d22601f76c438c22..449fe7c206226f3c3280eeb373823b47a044d14a 100644 (file)
@@ -1136,7 +1136,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_fp(FILE * fp)
        char *s;
 
        s = (char *) switch_must_malloc(SWITCH_XML_BUFSIZE);
-       
+
        do {
                len += (l = fread((s + len), 1, SWITCH_XML_BUFSIZE, fp));
                if (l == SWITCH_XML_BUFSIZE) {
@@ -2065,7 +2065,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_merged(const char *key, c
 
                                if (switch_is_number(cacheable)) {
                                        int cache_ms = atol(cacheable);
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "caching lookup for user %s@%s for %d milliseconds\n", 
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "caching lookup for user %s@%s for %d milliseconds\n",
                                                                          user_name, domain_name, cache_ms);
                                        time_now = switch_micro_time_now();
                                        expires = time_now + (cache_ms * 1000);
index 4d18989cc04b3eeca76a9b3da859e551a1b07ca0..ffccfff98daa6c0c7d90691340bccc8fe5cd09ea 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Mathieu Rene <mathieu.rene@gmail.com>
  *
  *
index f71d77aecae04e2fcfdbb587c8daa5d446ed3738..ae371dcf194b34892389e391a44116ddb36ec300 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II <anthm@freeswitch.org>
  * Michael Jerris <mike@jerris.com>
  * Pawel Pierscionek <pawel@voiceworks.pl>
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
 
        for(i = 1; i < argc; i++) {
                if (!strstr(argv[i], "-")) break;
-               
+
                if (!strcmp(argv[i], "-v")) {
                        verbose = SWITCH_TRUE;
                }
@@ -134,7 +134,7 @@ int main(int argc, char *argv[])
                           );
                return 255;
        }
-       
+
        file = argv[i];
        script = argv[i+1];
 
@@ -149,12 +149,12 @@ int main(int argc, char *argv[])
                printf("Cannot init mod_sndfile [%s]\n", err);
                fail();
        }
-       
+
        if (switch_core_file_open(&fh, file, c, rate, file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
                printf("Cannot open file %s\n", file);
                fail();
        }
-       
+
        teletone_init_session(&ts, 0, teletone_handler, &fh);
        ts.rate = rate;
        ts.channels = c;
@@ -167,7 +167,7 @@ int main(int argc, char *argv[])
        teletone_run(&ts, script);
        teletone_destroy_session(&ts);
        switch_core_file_close(&fh);
-       
+
        printf("File: %s generated...\n\nPlease support:\nFreeSWITCH http://www.freeswitch.org\nClueCon http://www.cluecon.com\n", file);
 
  end: