[Freeswitch-svn] [commit] r13722 - in freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp: . include
FreeSWITCH SVN
jmesquita at freeswitch.org
Tue Jun 9 08:36:45 PDT 2009
Author: jmesquita
Date: Tue Jun 9 10:36:45 2009
New Revision: 13722
Log:
Initial checkin of mod_khomp endpoint module
Added:
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/Makefile
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KDefs.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KErrorDefs.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KGSM.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KH100Defs.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KISDN.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KMixerDefs.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KR2D.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KTypeDefs.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KVoIP.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/k3l.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/k3lVersion.h
freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/mod_khomp.cpp
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/Makefile Tue Jun 9 10:36:45 2009
@@ -0,0 +1,4 @@
+MODNAME=mod_khomp
+LOCAL_CFLAGS=-I./include -lk3l -D_REENTRANT -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DK3L_HOSTSYSTEM -lboost_thread -lboost_regex
+
+include ../../../../build/modmake.rules
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KDefs.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KDefs.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,985 @@
+#if !defined KLDEFS_H
+#define KLDEFS_H
+
+#include "KTypeDefs.h"
+#include "KH100Defs.h"
+#include "KMixerDefs.h"
+#include "KR2D.h"
+#include "KErrorDefs.h"
+
+/*
+ Faixa de comandos:
+ 0x00 - 0x3F: Comandos de operacao do canal
+ 0x40 - 0x5F: Habilitacao de recursos
+ 0x60 - 0x7F: Mixer (KMixerDefs.h)
+ 0x80 - 0x8F: Especificos para R2 (KR2D.h)
+ 0x90 - 0x9F: H100
+ 0xA0 - 0xAF: Mais comandos de mixer
+ 0xB0 - 0xCF: Vagos
+ 0xD0 - 0xDF: Compatiblidade
+ 0xF0 - 0xFE: Erros
+ 0x8000 - 0xFF00: Configuracao
+*/
+
+
+/******************************************************************************
+Comandos de controle de ligação
+Call control commands
+******************************************************************************/
+
+#define CM_SEIZE 0x01
+/* Solicita uma ocupação no canal.
+ Requests a seize in the channel.
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Events: EV_SEIZE_SUCCESS | EV_SEIZE_FAIL
+ Params:
+ [0..20] - ANI (ascii, null terminated)
+*/
+
+#define CM_SYNC_SEIZE 0x02
+/* Ocupa um canal, e retorna imediatamente o resultado.
+ Seizes a channel returning synchronously.
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Events: (synchronous command)
+ Params:
+ [0..20] - ANI (ascii, null terminated)
+*/
+
+#define CM_SIP_REGISTER 0x03
+/* Registra um usuario sip (somente para sinalizacao SIP)
+ Register a sip user (SIP singnaling only)
+
+ Events: EV_SIP_REGISTER_INFO
+ Params:
+ A null terminated ascii string with the registration parameters.
+ The expected call parameters are:
+ Parameter: Required: Description:
+ user yes User name
+ password no User password
+ proxy no Proxy to register into
+ unregister no Signal to unregister a previously registered user
+*/
+
+#define CM_DIAL_DTMF 0x04
+/* Disca uma string terminada em 0 em DTMF.
+ Dial a null terminated string, in DTMF.
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Events: EV_DTMF_SEND_FINISH
+
+ Params:
+ String with the number to dial (ascii)
+*/
+
+#define CM_DISCONNECT 0x05
+/* Desliga.
+ Disconnects.
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Events: EV_CHANNEL_FREE
+*/
+
+#define CM_CONNECT 0x06
+/* Atende uma chamada recebida.
+ Answers a incoming call.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_PRE_CONNECT 0x07
+/* Habilita audio antes de enviar o comando atendimento (mensagem sem tarifacao).
+ Enable audio before send an answer command (no charged messages).
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_CAS_CHANGE_LINE_STT 0x08
+/* Para sinalizacao do tipo personalizada, muda o estado dos bits ABCD de saida
+ For custom signaling changes forward ABCD bits state
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Params:
+ [0] - New state
+*/
+
+#define CM_CAS_SEND_MFC 0x09
+/* Para sinalizacao do tipo personalizada, envia uma nova cifra MFC
+ For custom signaling changes, sends a new MFC
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Params:
+ [0] - New state
+*/
+
+#define CM_SET_FORWARD_CHANNEL 0x0A
+/* Programa um canal para ser prosseguir com as ligacoes de outro canal.
+ Sets the a channel to forward call from the actual channel.
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Params:
+ [0..3] - Pointer to an interger containing the forward channel number
+*/
+
+#define CM_CAS_SET_MFC_DETECT_MODE 0x0B
+/* Habilita e configura o detector de MFC para filtra sinais de entrada ou saida
+ Enables and configures the MFC detectors to filters incoming ou outgoing signals
+
+ K3L_COMMAND.Object = ChannelNumber
+ Params:
+ [0] - kscFree( 0 )/kcsIncoming( 1 )/kcsOutgoing( 2 )
+*/
+
+#define CM_DROP_COLLECT_CALL 0x0C
+/* Derruba chamadas a cobrar, desligando a chamada e a atendendendo novamente após o
+ tempo configurado.
+ Drops collect calls by disconnecting and connecting again after the configured delay.
+*/
+
+
+#define CM_MAKE_CALL 0x0D
+/* Realiza uma chamada (disponivel para sinalizacao SIP)
+ Make a call (available for SIP singnaling)
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Events: EV_CALL_SUCCESS | EV_CALL_FAIL
+ Params:
+ A null terminated ascii string with the call parameters.
+ The expected call parameters are:
+ Parameter: Required: Protocol: Description:
+ dest_addr yes ALL Destiny's number (address)
+ orig_addr yes ALL Caller number (address)
+ sip_to no IP Destiny's address/ID (same as dest_addr, can be used instead)
+ network_dest_addr no IP Destiny's/SIP Proxy network address
+ r2_categ_a no R2 Caller Category
+ isdn_orig_type_of_number no ISDN Caller type of number (KQ931TypeOfNumber, KISDN.h)
+ isdn_orig_numbering_plan no ISDN Caller numbering plan (KQ931NumberingPlan, KISDN.h)
+ isdn_orig_presentation no ISDN Callers presentation indicator (KQ931PresentationIndicator, KISDN.h)
+ isdn_dest_type_of_number no ISDN Destiny's type of number
+ isdn_dest_numbering_plan no ISDN Destiny's numbering plan
+*/
+
+#define CM_RINGBACK 0x0E
+/* Aceita ou rejeita a chamada entrante em qualquer sinalização, equivalente a CM_SEND_LINE_CONDITION para
+ o R2 Digital.
+
+ Accepts or reject an incomming call in any signaling, equivalent to CM_SEND_LINE_CONDITION in Digital R2.
+
+ K3L_COMMAND.Object = ChannelNumber
+ Params:
+ A null terminated ascii string with the parameter to pass or NULL for default
+
+ The expected parameters are:
+ Parameter: Protocol: Description:
+ r2_cond_b R2 Called party category. Note that if CM_SET_LINE_CONDITION was called before it
+ is not needed to call CM_RINGBACK, the category is sent automatically.
+ sip_prov_resp IP Sip Response, if present, sends a DISCONNECT with given response (reason),
+ default is to send a ringback to caller.
+ isdn_cause ISDN ISDN cause, if present, sends DISCONNECT with given cause, default is to
+ send alerting indication to caller.
+*/
+
+#define CM_USER_INFORMATION 0x0F
+/* Envia dados sobre o canal HDLC, disponível somente para RDSI.
+
+ K3L_COMMAND.Object = ChannelNumber
+ Params:
+ A pointer to a KUserInformation structure which has the following members:
+
+ ProtocolDescriptor - KQ931UserInfoProtocolDescriptor
+ UserInfoLength - Length of UserInfo data array
+ UserInfo - pointer to the data array to be transmitted
+
+
+
+*/
+
+#define CM_VOIP_SEIZE 0x23
+/* EM DESUSO: Usar CM_MAKE_CALL
+ DEPRECATED: Use CM_MAKE_CALL instead
+*/
+
+/******************************************************************************
+Bloqueio e desbloqueio de canais (E1)
+Channel locking and unlocking (E1)
+******************************************************************************/
+
+#define CM_LOCK_INCOMING 0x10
+/* Solicita à operadora o bloqueio de ligações entrantes.
+ Requests the central office a lock of incoming calls.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_UNLOCK_INCOMING 0x11
+/* Solicita à operadora o desbloqueio de ligações entrantes.
+ Requests the central office to unlock incoming calls.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_LOCK_OUTGOING 0x12
+/* Bloqueia ligações saintes..
+ Locks outgoing calls.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_UNLOCK_OUTGOING 0x13
+/* Desbloqueia ligações saintes.
+ Unlocks outgoing calls.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_START_SEND_FAIL 0x14
+/* Inicia envio de falha na linha.
+ Starts to send a fail signal in the line.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_STOP_SEND_FAIL 0x15
+/* Para o envio de falha na linha.
+ Stop send a fail signal in the line.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_END_OF_NUMBER 0x16
+/* Informa a sinalizacao que nao devem ser recebidos mais digitos de discagem
+ Notify singaling to dont receive more digits
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_SEND_SIP_DATA 0x17
+/*
+ Envia dados raw através de uma ligação SIP(só funciona com ligações K3L para K3L)
+ Send raw data throught a SIP call(works only with K3L to K3L calls)
+
+ K3L_COMMAND.Object = ChannelNumber
+ Params:
+ A pointer to a KSipData structure which has the following members:
+
+ DataLength - Length of data array
+ Data - pointer to the data array to be transmitted
+*/
+
+#define CM_SS_TRANSFER 0x18
+/* single step transfer, QSig signaling only!
+
+ Params:
+ Events: EV_DISCONNECT | EV_SS_TRANSFER_FAIL
+ Params:
+ A null terminated ascii string with the call parameters.
+ The expected call parameters are:
+ Parameter: Required: Type: Description:
+ transferred_to yes int string The number to be transferred to
+ await_connect no boolean Await to be connected to the third party, default 0 (false)
+*/
+
+#define CM_GET_SMS 0x19
+/* Verifica novas mensagens SMS
+ Check for new SMS messages
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Events: EV_SMS_INFO, EV_SMS_DATA
+*/
+
+#define CM_PREPARE_SMS 0x1A
+/* Armazena o texto a ser enviado via SMS
+ Store SMS text to send
+
+ K3L_COMMAND.Object = ChannelNumber
+ K3L_COMMAND.Params = A null terminated ascii string with the text
+*/
+
+#define CM_SEND_SMS 0x1B
+/* Envia o ultimo SMS armazenado com CM_PREPARE_SMS
+ Send the last SMS stored with CM_PREPARE_SMS
+
+ K3L_COMMAND.Object = ChannelNumber
+ K3L_COMMAND.Params = A null terminated ascii string with the SMS params
+ Parameter: Type: Description:
+ sms_to int The number to be send
+ sms_coding enum: The message coding (Optional)
+ iso88591 iso88591 converted to 7-bits GSM alphabet (Default)
+ user 8-bits user-defined alphabet
+
+ Events: EV_SMS_SEND_RESULT
+*/
+
+#define CM_SEND_TO_MODEM 0x1C
+/* Envia o comando para o Modem
+ Send command to Modem
+
+ K3L_COMMAND.Object = ChannelNumber
+ K3L_COMMAND.Params = A null terminated ascii string with the AT modem command
+*/
+
+#define CM_CHECK_NEW_SMS 0x1D
+/* Consulta sobre novos SMSs
+ Check for new SMSs arrived
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Events: EV_NEW_SMS
+*/
+
+#define CM_ISDN_SEND_SUBADDRESSES 0x1E
+/* Envia os parâmetros de Calling/Called Party Subaddress no SETUP da próxima ligação
+ Sends Calling/Called Party Subaddress information elements in next call's SETUP.
+
+ K3L_COMMAND.Object = ChannelNumber
+ K3L_COMMAND.Params = A pointer to a KISDNSubaddresses structure
+ containing both Calling and Called Party Subaddress, in the
+ case of one of them is to be missing in the SETUP message,
+ Subaddress Information Length should be set to 0 (zero).
+
+ See:
+ CM_MAKE_CALL
+ EV_NEW_CALL
+ EV_ISDN_SUBADDRESSES
+
+*/
+
+/******************************************************************************
+Ativacao de recursos
+Resource enabling
+******************************************************************************/
+#define CM_ENABLE_DTMF_SUPPRESSION 0x30
+/*
+ Habilita a supressao de DTMF
+ Enables dtmf suppression
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_DISABLE_DTMF_SUPPRESSION 0x31
+/* Desabilita a supressao de DTMF
+ Disables dtmf suppression
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_ENABLE_AUDIO_EVENTS 0x32
+/* Habilita os eventos de audio.
+ Enable audio events.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_DISABLE_AUDIO_EVENTS 0x33
+/* Desabilita os eventos de audio.
+ Disable audio events.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_ENABLE_CALL_PROGRESS 0x34
+/* Habilita o call progress automatico.
+ Enable automatic call progress.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_DISABLE_CALL_PROGRESS 0x35
+/* Desabilita o call progress automatico.
+ Disable automatic call progress.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_FLASH 0x36
+/* Flash
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_ENABLE_PULSE_DETECTION 0x37
+/*
+ Habilita a detecção de Pulso(decádica)
+ Enables pulse detection
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_DISABLE_PULSE_DETECTION 0x38
+/*
+ Desabilita a detecção de Pulso(decádica)
+ Disables pulse detection
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_ENABLE_ECHO_CANCELLER 0x39
+/*
+ Habilita o cancelamento de eco.
+ Enables echo cancelation
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_DISABLE_ECHO_CANCELLER 0x3A
+/*
+ Desabilita o cancelador de eco.
+ Disables echo cancelation.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_ENABLE_AGC 0x3B
+/*
+ Habilita o controle de ganho automático do canal.
+ Enable auto gain contol.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_DISABLE_AGC 0x3C
+/*
+ Desabilita o controle de ganho automático do canal.
+ Disable auto gain contol.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_ENABLE_HIGH_IMP_EVENTS 0x3D
+/*
+ Habilita eventos e gravação de audio com a linha em alta impedância.
+ Enable audio events and record with high impedance line.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_DISABLE_HIGH_IMP_EVENTS 0x3E
+/*
+ Desabilita eventos e gravação de audio com a linha em alta impedância.
+ Disable audio events and record with high impedance line.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_ENABLE_CALL_ANSWER_INFO 0x40
+/*
+ Desabilita evento de informação de atendimento.
+ Disable call answer info event.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_DISABLE_CALL_ANSWER_INFO 0x41
+/*
+ Habilita evento de informação de atendimento.
+ Enable call answer info event.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+
+/******************************************************************************
+Comandos de link e da placa (E1)
+Link and board commands (E1)
+******************************************************************************/
+#define CM_RESET_LINK 0xF1
+/* Reinicia o link inteiro.
+ Resets the entire link.
+
+ K3L_COMMAND.Object = LinkNumber
+*/
+
+#define CM_CLEAR_LINK_ERROR_COUNTER 0xF2
+/* Clears the error counters for the specified link.
+ Zera os contadores de erro para o link indicado.
+
+ K3L_COMMAND.Object = LinkNumber
+*/
+
+#define CM_SEND_DEVICE_SECURITY_KEY 0xF3
+/* Usado para liberar placas que estejam utilizando a proteção de integradores
+ Used to unlock boards that are using integrator protection.
+
+ Params:
+ Pointer to an unsigned integer containing the security key for the board.
+
+ See:
+ EV_REQUEST_DEVICE_SECURITY_KEY
+*/
+
+/******************************************************************************
+ Eventos enviados da placa ao host
+ Device to host sent events
+******************************************************************************/
+
+#define EV_CHANNEL_FREE 0x01
+/* O canal está livre para uso
+ Channel ready for use
+*/
+
+#define EV_CONNECT 0x03
+/* A chamada esta completa e os recursos de audio estao ativos.
+ Call completed. Audio resources ready.
+*/
+
+#define EV_DISCONNECT 0x04
+/* O assinante B desligou.
+ Called part dropped the call.
+
+ K3L_EVENT.AddInfo = Disconnect Cause (KQ931Cause if signaling is ISDN, zero otherwise)
+*/
+
+#define EV_CALL_SUCCESS 0x05
+/* A chamada terá proceguimento. Na sinalização R2, o campo AddInfo informa a condição de B (Grupo B).
+ Call will proceed. In R2 signaling, field AddInfo contains B's condition (Group B).
+
+ K3L_EVENT.AddInfo = Called line condition (if in R2D)
+
+ Obs: Eventos consecutivos: EV_CONNECT (atendimento) ou EV_NO_ANSWER (ninguém atende).
+ Following events: EV_CONNECT (answering) or EV_NO_ANSWER (nobody answers).
+*/
+
+#define EV_CALL_FAIL 0x06
+/* A chamada não procederá. O campo AddInfo informa o motivo.
+ Call fails and will not proceed. Field AddInfo indicates the given reason.
+
+ K3L_EVENT.AddInfo = Reason of disconnection.
+
+ R2 - Group B (KSignGroupB, KR2D.h)
+ ISDN - ISDN cause (KQ931Cause, KISDN.h)
+ Analog - Cadence name that has been detected ('A'-'Z')
+
+ Obs: Eventos consecutivos: EV_CHANNEL_FREE
+ Following events: EV_CHANNEL_FREE
+*/
+
+#define EV_NO_ANSWER 0x07
+/* Destino não atende.
+ Called does not answer.
+*/
+
+#define EV_BILLING_PULSE 0x08
+/* Recebido um pulso de cobrança.
+ A billing pulse was received.
+*/
+
+#define EV_SEIZE_SUCCESS 0x09
+/* A solicitação de ocupação assincrona foi bem sucedida.
+ The async seizure command was successful.
+*/
+
+#define EV_SEIZE_FAIL 0x0A
+/* Falhas na ocupação assincrona.
+ Async seize fail.
+
+ K3L_EVENT.AddInfo = Fail cause. (enum KSeizeFail)
+*/
+
+#define EV_SEIZURE_START 0x0B
+/* Notificao de ocupacao do canal, inicio da sinalizacao.
+ Channel seizure notification, begin of signaling.
+*/
+
+#define EV_CAS_LINE_STT_CHANGED 0x0C
+/* Notificacao de mudanca no estado da linha (ABCD)
+ Line state change notification (ABCD)
+*/
+
+#define EV_CAS_MFC_RECV 0x0D
+/* Recebimento de cifra MFC
+ MFC digit received
+*/
+
+#define EV_NEW_CALL 0x0E
+/* Notificação de recebimento de chamada
+ Call arriving notification
+
+ Params:
+ A null terminated ascii string with the call parameters. To easily get the parameters, use
+ the k3lGetEventParam function.
+ The parameters that could be present are:
+ Parameter: Protocol: Description:
+ dest_addr ALL Destiny's number (address)
+ orig_addr ALL Caller number (address)
+ network_orig_addr IP Caller SIP network address
+ r2_categ_a R2 Caller Category
+ isdn_orig_type_of_number ISDN Caller type of number (KQ931TypeOfNumber, KISDN.h)
+ isdn_orig_numbering_plan ISDN Caller numbering plan (KQ931NumberingPlan, KISDN.h)
+ isdn_orig_presentation ISDN Caller presentation indicator (KQ931PresentationIndicator, KISDN.h)
+ isdn_orig_screening ISDN Caller screening indicator (KQ931ScreeningIndicator, KISDN.h)
+ isdn_dest_type_of_number ISDN Destiny's type of number
+ isdn_dest_numbering_plan ISDN Destiny's numbering plan
+ isdn_redirecting_number ISDN "TRUE" if call is being redirected
+ isdn_reverse_charge ISDN "TRUE" if call is reverse charge (collect call)
+ isdn_has_subaddresses ISDN "TRUE" if call has subaddresses information (will be
+ sent in EV_ISDN_SUBADDRESSES)
+*/
+
+#define EV_USER_INFORMATION 0x0F
+/* Notificação de dados de usuário recebidos pelo HDLC em uma ligação RDSI.
+ User information received by HDLC in ISDN call.
+
+ Params:
+ A pointer to a KUserInformation structure, containing information and the data itself.
+
+*/
+
+#define EV_DIALED_DIGIT 0x10
+/* Recebido digito de discagem
+ Dialing digit received
+
+ K3L_EVENT.AddInfo = Digit (ascii)
+*/
+
+#define EV_SIP_REGISTER_INFO 0x11
+/* Notificação de conclusao de registro
+ Register conclusion notification
+
+ Params:
+ A null terminated ascii string with the registration parameters.
+ The expected call parameters are:
+ Parameter: Description:
+ user User name of registration
+ proxy Registration proxy
+ unregister Signal that this the event represents a response to an user unregistration
+
+ K3L_EVENT.AddInfo = SIP Response. ( enum KSIP_Failures )
+*/
+
+#define EV_RING_DETECTED 0x12
+/* Recebido ring em ramal analógico
+ Ringing received on analog branch
+
+ Only Available when High Impedance Events are disabled.
+
+ See:
+ CM_ENABLE_HIGH_IMP_EVENTS
+ CM_DISABLE_HIGH_IMP_EVENTS
+*/
+
+#define EV_ISDN_SUBADDRESSES 0x13
+/* Chamada RDSI possuia informação de Subaddress na mensagem SETUP
+ ISDN Call has subadress information in SETUP message
+
+ Params:
+ A pointer to a KISDNSubaddresses structure containing both
+ Calling and Called Party Subaddress, in the case of one of
+ them is missing in the SETUP message, Subaddress Information
+ Length will be set to 0 (zero).
+
+ See:
+ EV_NEW_CALL
+
+*/
+
+#define EV_CALL_HOLD_START 0x16
+/* Indica se o canal entrou em espera
+ Indicates if a channel is being held
+*/
+
+#define EV_CALL_HOLD_STOP 0x17
+/* Indica se o canal saiu da espera
+ Indicates if a channel left hold state
+*/
+
+#define EV_SS_TRANSFER_FAIL 0x18
+/* Falha na transferencia do QSig!
+ QSig Single Step Transfer Fail
+*/
+
+#define EV_FLASH 0x19
+/* Flash detectado
+ Flash detected
+*/
+
+#define EV_ISDN_PROGRESS_INDICATOR 0x1A
+/* Recebimento do elemento de informação Progress Indicator
+ em canal RDSI.
+ Progress Indicator information element received in a
+ ISDN channel.
+
+ K3L_EVENT.AddInfo = Progress Description (KQ931ProgressIndication, KISDN.h)
+
+*/
+
+#define EV_DTMF_DETECTED 0x20
+/* Detectado dígito DTMF.
+ DTMF digit detected.
+
+ K3L_EVENT.AddInfo = Detected digit (ascii)
+*/
+
+#define EV_DTMF_SEND_FINISH 0x21
+/* Fim da discagem DTMF
+ DTMF dial complete
+*/
+
+#define EV_AUDIO_STATUS 0x22
+/* Mudança no estado do audio do canal.
+ Audio status changed.
+
+ K3L_EVENT.AddInfo = Audio detected. (enum KMixerTone)
+*/
+
+#define EV_CADENCE_RECOGNIZED 0x23
+#define EV_CALL_PROGRESS EV_CADENCE_RECOGNIZED
+/* Deteccao de uma cadencia no call progress.
+ Cadenced detected by automatic call progress.
+
+ K3L_EVENT.AddInfo = Cadence index defined in config. file
+*/
+
+#define EV_END_OF_STREAM 0x24
+/* Encontrado fim de arquivo ou de buffer na reprodução de áudio.
+ End of file or end of buffer reached during a play.
+*/
+
+#define EV_PULSE_DETECTED 0x25
+/* Detectado dígito decádico.
+ PULSE digit detected.
+
+ K3L_EVENT.AddInfo = Detected digit (ascii)
+*/
+
+#define EV_POLARITY_REVERSAL 0x26
+/* Detectada inversao de polaridade
+ Polarity reversal detected
+*/
+
+#define EV_CALL_ANSWER_INFO 0x27
+/* Indicates information about the call after connection
+ Indica o informações sobre a chamada quando ela é completada
+ Obs.: the indications are not precise in some cases
+ as indicações não são precisas em alguns casos
+
+ K3L_EVENT.AddInfo = Call Info ( enum KCallStartInfo );
+*/
+
+#define EV_COLLECT_CALL 0x28
+/* Indicates an incoming collect call
+ Indica um ligação a cobrar entrante
+*/
+
+#define EV_SIP_DTMF_DETECTED 0x29
+/* Detectado dígito DTMF out band em canais SIP(RFC2833/SIP EVENT).
+ Out band DTMF digit detected in SIP channel(RFC2833/SIP EVENT).
+
+ K3L_EVENT.AddInfo = Detected digit (ascii)
+*/
+
+#define EV_SIP_DATA 0x2A
+/* Indica recepção de pacotes de dados enviado com o comando CM_SEND_SIP_DATA.
+ Indicates reception of data sent by CM_SEND_SIP_DATA command.
+
+ Params:
+ A pointer to a KSipData structure which has the following members:
+
+ DataLength - Length of data array
+ Data - pointer to the data array
+*/
+
+
+#define EV_RECV_FROM_MODEM 0x42
+/* Eventos recebidos do modem
+ Events received from modem
+
+ K3L_EVENT.Params = A null terminated string with the events from modem
+*/
+
+#define EV_NEW_SMS 0x43
+/* Indica a chegada de um novo SMS
+ Indicates a new SMS arrived
+*/
+
+#define EV_SMS_INFO 0x44
+/* Recebido mensagem SMS
+ Received SMS message
+
+ K3L_EVENT.Params = A null terminated string with the sms parameters
+ Parameter: Type Description:
+ sms_from string The number of sender
+ sms_date string Date that the message has been send
+ sms_size int Message size
+ sms_coding enum: The message alphabet
+ iso88591 7-bits GSM alphabet converted to iso88591
+ user 8-bits user-defined alphabet
+*/
+
+#define EV_SMS_DATA 0x45
+/* Recebido mensagem SMS
+ Received SMS message
+
+ K3L_EVENT.Param = A null terminated string with the sms body
+*/
+
+#define EV_SMS_SEND_RESULT 0x46
+/* Indica o resultado do envio de SMS
+ Indicates de result of SMS send
+
+ K3L_EVENT.AddInfo = Result code (KGsmCallCause)
+*/
+
+/******************************************************************************
+Erros
+Errors
+******************************************************************************/
+#define EV_CHANNEL_FAIL 0x30
+/* Falhas relacionadas ao sistema.
+ System related fails.
+
+ K3L_EVENT.AddInfo = Fail cause
+ R2 - KChannelFailCause, KErrorDefs.h
+ ISDN - KQ931Cause, KISDN.h
+*/
+
+#define EV_REFERENCE_FAIL 0x31
+/* Referncia de rede da mestre secundaria perdida.
+ Secundary master network reference lost.
+*/
+
+#define EV_INTERNAL_FAIL 0x32
+/* Falha do sistema.
+ System internal fail.
+
+ K3L_EVENT.AddInfo = Fail cause. (enum KInternalFail)
+*/
+
+#define EV_HARDWARE_FAIL 0x33
+/* Usado apenas internamente.
+ Internal use only.
+*/
+
+#define EV_LINK_STATUS 0x34
+/* Indica periodicamente variação nos contadores de erros dos links, se ocorrerem.
+ Indicates periodically link errors counters variations, if it did happens.
+
+ K3L_EVENT.AddInfo = Cause (enum KE1Status)
+ K3L_EVENT.ObjectId = koiLink
+*/
+
+#define EV_PHYSICAL_LINK_UP 0x35
+/* Estabelecimento do link E1
+ Link up
+
+ K3L_EVENT.AddInfo = Cause (enum KE1Status)
+ K3L_EVENT.ObjectId = koiLink
+*/
+
+#define EV_PHYSICAL_LINK_DOWN 0x36
+/* Queda do link
+ Link down
+
+ K3L_EVENT.AddInfo = Cause (enum KE1Status)
+ K3L_EVENT.ObjectId = koiLink
+*/
+
+
+#define EV_CLIENT_RECONNECT 0xF0
+/* Indica que a api cliente reconectou automaticamente com sucesso na api servidora
+ após uma falha de comunicação.
+
+ Signs that client api successfully connected to the server api after a communication
+ failure.
+*/
+
+#define EV_CLIENT_AUDIOLISTENER_TIMEOUT 0xF1
+/* Indica que a callback registrada para a audio listener foi desativada automaticamente após ficar 3 segundos sem resposta.
+ (somente quando a interface de buffers assincronos não está sendo utilizada)
+
+ Signs that a registered audio listener callback was automaticaly deactivated due to wait 3 seconds without response.
+ (only when assynchronous buffers interface is not used)
+*/
+
+#define EV_CLIENT_BUFFERED_AUDIOLISTENER_OVERFLOW 0xF2
+/* Indica que o buffer da callback de áudio chegou ao limite e vai descartar alguns dados de áudio.
+ (somente para interface de buffers assincrona)
+
+ Signs that the audio callback buffer overflowed and will discard some audio samples.
+ (assynchronous buffers interface only)
+*/
+
+#define EV_REQUEST_DEVICE_SECURITY_KEY 0xF3
+/* Indica que a placa está usando a proteção dos integradores
+ Indicates that the board is using the integrator protection.
+
+ Params:
+ A NULL terminated string the should be use to send the device security key.
+
+ See:
+ CM_SEND_DEVICE_SECURITY_KEY
+
+*/
+
+/******************************************************************************
+Compatibilidade
+Compatibility
+******************************************************************************/
+#define CM_SEND_DTMF 0xD1
+/* EM DESUSO: Usar CM_DIAL_DTMF
+ Envia um dígito de discagem (DTMF).
+ DEPRECATED: Use CM_DIAL_DTMF instead
+ Sends a dial digit (DTMF).
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Events: EV_DTMF_SEND_FINISH
+
+ Params:
+ [0] - Ascii of the digit
+*/
+
+#define CM_STOP_AUDIO 0xD2
+/* EM DESUSO: Usar CM_STOP_PLAY ou CM_STOP_RECORD
+ Para a gravção do canal.
+ DEPRECATED: Use CM_STOP_PLAY or CM_STOP_RECORD instead
+ Stops channel recording.
+
+ K3L_COMMAND.Object = PlayerNumber/ChannelNumber
+
+ Params:
+ [0] - 1 StopPlay (kTx)| 2 StopRx (kRx) | 3 StopBoth (kBoth)
+*/
+
+#define CM_HARD_RESET 0xF0
+/* Reinicia uma placa.
+ Restarts a board.
+
+ K3L_COMMAND.Object = none
+*/
+
+#define EV_VOIP_SEIZURE 0x40
+/* EM DESUSO: Usar EV_NEW_CALL
+ Foi solicitada uma ocupação de entrada.
+ DEPRECATED: Use EV_NEW_CALL instead
+ There is a incoming seize in a network resource.
+
+
+ Params:
+ [0..60] - DNIS (dialed number, ascii, null terminated)
+ [61..122] - ANI (dialer number, ascii, null terminated)
+*/
+
+#define EV_SEIZURE 0x41
+/* EM DESUSO: Usar EV_NEW_CALL
+ Foi solicitada uma ocupação de entrada.
+ DEPRECATED: Use EV_NEW_CALL instead
+ There is a incoming seize in a network resource.
+
+ K3L_EVENT.AddInfo = Category of A (R2)
+
+ Params:
+ [0..20] - DNIS (dialed number, ascii, null terminated)
+ [21..42] - ANI (dialer number, ascii, null terminated)
+*/
+
+#endif
+
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KErrorDefs.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KErrorDefs.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,133 @@
+/******************************************************************************
+Erros e falhas
+Errors and fails
+******************************************************************************/
+// EV_CHANNEL_FAIL
+ #define FC_REMOTE_FAIL 0x01
+/* Falha remota.
+ Remote fail.
+*/
+ #define FC_LOCAL_FAIL 0x02
+/* Falha local.
+ Local fail.
+*/
+ #define FC_REMOTE_LOCK 0x03
+/* Canal bloqueado remotamente.
+ Channel remotely locked.
+*/
+ #define FC_LINE_SIGNAL_FAIL 0x04
+/* Falha na sinalização de linha.
+ Line signaling fail.
+*/
+ #define FC_ACOUSTIC_SIGNAL_FAIL 0x05
+/* Falha na sinalização de registro.
+ Register signaling fail.
+*/
+
+enum KChannelFail
+{
+ kfcRemoteFail = FC_REMOTE_FAIL,
+ kfcLocalFail = FC_LOCAL_FAIL,
+ kfcRemoteLock = FC_REMOTE_LOCK,
+ kfcLineSignalFail = FC_LINE_SIGNAL_FAIL,
+ kfcAcousticSignalFail = FC_ACOUSTIC_SIGNAL_FAIL
+};
+
+// EV_INTERNAL_FAIL
+ #define ER_INTERRUPT_CTRL 0x01
+/* Falha no controlador de interrupções
+ Interrupt controller fail
+*/
+ #define ER_COMMUNICATION_FAIL 0x02
+/* Falha na comunicação com a interface
+ Interface communication fail
+*/
+ #define ER_PROTOCOL_FAIL 0x03
+/* Falha no tratamento do protocolo de comunicação
+ Protocol fail
+*/
+ #define ER_INTERNAL_BUFFER 0x04
+/* Erro interno na API
+ API internal error
+*/
+ #define ER_MONITOR_BUFFER 0x05
+/* Erro no buffer de monitoração
+ Monitor buffer error
+*/
+ #define ER_INITIALIZATION 0x06
+/* Falha na inicialização do sistema
+ Initialization fail
+*/
+ #define ER_INTERFACE_FAIL 0x07
+/* A interface nao responde
+ Interface is dead
+*/
+ #define ER_CLIENT_COMM_FAIL 0x08
+/* Falha do cliente na comunicacao cliente/servidor
+ Client fails in client/server communication
+*/
+ #define ER_POLL_CTRL 0x09
+/* Falha no controle de polling
+ Polling control fail
+*/
+ #define ER_EVT_BUFFER_CTRL 0x0A
+/* Falha da API no controle de buffer circular de eventos
+ Circular buffer event control fails
+*/
+
+ #define ER_INVALID_CONFIG_VALUE 0x0B
+/* Valor invalido em arquivo de configuracao
+ Invalid configuration value
+*/
+
+ #define ER_INTERNAL_GENERIC_FAIL 0x0C
+/* Falha generica. Dados sobre o erro encontrados nos logs
+ Generic fail. See logs for more information
+*/
+
+enum KInternalFail
+{
+ kifInterruptCtrl = ER_INTERRUPT_CTRL,
+ kifCommunicationFail = ER_COMMUNICATION_FAIL,
+ kifProtocolFail = ER_PROTOCOL_FAIL,
+ kifInternalBuffer = ER_INTERNAL_BUFFER,
+ kifMonitorBuffer = ER_MONITOR_BUFFER,
+ kifInitialization = ER_INITIALIZATION,
+ kifInterfaceFail = ER_INTERFACE_FAIL,
+ kifClientCommFail = ER_CLIENT_COMM_FAIL
+};
+
+// EV_SEIZE_FAIL
+ #define FS_CHANNEL_LOCKED 0x01
+/* Ocupação negada por bloqueio de saída.
+ The channel is locally locked for outgoing calls.
+*/
+ #define FS_INCOMING_CHANNEL 0x02
+/* Canal liberado somente para entrada.
+ Channel is only for income calls.
+*/
+ #define FS_CHANNEL_NOT_FREE 0x03
+/* Canal ocupado ou com falha.
+ Channel busy.
+*/
+ #define FS_DOUBLE_SEIZE 0x04
+/* Dupla ocupação (canal recebeu uma ocupação ao invés de uma confirmação).
+ Double seize (channel receives a seize instead of a seize confirmation).
+*/
+ #define FS_LOCAL_CONGESTION 0x06
+/* Congestionamento local
+ Local congestion
+*/
+ #define FS_NO_DIAL_TONE 0x07
+/* Sem tom de discagem (utilizado na analogica)
+ No dial tone (analog lines)
+*/
+enum KSeizeFail
+{
+ ksfChannelLocked = FS_CHANNEL_LOCKED,
+ ksfIncomingChannel = FS_INCOMING_CHANNEL,
+ ksfChannelBusy = FS_CHANNEL_NOT_FREE,
+ ksfDoubleSeizure = FS_DOUBLE_SEIZE,
+ ksfCongestion = FS_LOCAL_CONGESTION,
+ ksfNoDialTone = FS_NO_DIAL_TONE
+};
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KGSM.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KGSM.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,220 @@
+#ifndef KGSM_H
+#define KGSM_H
+
+/*
+ * KGsmCallCause: Causes for Call Fail
+ */
+enum KGsmCallCause
+{
+ kgccNone = 0,
+ kgccUnallocatedNumber = 1,
+ kgccNoRouteToDest = 3,
+ kgccChannelUnacceptable = 6,
+ kgccOperatorDeterminedBarring = 8,
+ kgccNormalCallClear = 16,
+ kgccUserBusy = 17,
+ kgccNoUserResponding = 18,
+ kgccNoAnswerFromUser = 19,
+ kgccCallRejected = 21,
+ kgccNumberChanged = 22,
+ kgccNonSelectedUserClear = 26,
+ kgccDestinationOutOfOrder = 27,
+ kgccInvalidNumberFormat = 28,
+ kgccFacilityRejected = 29,
+ kgccRespStatusEnquiry = 30,
+ kgccNormalUnspecified = 31,
+ kgccNoCircuitChannelAvail = 34,
+ kgccNetworkOutOfOrder = 38,
+ kgccTemporaryFailure = 41,
+ kgccSwitchCongestion = 42,
+ kgccAccessInfoDiscarded = 43,
+ kgccRequestedChannelUnav = 44,
+ kgccResourceUnavailable = 47,
+ kgccQosUnavailable = 49,
+ kgccReqFacilityNotSubsc = 50,
+ kgccCallBarredWitchCUG = 55,
+ kgccBearerCapabNotAuthor = 57,
+ kgccBearerCapabNotAvail = 58,
+ kgccServiceNotAvailable = 63,
+ kgccBcNotImplemented = 65,
+ kgccReqFacilityNotImplem = 69,
+ kgccOnlyRestrictedBcAvail = 70,
+ kgccServiceNotImplemented = 79,
+ kgccInvalidCrv = 81,
+ kgccUserNotMemberOfCUG = 82,
+ kgccIncompatibleDestination = 88,
+ kgccInvalidTransitNetSel = 91,
+ kgccInvalidMessage = 95,
+ kgccMissingMandatoryIe = 96,
+ kgccMsgTypeNotImplemented = 97,
+ kgccMsgIncompatWithState = 98,
+ kgccIeNotImplemented = 99,
+ kgccInvalidIe = 100,
+ kgccMsgIncompatWithState2 = 101,
+ kgccRecoveryOnTimerExpiry = 102,
+ kgccProtocolError = 111,
+ kgccInterworking = 127,
+};
+
+/*
+ * KGsmMobileCause: Causes of Mobile Equipment Fail
+ */
+enum KGsmMobileCause
+{
+ kgmcPhoneFailure = 0,
+ kgmcNoConnectionToPhone = 1,
+ kgmcPhoneAdaptorLinkReserved = 2,
+ kgmcOperationNotAllowed = 3,
+ kgmcOperationNotSupported = 4,
+ kgmcPH_SIMPINRequired = 5,
+ kgmcPH_FSIMPINRequired = 6,
+ kgmcPH_FSIMPUKRequired = 7,
+ kgmcSIMNotInserted = 10,
+ kgmcSIMPINRequired = 11,
+ kgmcSIMPUKRequired = 12,
+ kgmcSIMFailure = 13,
+ kgmcSIMBusy = 14,
+ kgmcSIMWrong = 15,
+ kgmcIncorrectPassword = 16,
+ kgmcSIMPIN2Required = 17,
+ kgmcSIMPUK2Required = 18,
+ kgmcMemoryFull = 20,
+ kgmcInvalidIndex = 21,
+ kgmcNotFound = 22,
+ kgmcMemoryFailure = 23,
+ kgmcTextStringTooLong = 24,
+ kgmcInvalidCharInTextString = 25,
+ kgmcDialStringTooLong = 26,
+ kgmcInvalidCharInDialString = 27,
+ kgmcNoNetworkService = 30,
+ kgmcNetworkTimeout = 31,
+ kgmcNetworkNotAllowed = 32,
+ kgmcCommandAborted = 33,
+ kgmcNumParamInsteadTextParam = 34,
+ kgmcTextParamInsteadNumParam = 35,
+ kgmcNumericParamOutOfBounds = 36,
+ kgmcTextStringTooShort = 37,
+ kgmcNetworkPINRequired = 40,
+ kgmcNetworkPUKRequired = 41,
+ kgmcNetworkSubsetPINRequired = 42,
+ kgmcNetworkSubnetPUKRequired = 43,
+ kgmcServiceProviderPINRequired = 44,
+ kgmcServiceProviderPUKRequired = 45,
+ kgmcCorporatePINRequired = 46,
+ kgmcCorporatePUKRequired = 47,
+ kgmcSIMServiceOptNotSupported = 60,
+ kgmcUnknown = 100,
+ kgmcIllegalMS_N3 = 103,
+ kgmcIllegalME_N6 = 106,
+ kgmcGPRSServicesNotAllowed_N7 = 107,
+ kgmcPLMNNotAllowed_No11 = 111,
+ kgmcLocationAreaNotAllowed_N12 = 112,
+ kgmcRoamingNotAllowed_N13 = 113,
+ kgmcServiceOptNotSupported_N32 = 132,
+ kgmcReqServOptNotSubscribed_N33 = 133,
+ kgmcServOptTempOutOfOrder_N34 = 134,
+ kgmcLongContextActivation = 147,
+ kgmcUnspecifiedGPRSError = 148,
+ kgmcPDPAuthenticationFailure = 149,
+ kgmcInvalidMobileClass = 150,
+ kgmcGPRSDisconnectionTmrActive = 151,
+ kgmcTooManyActiveCalls = 256,
+ kgmcCallRejected = 257,
+ kgmcUnansweredCallPending = 258,
+ kgmcUnknownCallingError = 259,
+ kgmcNoPhoneNumRecognized = 260,
+ kgmcCallStateNotIdle = 261,
+ kgmcCallInProgress = 262,
+ kgmcDialStateError = 263,
+ kgmcUnlockCodeRequired = 264,
+ kgmcNetworkBusy = 265,
+ kgmcInvalidPhoneNumber = 266,
+ kgmcNumberEntryAlreadyStarted = 267,
+ kgmcCancelledByUser = 268,
+ kgmcNumEntryCouldNotBeStarted = 269,
+ kgmcDataLost = 280,
+ kgmcInvalidBessageBodyLength = 281,
+ kgmcInactiveSocket = 282,
+ kgmcSocketAlreadyOpen = 283
+};
+
+/*
+ * KGsmSmsCause: Causes of SMS Fail
+ */
+enum KGsmSmsCause
+{
+ kgscUnassigned = 1,
+ kgscOperatorDeterminedBarring = 8,
+ kgscCallBarred = 10,
+ kgscSMSTransferRejected = 21,
+ kgscDestinationOutOfService = 27,
+ kgscUnidentifiedSubscriber = 28,
+ kgscFacilityRejected = 29,
+ kgscUnknownSubscriber = 30,
+ kgscNetworkOutOfOrder = 38,
+ kgscTemporaryFailure = 41,
+ kgscCongestion = 42,
+ kgscResourcesUnavailable = 47,
+ kgscFacilityNotSubscribed = 50,
+ kgscFacilityNotImplemented = 69,
+ kgscInvalidSMSTransferRefValue = 81,
+ kgscInvalidMessage = 95,
+ kgscInvalidMandatoryInformation = 96,
+ kgscMessageTypeNonExistent = 97,
+ kgscMsgNotCompatWithSMProtState = 98,
+ kgscInformationElementNonExiste = 99,
+ kgscProtocolError = 111,
+ kgscInterworking = 127,
+ kgscTelematicInterworkingNotSup = 128,
+ kgscSMSTypeZeroNotSupported = 129,
+ kgscCannotReplaceSMS = 130,
+ kgscUnspecifiedTPPIDError = 143,
+ kgscAlphabetNotSupported = 144,
+ kgscMessageClassNotSupported = 145,
+ kgscUnspecifiedTPDCSError = 159,
+ kgscCommandCannotBeActioned = 160,
+ kgscCommandUnsupported = 161,
+ kgscUnspecifiedTPCommandError = 175,
+ kgscTPDUNotSupported = 176,
+ kgscSCBusy = 192,
+ kgscNoSCSubscription = 193,
+ kgscSCSystemFailure = 194,
+ kgscInvalidSMEAddress = 195,
+ kgscDestinationSMEBarred = 196,
+ kgscSMRejectedDuplicateSM = 197,
+ kgscTPVPFNotSupported = 198,
+ kgscTPVPNotSupported = 199,
+ kgscSIMSMSStorageFull = 208,
+ kgscNoSMSStorageCapabilityInSIM = 209,
+ kgscErrorInMS = 210,
+ kgscMemoryCapacityExceeded = 211,
+ kgscSIMDataDownloadError = 213,
+ kgscUnspecifiedError = 255,
+ kgscPhoneFailure = 300,
+ kgscSmsServiceReserved = 301,
+ kgscOperationNotAllowed = 302,
+ kgscOperationNotSupported = 303,
+ kgscInvalidPDUModeParameter = 304,
+ kgscInvalidTextModeParameter = 305,
+ kgscSIMNotInserted = 310,
+ kgscSIMPINNecessary = 311,
+ kgscPH_SIMPINNecessary = 312,
+ kgscSIMFailure = 313,
+ kgscSIMBusy = 314,
+ kgscSIMWrong = 315,
+ kgscMemoryFailure = 320,
+ kgscInvalidMemoryIndex = 321,
+ kgscMemoryFull = 322,
+ kgscSMSCAddressUnknown = 330,
+ kgscNoNetworkService = 331,
+ kgscNetworkTimeout = 332,
+ kgscUnknownError = 500,
+ kgscNetworkBusy = 512,
+ kgscInvalidDestinationAddress = 513,
+ kgscInvalidMessageBodyLength = 514,
+ kgscPhoneIsNotInService = 515,
+ kgscInvalidPreferredMemStorage = 516,
+ kgscUserTerminated = 517
+};
+
+#endif
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KH100Defs.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KH100Defs.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,186 @@
+#if !defined KH100DEFS_H
+#define KH100DEFS_H
+
+/******************************************************************************
+Comandos do H100
+H100 commands
+******************************************************************************/
+
+#define CM_SEND_TO_CTBUS 0x90
+/*
+ Liga o TX do canal especificado a um determinado Stream/Timeslot do ctbus.
+ Link the TX of the specified channel to the specified ctbus stream/timeslot
+ K3L_COMMAND.Object = ChannelNumber
+ Params:
+ [0] - Ctbus stream
+ [1] - Ctbus timeslot
+ [2] - Start/Stop
+*/
+
+#define CM_RECV_FROM_CTBUS 0x91
+/* Liga o RX do canal especificado a um determinado Stream/Timeslot do ctbus.
+ Link the RX of the specified channel to the specified ctbus stream/timeslot
+ K3L_COMMAND.Object = ChannelNumber
+ Params:
+ [0] - Ctbus stream
+ [1] - Ctbus timeslot
+ [2] - Start/Stop
+*/
+
+#define CM_SEND_RANGE_TO_CTBUS 0x92
+/*
+ Liga o TX dos canais especificados aos determinados Stream/Timeslots do ctbus.
+ Link the TX of the specified channels to the specified ctbus stream/timeslots
+
+ K3L_COMMAND.Object = First channel to be used in the block
+
+ Params:
+ A null terminated ascii string with the command parameters.
+ The expected call parameters are:
+ Parameter: Required: Description:
+ range_count yes Number of channels in the block
+ stream yes Stream of the H100 BUS
+ first_timeslot yes First timeslot, it´s linked with the first channel
+ enabled no if true enable the transmission, else disable it. Default value is true.
+*/
+
+
+#define CM_SETUP_H100 0x93
+/* Este comando está obsoleto e não é mais processado pela API, a configuração
+ deve ser feita utilizando o aplicativo KConfig.
+
+ This command is deprecated and is no longer supported, this configuration
+ should be done using KConfig.
+
+ ------
+ Configura a iteração entre a placa e o ctbus
+ Sets up the iteration between the board and the ctbus
+
+ K3L_COMMAND.Object = Command*
+ Params:
+ [0] - Params*
+
+ * See documentation
+ Command definitions will be finded in KH100Defs.h
+*/
+
+
+enum KH100ConfigIndex
+{
+ khciDeviceMode = 0,
+ khciMasterGenClock = 1,
+ khciCTNetRefEnable = 4,
+ khciSCbusEnable = 6,
+ khciHMVipEnable = 7,
+ khciMVip90Enable = 8,
+ khciCTbusDataEnable = 9,
+ khciCTbusFreq03_00 = 10,
+ khciCTbusFreq07_04 = 11,
+ khciCTbusFreq11_08 = 12,
+ khciCTbusFreq15_12 = 13,
+ khciMax = 14,
+ khciMasterDevId = 20,
+ khciSecMasterDevId = 21,
+ khciCtNetrefDevId = 22,
+ khciMaxH100ConfigIndex
+};
+
+// enumerados usados juntamente a estrutura K3L_H100_STATUS
+enum KMasterPLLClockReference
+{
+ h100_Ref_FreeRun = 0,
+ h100_Ref_holdover = 1,
+ h100_Automatic = 2,
+ h100_Ref_ctnetref = 7,
+ h100_Ref_link0 = 8,
+ h100_Ref_link1 = 9
+};
+
+enum KSlavePLLClockReference
+{
+ h100_PllLoc_ClkA = 0,
+ h100_PllLoc_ClkB = 1,
+ h100_PllLoc_SCBus = 2,
+ h100_PllLoc_MVIP90 = 3,
+ h100_PllLoc_Link0 = 4,
+ h100_PllLoc_Link1 = 5,
+ h100_PllLoc_Error = 6
+};
+
+
+/******************************************************************************
+CM_SETUP_H100
+Configura o H100. Este comando é na verdade um grupo de comandos de configuração.
+*******************************************************************************/
+#define H100_DEVICE_MODE khciDeviceMode
+// Define o modo de operação da placa.
+ enum KH100Mode
+ {
+ h100_Slave,
+ h100_Master,
+ h100_StandbyMaster,
+ h100_Diagnostic,
+ h100_NotConnected
+ };
+
+#define H100_MASTER_GEN_CLOCK khciMasterGenClock
+// Define qual o clock a ser gerado (A ou B) no CTbus caso a placa seja ou venha a ser a master
+ enum KH100SelectCtbusClock
+ {
+ h100_scClockA,
+ h100_scClockB
+ };
+
+// trier - changes... :)
+#define H100_CT_NETREF_ENABLE khciCTNetRefEnable
+// Habilita ou desabilita e programa a freq. de geração do CT_NETREF.
+ enum KH100CtNetref
+ {
+ h100_nrOff,
+ h100_nrEnable
+ };
+
+#define H100_SCBUS_ENABLE khciSCbusEnable
+// Habilita ou desabilita e configura o clock da geração da referência do scbus.
+ enum KH100ScbusEnable
+ {
+ h100_seOff,
+ h100_seOn2Mhz,
+ h100_seOn4Mhz,
+ h100_seOn8Mhz
+ };
+
+#define H100_HMVIP_ENABLE khciHMVipEnable
+// Habilita ou desabilita a geração da referência do HMVIP.
+// 1 - On, 0 - Off KH100Enable
+
+#define H100_MVIP90_ENABLE khciMVip90Enable
+// Habilita ou desabilita a geração da referência do MVIP90.
+// 1 - On, 0 - Off KH100Enable
+
+#define H100_CTBUS_DATA_ENABLE khciCTbusDataEnable
+// Habilita ou desabilita a transmissao de dados no CTbus.
+// 1 - On, 0 - Off KH100Enable
+
+enum KH100Enable
+{
+ h100_On = 0x01,
+ h100_Off = 0x00
+};
+
+#define H100_CTBUS_FREQ_03_00 khciCTbusFreq03_00
+#define H100_CTBUS_FREQ_07_04 khciCTbusFreq07_04
+#define H100_CTBUS_FREQ_11_08 khciCTbusFreq11_08
+#define H100_CTBUS_FREQ_15_12 khciCTbusFreq15_12
+// Configura a frequência de geração dos clocks do ctbus em blocos de 4 streams conforme a
+// especificação do H100. Bloco 0, streams de 0 a 3, bloco 1, de 4 a 7, etc..
+// As stream de 16 a 31 estarão sempre em 8Mhz conforme especificação.
+enum KH100CtbusFreq
+{
+ h100_cf_2Mhz = 0,
+ h100_cf_4Mhz = 1,
+ h100_cf_8Mhz = 2
+};
+
+
+#endif
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KISDN.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KISDN.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,211 @@
+#ifndef _KISDN_H_
+#define _KISDN_H_
+
+#define KMAX_USER_USER_LEN 32
+#define KMAX_SUBADRESS_INFORMATION_LEN 20
+
+/**
+ KQ931Cause: Causes for disconnection and/or fails.
+ */
+enum KQ931Cause
+{
+ kq931cNone = 0,
+ kq931cUnallocatedNumber = 1,
+ kq931cNoRouteToTransitNet = 2,
+ kq931cNoRouteToDest = 3,
+ kq931cSendSpecialInfoTone = 4,
+ kq931cMisdialedTrunkPrefix = 5,
+ kq931cChannelUnacceptable = 6,
+ kq931cCallAwarded = 7,
+ kq931cPreemption = 8,
+ kq931cPreemptionCircuitReuse = 9,
+ kq931cQoR_PortedNumber = 14,
+ kq931cNormalCallClear = 16,
+ kq931cUserBusy = 17,
+ kq931cNoUserResponding = 18,
+ kq931cNoAnswerFromUser = 19,
+ kq931cSubscriberAbsent = 20,
+ kq931cCallRejected = 21,
+ kq931cNumberChanged = 22,
+ kq931cRedirectionToNewDest = 23,
+ kq931cCallRejectedFeatureDest = 24,
+ kq931cExchangeRoutingError = 25,
+ kq931cNonSelectedUserClear = 26,
+ kq931cDestinationOutOfOrder = 27,
+ kq931cInvalidNumberFormat = 28,
+ kq931cFacilityRejected = 29,
+ kq931cRespStatusEnquiry = 30,
+ kq931cNormalUnspecified = 31,
+ kq931cNoCircuitChannelAvail = 34,
+ kq931cNetworkOutOfOrder = 38,
+ kq931cPermanentFrameConnOutOfService = 39,
+ kq931cPermanentFrameConnOperational = 40,
+ kq931cTemporaryFailure = 41,
+ kq931cSwitchCongestion = 42,
+ kq931cAccessInfoDiscarded = 43,
+ kq931cRequestedChannelUnav = 44,
+ kq931cPrecedenceCallBlocked = 46,
+ kq931cResourceUnavailable = 47,
+ kq931cQosUnavailable = 49,
+ kq931cReqFacilityNotSubsc = 50,
+ kq931cOutCallsBarredWithinCUG = 53,
+ kq931cInCallsBarredWithinCUG = 55,
+ kq931cBearerCapabNotAuthor = 57,
+ kq931cBearerCapabNotAvail = 58,
+ kq931cInconsistency = 62,
+ kq931cServiceNotAvailable = 63,
+ kq931cBcNotImplemented = 65,
+ kq931cChannelTypeNotImplem = 66,
+ kq931cReqFacilityNotImplem = 69,
+ kq931cOnlyRestrictedBcAvail = 70,
+ kq931cServiceNotImplemented = 79,
+ kq931cInvalidCrv = 81,
+ kq931cChannelDoesNotExist = 82,
+ kq931cCallIdDoesNotExist = 83,
+ kq931cCallIdInUse = 84,
+ kq931cNoCallSuspended = 85,
+ kq931cCallIdCleared = 86,
+ kq931cUserNotMemberofCUG = 87,
+ kq931cIncompatibleDestination = 88,
+ kq931cInvalidTransitNetSel = 91,
+ kq931cInvalidMessage = 95,
+ kq931cMissingMandatoryIe = 96,
+ kq931cMsgTypeNotImplemented = 97,
+ kq931cMsgIncompatWithState = 98,
+ kq931cIeNotImplemented = 99,
+ kq931cInvalidIe = 100,
+ kq931cMsgIncompatWithState2 = 101,
+ kq931cRecoveryOnTimerExpiry = 102,
+ kq931cProtocolError = 103,
+ kq931cMessageWithUnrecognizedParam = 110,
+ kq931cProtocolErrorUnspecified = 111,
+ kq931cInterworking = 127,
+ kq931cCallConnected = 128,
+ kq931cCallTimedOut = 129,
+ kq931cCallNotFound = 130,
+ kq931cCantReleaseCall = 131,
+ kq931cNetworkFailure = 132,
+ kq931cNetworkRestart = 133,
+ kq931cLastValidCause = kq931cNetworkRestart,
+
+};
+
+/**
+ KQ931ProgressIndication: Used internally to indicate and to be informed of the
+ presence of call control tones in band.
+ */
+enum KQ931ProgressIndication
+{
+ kq931pTonesMaybeAvailable = 1,
+ kq931pDestinationIsNonIsdn = 2,
+ kq931pOriginationIsNonIsdn = 3,
+ kq931pCallReturnedToIsdn = 4,
+ kq931pTonesAvailable = 8,
+};
+
+/**
+ KQ931Hlc: High Layer compatibility: Used internally to indicate the call content
+ ('kq931hTelefony' is always sent).
+ */
+enum KQ931Hlc
+{
+ kq931hTelefony = 0x81,
+ k1931hFaxGroup23 = 0x84,
+ k1931hFaxGroup4 = 0xa1,
+ kq931hTeletexF184 = 0xa4,
+ kq931hTeletexF220 = 0xa8,
+ kq931hTeletexf200 = 0xb1,
+ kq931hVideotex = 0xb2,
+ kq931hTelexF60 = 0xb5,
+ kq931hMhs = 0xb8,
+ kq931hOsiApp = 0xc1,
+ kq931hMaintenance = 0xde,
+ kq931hManagement = 0xdf,
+};
+
+
+/**
+ KQ931BearerCapability: Used internally to indicate the call bearer's capability
+ (can be changed in KConfig).
+ */
+enum KQ931BearerCapability
+{
+ kq931bSpeech = 0x00,
+ kq931bUnrestrictedDigital = 0x08,
+ kq931bAudio31kHz = 0x10,
+ kq931bAudio7kHz = 0x11,
+ kq931bVideo = 0x18,
+};
+
+
+/**
+ KQ931TypeOfNumber: Indicates the caller/called party type of number. Defaults to
+ 'kq931tUnknownNumber', but can be changed by a parameter in CM_MAKE_CALL.
+*/
+enum KQ931TypeOfNumber
+{
+ kq931tUnknownNumber = 0x00,
+ kq931tInternationalNumber = 0x10,
+ kq931tNationalNumber = 0x20,
+ kq931tNetworkSpecificNumber = 0x30,
+ kq931tSubscriberNumber = 0x40,
+ kq931tAbbreviatedNumber = 0x60,
+ kq931tReservedNumber = 0x70,
+ kq931tDefaultNumber = kq931tUnknownNumber,
+};
+
+/**
+ KQ931NumberingPlan: Indicates the caller/called party numbering plan. Defaults to
+ 'kq931pUnknownPlan', but can be changed by a parameter in CM_MAKE_CALL.
+ */
+enum KQ931NumberingPlan
+{
+ kq931pUnknownPlan = 0x00,
+ kq931pIsdnPlan = 0x01,
+ kq931pDataPlan = 0x03,
+ kq931pTelexPlan = 0x04,
+ kq931pNationalPlan = 0x08,
+ kq931pPrivatePlan = 0x09,
+ kq931pReservedPlan = 0x0F,
+ kq931pDefaultPlan = kq931pUnknownPlan,
+};
+
+/**
+ KQ931UserInfoProtocolDescriptor: Used in 'struct KUserInformation' (declared in k3l.h) to indicate
+ the protocol that is being used with the CM_USER_INFORMATION command.
+ */
+enum KQ931UserInfoProtocolDescriptor
+{
+ kq931uuUserSpecific = 0x00,
+ kq931uuOSI_HighLayer = 0x01,
+ kq931uuX244 = 0x02,
+ kq931uuIA5_Chars = 0x04,
+ kq931uuX208_X209 = 0x05,
+ kq931uuV120 = 0x07,
+ kq931uuQ931_CallControl = 0x08,
+ kq931uuNational = 0x40 //MASK
+};
+
+enum KQ931PresentationIndicator
+{
+ kq931piPresentationAllowed = 0x00,
+ kq931piPresentationRestricted = 0x01,
+ kq931piNumberNotAvailableDueToInterworking = 0x02,
+};
+
+enum KQ931ScreeningIndicator
+{
+ kq931siUserProvidedNotScreened = 0x00,
+ kq931siUserProvidedVerifiedAndPassed = 0x01,
+ kq931siUserProvidedVerifiedAndFailed = 0x02,
+ kq931siNetworkProvided = 0x03,
+};
+
+enum KQ931TypeOfSubaddress
+{
+ kq931tsNSAP = 0x00,
+ kq931tsUserSpecified = 0x01,
+};
+
+#endif //_KISDN_H_
+
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KMixerDefs.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KMixerDefs.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,324 @@
+/******************************************************************************
+Comandos de controle do mixer
+Mixer control commands
+******************************************************************************/
+
+#define CM_MIXER 0x60
+/* Envia um comando para o mixer associado ao canal.
+ Sends a command to a channel associated mixer.
+
+ K3L_COMMAND.Object = MixerNumber
+
+ Params:
+ A pointer to a KMixerCommand strutcture which has the following members
+
+ Track - Track index
+ Source - Audio source (KMixerSource, k3l.h)
+ SourceIndex - Channel number or generator code
+
+*/
+
+#define CM_CLEAR_MIXER 0x61
+/* Coloca todas as trilhas do mixer em silêncio.
+ Sets all mixer tracks to silent.
+
+ K3L_COMMAND.Object = MixerNumber
+*/
+
+#define CM_PLAY_FROM_FILE 0x62
+/* Reproduz um arquivo de audio
+ Play an audio file
+
+ K3L_COMMAND.Object = PlayerNumber
+
+ Events: EV_END_OF_STREAM
+
+ Params:
+ FileName (null terminated)
+*/
+
+#define CM_RECORD_TO_FILE 0x63
+/* Inicia gravaçao de audio em arquivo
+ Starts audio recording in file
+
+ K3L_COMMAND.Object = PlayerNumber
+
+ Params:
+ FileName (null terminated)
+*/
+
+#define CM_PLAY_FROM_STREAM 0x64
+/* Reproduz um buffer de audio
+ Play an audio buffer
+
+ K3L_COMMAND.Object = PlayerNumber
+
+ Events: EV_END_OF_STREAM
+
+ Params:
+ struct KPlayFromStreamCommand
+ Buffer - Pointer to the buffer
+ BufferSize - Buffer size
+*/
+
+#define CM_INTERNAL_PLAY 0x65
+/* Used internally
+*/
+
+#define CM_STOP_PLAY 0x66
+/* Para o reprodutor.
+ Stops player.
+
+ K3L_COMMAND.Object = PlayerNumber
+*/
+
+#define CM_STOP_RECORD 0x67
+/* Para a gravção do canal.
+ Stops channel recording.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_PAUSE_PLAY 0x68
+/* Pausa a reproducao de audio de um player
+ Pauses a player
+
+ K3L_COMMAND.Object = PlayerNumber
+*/
+
+#define CM_PAUSE_RECORD 0x69
+/* Pausa a gravacao de audio de um canal
+ Pauses recording of a channel
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_RESUME_PLAY 0x6A
+/* Continua um play anteriormente pausado
+ Resumes a paused play
+
+ K3L_COMMAND.Object = PlayerNumber
+*/
+
+#define CM_RESUME_RECORD 0x6B
+/* Continua um play anteriormente pausado
+ Resumes a paused play
+
+ K3L_COMMAND.Object = PlayerNumber
+*/
+
+#define CM_INCREASE_VOLUME 0x6C
+/* Aumenta o volume na saida do mixer
+ Increases volume on mixer out
+
+ K3L_COMMAND.Object = MixerNumber
+*/
+
+#define CM_DECREASE_VOLUME 0x6D
+/* Diminui o volume na saida do mixer
+ Decreases volume on mixer out
+
+ K3L_COMMAND.Object = MixerNumber
+*/
+
+#define CM_LISTEN 0x6E
+/* Inicia o processo de transmissao de audio para reconhecimento de voz.
+ Starts audio transmission process for voice recognition.
+
+ K3L_COMMAND.Object = MixerNumber
+
+ Params:
+ [0..3] - Inteiro contendo a quantidade de milisegundos de audio em chamada da callback
+*/
+
+#define CM_STOP_LISTEN 0x6F
+/* Para o processo de transmissao de audio e para a gravacao do buffer de guarda.
+ Stops audio tranmission process, and stops the buffer guard recoring..
+
+ K3L_COMMAND.Object = MixerNumber
+*/
+
+#define CM_PREPARE_FOR_LISTEN 0x70
+/* Inicia a gravacao do buffer de guarda.
+ Start guard buffer recording.
+
+ K3L_COMMAND.Object = MixerNumber
+
+ Params:
+ [0..3] - Inteiro contendo o tamanho do buffer de guarda em milisegundos
+*/
+
+#define CM_PLAY_SOUND_CARD 0x71
+/* Inicia o play de canal na placa de som
+ Starts the sound card channel player
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_STOP_SOUND_CARD 0x72
+/* Para o play de canal na placa de som
+ Stops the sound card channel player
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_MIXER_CTBUS 0x73
+/* Envia um comando para o mixer associado ao de interconexao. Soh para placas com CTbus
+ Sends a command to a inteconnect channel associated mixer. Only for boards with CTbus
+
+ K3L_COMMAND.Object = CtbusMixerNumber
+
+ Params:
+ [0] - Mixer index
+ [1] - Audio source
+ [2] - Channel number or generator code
+
+ kmsChannel - Channel
+ kmsPlay - Play
+ kmsGenerator - Signal
+ kmsCTbus - another mixer channel
+*/
+
+
+#define CM_PLAY_FROM_STREAM_EX 0x74
+/* Reproduz um buffer de audio
+ Play an audio buffer
+
+ K3L_COMMAND.Object = PlayerNumber
+
+ Events: EV_END_OF_STREAM
+
+ Params:
+ struct KPlayFromStreamCommand
+ Buffer - Pointer to the buffer
+ BufferSize - Buffer size
+ CodecIndex - 0 = 8Khz ALAW, 1 = 8Khz PCM, 2 = 11khz PCM
+*/
+
+#define CM_INTERNAL_PLAY_EX 0x75
+/* Used internally
+*/
+
+#define CM_ENABLE_PLAYER_AGC 0x76
+/*
+ Habilita o controle de ganho automático do player.
+ Enable player automatic gain contol.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+#define CM_DISABLE_PLAYER_AGC 0x77
+/*
+ Desabilita o controle de ganho automático do player.
+ Disable player automatic gain contol.
+
+ K3L_COMMAND.Object = ChannelNumber
+*/
+
+
+#define CM_START_STREAM_BUFFER 0x78
+/* Inicia um play de buffer contíuo
+ Start continuous play buffer
+
+ K3L_COMMAND.Object = PlayerNumber
+*/
+
+#define CM_ADD_STREAM_BUFFER 0x79
+/* Adiciona dados a um stream de buffer contínuo
+ Add data to a continuous play buffer
+
+ K3L_COMMAND.Object = PlayerNumber
+
+ Params:
+ [0..3] - Pointer to the buffer
+ [4..7] - Buffer size
+*/
+
+#define CM_STOP_STREAM_BUFFER 0x7A
+/* Para um play de buffer contínuo
+ Stop a continuous play buffer
+
+ K3L_COMMAND.Object = PlayerNumber
+*/
+
+#define CM_SEND_BEEP 0x7B
+/* Envia um bip no canal
+ Sends a beep
+
+ K3L_COMMAND.Object = PlayerNumber
+*/
+
+#define CM_SEND_BEEP_CONF 0x7C
+/* Envia um bip na conferencia
+ Sends a beep
+
+ K3L_COMMAND.Object = PlayerNumber
+*/
+
+#define CM_ADD_TO_CONF 0x7D
+/* Adiciona um canal a uma conferencia
+ Adds a channel to a specified conference
+
+ K3L_COMMAND.Object = MixerNumber
+ Params:
+ [0] - Conference index
+*/
+
+#define CM_REMOVE_FROM_CONF 0x7E
+/* Retira um canal de uma conferencia
+ Adds a channel to a specified conference
+
+ K3L_COMMAND.Object = MixerNumber
+*/
+
+#define CM_RECORD_TO_FILE_EX 0x7F
+/* Inicia gravaçao de audio em arquivo, utilizando codec específico
+ Starts audio recording in file, using specific codec
+
+ K3L_COMMAND.Object = PlayerNumber
+
+ Params:
+ A null terminated ascii string with the parameters.
+ The expected command parameters are:
+ Parâmeter: Description:
+ file_name File name for use in recording
+ codec Codec index(defined in KCodecIndex enum) for audio compression
+ if ommited ALaw 8khz will be used
+*/
+
+#define CM_SET_VOLUME 0xA0
+/* Configura o volume de saída do mixer para um valor na vaixa de -10 a +10. Zero reseta o volume.
+ Sets output volume from mixer channel to a values between -10 and +10. Zero resets the volume.
+
+ K3L_COMMAND.Object = MixerNumber
+
+ Params:
+ A null terminated ascii string with the parameters.
+ The expected command parameters are:
+ Parâmeter: Description:
+ volume File name for use in recording
+ type Defines if is the "input" or "output" volume to be changed
+*/
+
+#define CM_START_CADENCE 0xA1
+/* Inicia a reprodução da cadência especificada com tom de 425Hz.
+ Starts to play the specified 425Hz tone cadence.
+
+ K3L_COMMAND.Object = MixerNumber
+
+ Params:
+ A null terminated ascii string with the parameters.
+ The expected command parameters are:
+ Parâmeter: Description:
+ cadence_times A comma separated list of times (in milliseconds) for dialtone
+ and silence (in pairs), or "continuous" for continuous dialtone.
+ mixer_track The mixer track that sould be used to play the cadence. "0" (zero)
+ is the default mixer track.
+*/
+
+#define CM_STOP_CADENCE 0xA2
+/* Pára a cadência iniciada com o comando CM_START_CADENCE.
+ Stops the cadence started with CM_START_CADENCE.
+
+ K3L_COMMAND.Object = MixerNumber
+*/
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KR2D.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KR2D.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,384 @@
+#if !defined KR2D_H
+#define KR2D_H
+
+/******************************************************************************
+Comandos de controle de ligação especiais
+Special call control commands
+******************************************************************************/
+#define CM_SET_LINE_CONDITION 0x80
+/* Programa a condição do ramal. Programar para kgbNone para enviar manualmente.
+ Program called subscriber condition. Sets to kgbNone to sends it manually.
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Params:
+ [0] - Subscriber Line Condition (Group B)
+*/
+
+#define CM_SEND_LINE_CONDITION 0x81
+/* Envia a condicao do ramal.
+ Sends subscriber line condition.
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Params:
+ [0] - Subscriber Line Condition (Group B)
+*/
+
+
+#define CM_SET_CALLER_CATEGORY 0x82
+/* Configura a categoria do assinante chamador enviada na ocupação do canal.
+ Sets caller subscriber category.
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Params:
+ [0] - Subscriber category, group II
+*/
+
+#define CM_DIAL_MFC 0x83
+/* Disca uma string terminada em 0 em MFC. Máximo 20 dígitos.
+ Dial a null terminated string, in MFC. Maximum 20 digits.
+
+ K3L_COMMAND.Object = ChannelNumber
+
+ Events: (syncronous command)
+ Params:
+ String with the number to dial (ascii)
+*/
+
+/*
+ A condicao do ramal em uma ligacao sainte vem nos eventos
+EV_CALL_SUCCESS ou EV_CALL_FAIL, no campo AddInfo.
+
+ A categoria do assinante chamador numa ligacao entrante vem no evento
+EV_SEIZURE, no campo AddInfo.
+
+*/
+
+/******************************************************************************
+Definições para sinalização (Brasil)
+Signaling definitions (Brazil)
+******************************************************************************/
+/*
+ * Category of A (MFC signaling, group II)
+ */
+enum KSignGroupII_Brazil
+{
+ kg2BrOrdinary = 0x01, // Subscriber without priority.
+ kg2BrPriority = 0x02, // Subscriber with priority.
+ kg2BrMaintenance = 0x03, // Maintenance equipment.
+ kg2BrLocalPayPhone = 0x04, // Local pay phone.
+ kg2BrTrunkOperator = 0x05, // Trunk operator.
+ kg2BrDataTrans = 0x06, // Data transmission.
+ kg2BrNonLocalPayPhone = 0x07, // Non-local pay phone.
+ kg2BrCollectCall = 0x08, // Collect call.
+ kg2BrOrdinaryInter = 0x09, // International ordinary subscriber.
+ kg2BrTransfered = 0x0B, // Transfered call.
+};
+
+/*
+ * Condition of B (MFC signaling, group B)
+ */
+enum KSignGroupB_Brazil
+{
+ kgbBrLineFreeCharged = 0x01, // Line free and charged.
+ kgbBrBusy = 0x02, // Line busy.
+ kgbBrNumberChanged = 0x03, // B number was changed.
+ kgbBrCongestion = 0x04, // Congestion.
+ kgbBrLineFreeNotCharged = 0x05, // Line free and not charged.
+ kgbBrLineFreeChargedLPR = 0x06, // Line free, charged, last party released.
+ kgbBrInvalidNumber = 0x07, // Unallocated number.
+ kgbBrLineOutOfOrder = 0x08, // Called line is out of order.
+ kgbBrNone = 0xFF // Used when a manual send of the condition is required.
+};
+
+
+/******************************************************************************
+Definições para sinalização (Argentina)
+Signaling definitions (Argentina)
+******************************************************************************/
+/*
+ * Category of A (MFC signaling, group II)
+ */
+enum KSignGroupII_Argentina
+{
+ kg2ArOrdinary = 0x01, // Subscriber without priority.
+ kg2ArPriority = 0x02, // Subscriber with priority.
+ kg2ArMaintenance = 0x03, // Maintenance equipment.
+ kg2ArLocalPayPhone = 0x04, // Local pay phone.
+ kg2ArTrunkOperator = 0x05, // Trunk operator.
+ kg2ArDataTrans = 0x06, // Data transmission.
+ kg2ArCPTP = 0x0B, // C.P.T.P
+ kg2ArSpecialLine = 0x0C, // Special Subcriber Line
+ kg2ArMobileUser = 0x0D, // Mobile User
+ kg2ArPrivateRedLine = 0x0E, // Virtual Private Red Line
+ kg2ArSpecialPayPhoneLine = 0x0F, // Special Pay Phone Line
+};
+
+/*
+ * Condition of B (MFC signaling, group B)
+ */
+enum KSignGroupB_Argentina
+{
+ kgbArNumberChanged = 0x02, // B number was changed.
+ kgbArBusy = 0x03, // Line busy.
+ kgbArCongestion = 0x04, // Congestion.
+ kgbArInvalidNumber = 0x05, // Unallocated number.
+ kgbArLineFreeCharged = 0x06, // Line free and charged.
+ kgbArLineFreeNotCharged = 0x07, // Line free and not charged.
+ kgbArLineOutOfOrder = 0x08, // Called line is out of order.
+ kgbArNone = 0xFF // Used when a manual send of the condition is required.
+};
+
+
+/******************************************************************************
+Definições para sinalização (Chile)
+Signaling definitions (Chile)
+******************************************************************************/
+/*
+ * Category of A (MFC signaling, group II)
+ */
+enum KSignGroupII_Chile
+{
+ kg2ClOrdinary = 0x01, // Subscriber without priority.
+ kg2ClPriority = 0x02, // Subscriber with priority.
+ kg2ClMaintenance = 0x03, // Maintenance equipment.
+ kg2ClTrunkOperator = 0x05, // Trunk operator.
+ kg2ClDataTrans = 0x06, // Data transmission.
+ kg2ClUnidentifiedSubscriber = 0x0B, // Unidentified subscriber.
+};
+
+/*
+ * Condition of B (MFC signaling, group B)
+ */
+enum KSignGroupB_Chile
+{
+ kgbClNumberChanged = 0x02, // B number was changed.
+ kgbClBusy = 0x03, // Line busy.
+ kgbClCongestion = 0x04, // Congestion.
+ kgbClInvalidNumber = 0x05, // Unallocated number.
+ kgbClLineFreeCharged = 0x06, // Line free and charged.
+ kgbClLineFreeNotCharged = 0x07, // Line free and not charged.
+ kgbClLineOutOfOrder = 0x08, // Called line is out of order.
+ kgbClNone = 0xFF // Used when a manual send of the condition is required.
+};
+
+
+/******************************************************************************
+Definições para sinalização (Mexico)
+Signaling definitions (Mexico)
+******************************************************************************/
+/*
+ * Category of A (MFC signaling, group II)
+ */
+enum KSignGroupII_Mexico
+{
+ kg2MxTrunkOperator = 0x01, // Trunk operator.
+ kg2MxOrdinary = 0x02, // Subscriber without priority.
+ kg2MxMaintenance = 0x06, // Maintenance equipment.
+};
+
+/*
+ * Condition of B (MFC signaling, group B)
+ */
+enum KSignGroupB_Mexico
+{
+ kgbMxLineFreeCharged = 0x01, // Line free and charged.
+ kgbMxBusy = 0x02, // Line busy.
+ kgbMxLineFreeNotCharged = 0x05, // Line free and not charged.
+ kgbMxNone = 0xFF // Used when a manual send of the condition is required.
+};
+
+
+/******************************************************************************
+Definições para sinalização (Uruguai)
+Signaling definitions (Uruguay)
+******************************************************************************/
+/*
+ * Category of A (MFC signaling, group II)
+ */
+enum KSignGroupII_Uruguay
+{
+ kg2UyOrdinary = 0x01, // Subscriber without priority.
+ kg2UyPriority = 0x02, // Subscriber with priority.
+ kg2UyMaintenance = 0x03, // Maintenance equipment.
+ kg2UyLocalPayPhone = 0x04, // Local pay phone.
+ kg2UyTrunkOperator = 0x05, // Trunk operator.
+ kg2UyDataTrans = 0x06, // Data transmission.
+ kg2UyInternSubscriber = 0x07, // Internacional subscriber.
+};
+
+/*
+ * Condition of B (MFC signaling, group B)
+ */
+enum KSignGroupB_Uruguay
+{
+ kgbUyNumberChanged = 0x02, // B number was changed.
+ kgbUyBusy = 0x03, // Line busy.
+ kgbUyCongestion = 0x04, // Congestion.
+ kgbUyInvalidNumber = 0x05, // Unallocated number.
+ kgbUyLineFreeCharged = 0x06, // Line free and charged.
+ kgbUyLineFreeNotCharged = 0x07, // Line free and not charged.
+ kgbUyLineOutOfOrder = 0x08, // Called line is out of order.
+ kgbUyNone = 0xFF // Used when a manual send of the condition is required.
+};
+
+
+
+/******************************************************************************
+Definições para sinalização (Venezuela)
+Signaling definitions (Venezuela)
+******************************************************************************/
+/*
+ * Category of A (MFC signaling, group II)
+ */
+enum KSignGroupII_Venezuela
+{
+ kg2VeOrdinary = 0x01, // Subscriber without priority.
+ kg2VePriority = 0x02, // Subscriber with priority.
+ kg2VeMaintenance = 0x03, // Maintenance equipment.
+ kg2VeLocalPayPhone = 0x04, // Local pay phone.
+ kg2VeTrunkOperator = 0x05, // Trunk operator.
+ kg2VeDataTrans = 0x06, // Data transmission.
+ kg2VeNoTransferFacility = 0x07, // Subscriber without transfer facility
+};
+
+/*
+ * Condition of B (MFC signaling, group B)
+ */
+enum KSignGroupB_Venezuela
+{
+ kgbVeLineFreeChargedLPR = 0x01, // Line free, charged, last party released.
+ kgbVeNumberChanged = 0x02, // B number was changed.
+ kgbVeBusy = 0x03, // Line busy.
+ kgbVeCongestion = 0x04, // Congestion.
+ kgbVeInformationTone = 0x05, // Special Information Tone.
+ kgbVeLineFreeCharged = 0x06, // Line free and charged.
+ kgbVeLineFreeNotCharged = 0x07, // Line free and not charged.
+ kgbVeLineBlocked = 0x08, // Blocked for input trafic.
+ kgbVeIntercepted = 0x09, // Intercepted.
+ kgbVeDataTrans = 0x0A, // Data Transmission Equipment
+ kgbVeNone = 0xFF // Used when a manual send of the condition is required.
+};
+
+
+
+
+
+
+/******************************************************************************
+OBSOLETO
+DEPRECATED
+******************************************************************************/
+
+// Grupo B
+// Group B
+enum KSignGroupB
+{
+ kgbLineFreeCharged = 0x01,
+/* Livre com tarifação.
+ Line free and charged.
+*/
+ kgbLineFreeNotCharged = 0x05,
+/* Livre sem tarifação.
+ Line free with no charge.
+*/
+ kgbLineFreeChargedLPR = 0x06,
+/* Livre com tarifaçao. Retenção sob controle de assinante chamado.
+ Line free, charged, last party released.
+*/
+ kgbBusy = 0x02,
+/* Linha assinante B ocupado.
+ Line busy.
+*/
+ kgbNumberChanged = 0x03,
+/* Número de B foi mudado.
+ B number was changed.
+*/
+ kgbCongestion = 0x04,
+/* Congestionamento.
+ Congestion.
+*/
+ kgbInvalidNumber = 0x07,
+/* Nível ou número vago.
+ Unallocated number.
+*/
+ kgbLineOutOfOrder = 0x08,
+/* Assinante B fora de serviço.
+ Called line is out of order.
+*/
+ kgbNone = 0xFF
+/* Este valor deve ser atribuido quando a for necessario enviar a condicao manualmente
+ This value is used when a manual send of the condition is required
+*/
+};
+
+#define STT_GB_LINEFREE_CHARGED 0x01
+#define STT_GB_LINEFREE_NOTCHARGED 0x05
+#define STT_GB_LINEFREE_CHARGED_LPR 0x06
+#define STT_GB_BUSY 0x02
+#define STT_GB_NUMBER_CHANGED 0x03
+#define STT_GB_CONGESTION 0x04
+#define STT_GB_UNALLOCATED_NUMBER 0x07
+#define STT_GB_LINE_OUT_OF_ORDER 0x08
+#define STT_GB_NONE 0xFF
+
+// Grupo II
+// Group II
+enum KSignGroupII
+{
+ kg2Ordinary = 0x01,
+/* Assinante comum.
+ Ordinalry subscriber.
+*/
+ kg2Priority = 0x02,
+/* Assinante com tarifação especial.
+ Subscriber with priority.
+*/
+ kg2Maintenance = 0x03,
+/* Equipamento de manutenção.
+ Maintenance equipment.
+*/
+ kg2LocalPayPhone = 0x04,
+/* Telefone público local.
+ Local pay phone.
+*/
+ kg2TrunkOperator = 0x05,
+/* Telefonista.
+ Trunk operator.
+*/
+ kg2DataTrans = 0x06,
+/* Comunicação de dados.
+ Data transmission.
+*/
+ kg2NonLocalPayPhone = 0x07,
+/* Telefone público interurbando.
+ Non-local pay phone.
+*/
+ kg2CollectCall = 0x08,
+/* Chamada a cobrar.
+ Collect call.
+*/
+ kg2OrdinaryInter = 0x09,
+/* Assinante comum, entrante internacional.
+ International ordinary subscriber.
+*/
+ kg2Transfered = 0x0B,
+/* Chamada transferida.
+ Transfered call.
+*/
+};
+
+#define STT_GII_ORDINARY 0x01
+#define STT_GII_PRIORITY 0x02
+#define STT_GII_MAINTENANCE 0x03
+#define STT_GII_LOCAL_PAY_PHONE 0x04
+#define STT_GII_TRUNK_OPERATOR 0x05
+#define STT_GII_DATA_TRANS 0x06
+#define STT_GII_NON_LOCAL_PAY_PHONE 0x07
+#define STT_GII_COLLECT_CALL 0x08
+#define STT_GII_ORDINARY_INTERNATIONAL 0x09
+#define STT_GII_TRANSFERED 0x0B
+
+#endif
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KTypeDefs.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KTypeDefs.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,79 @@
+#if !defined KLTYPEDEFS_H
+#define KLTYPEDEFS_H
+
+#if defined( _WINDOWS ) || defined( _Windows ) || defined( _WIN32 )
+ #ifndef KWIN32
+ #define KWIN32 1
+ #endif
+#endif
+
+// Khomp defined types
+#ifdef KWIN32
+ typedef __int64 int64;
+ typedef unsigned __int64 uint64;
+ #define Kstdcall __stdcall
+#else
+ typedef long long int64;
+ typedef unsigned long long uint64;
+ #define Kstdcall
+#endif
+
+typedef int int32;
+typedef unsigned int uint32;
+
+typedef uint64 intptr;
+typedef intptr stackint;
+
+typedef short int int16;
+typedef unsigned short int uint16;
+
+typedef char int8;
+typedef unsigned char uint8;
+
+typedef unsigned char byte;
+typedef char sbyte;
+
+typedef double float64;
+typedef float float32;
+
+typedef int32 stt_code;
+
+
+enum KLibraryStatus
+{
+ ksSuccess = 0,
+ ksFail = 1,
+ ksTimeOut = 2,
+ ksBusy = 3,
+ ksLocked = 4,
+ ksInvalidParams = 5,
+ ksEndOfFile = 6,
+ ksInvalidState = 7,
+ ksServerCommFail = 8,
+ ksOverflow = 9,
+ ksUnderrun = 10,
+ ksNotFound = 11,
+ ksNotAvailable = 12
+};
+
+enum KTxRx
+{
+ kNoTxRx = 0x0,
+ kTx = 0x1,
+ kRx = 0x2,
+ kBoth = 0x3
+};
+
+
+#define KMAX_SERIAL_NUMBER 12
+#define KMAX_E1_CHANNELS 30
+#define KMAX_DIAL_NUMBER 20
+#define KMAX_ADDRESS 60
+#define KMAX_DSP_NAME 8
+#define KMAX_STR_VERSION 80
+#define KMAX_BUFFER_ADDRESSES 16
+#define KMAX_LOG 1024
+#define KMAX_SIP_DATA 248
+
+#endif
+
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KVoIP.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/KVoIP.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,96 @@
+#if !defined KVOIPDEFS_H
+#define KVOIPDEFS_H
+
+enum KRejectReason
+{
+ UserBusy = 0,
+ UserNotFound,
+ NoAnswer,
+ Decline,
+ ServiceUnavailable,
+ ServerInternalError,
+ UnknownRejectReason
+};
+
+enum KSIP_Failures
+{
+ kveResponse_200_OK_Success = 200,
+
+ kveRedirection_300_MultipleChoices = 300,
+ kveRedirection_301_MovedPermanently = 301,
+ kveRedirection_302_MovedTemporarily = 302,
+ kveRedirection_305_UseProxy = 305,
+ kveRedirection_380_AlternativeService = 380,
+
+ kveFailure_400_BadRequest = 400,
+ kveFailure_401_Unauthorized = 401,
+ kveFailure_402_PaymentRequired = 402,
+ kveFailure_403_Forbidden = 403,
+ kveFailure_404_NotFound = 404,
+ kveFailure_405_MethodNotAllowed = 405,
+ kveFailure_406_NotAcceptable = 406,
+ kveFailure_407_ProxyAuthenticationRequired = 407,
+ kveFailure_408_RequestTimeout = 408,
+ kveFailure_410_Gone = 410,
+ kveFailure_413_RequestEntityTooLarge = 413,
+ kveFailure_414_RequestURI_TooLong = 414,
+ kveFailure_415_UnsupportedMediaType = 415,
+ kveFailure_416_UnsupportedURI_Scheme = 416,
+ kveFailure_420_BadExtension = 420,
+ kveFailure_421_ExtensionRequired = 421,
+ kveFailure_423_IntervalTooBrief = 423,
+ kveFailure_480_TemporarilyUnavailable = 480,
+ kveFailure_481_CallDoesNotExist = 481,
+ kveFailure_482_LoopDetected = 482,
+ kveFailure_483_TooManyHops = 483,
+ kveFailure_484_AddressIncomplete = 484,
+ kveFailure_485_Ambiguous = 485,
+ kveFailure_486_BusyHere = 486,
+ kveFailure_487_RequestTerminated = 487,
+ kveFailure_488_NotAcceptableHere = 488,
+ kveFailure_491_RequestPending = 491,
+ kveFailure_493_Undecipherable = 493,
+
+ kveServer_500_InternalError = 500,
+ kveServer_501_NotImplemented = 501,
+ kveServer_502_BadGateway = 502,
+ kveServer_503_ServiceUnavailable = 503,
+ kveServer_504_TimeOut = 504,
+ kveServer_505_VersionNotSupported = 505,
+ kveServer_513_MessageTooLarge = 513,
+
+ kveGlobalFailure_600_BusyEverywhere = 600,
+ kveGlobalFailure_603_Decline = 603,
+ kveGlobalFailure_604_DoesNotExistAnywhere = 604,
+ kveGlobalFailure_606_NotAcceptable = 606
+};
+
+enum KVoIPRegTypes
+{
+ kvrtRegister = 0,
+ kvrtUnregister = 1
+};
+
+// Below structures are deprecated
+struct KVoIPCallParams
+{
+ sbyte ToUser[ KMAX_ADDRESS + 1 ];
+ sbyte FromUser[ KMAX_ADDRESS + 1 ];
+ sbyte FromUserIP[ KMAX_ADDRESS + 1 ];
+};
+
+struct KVoIPEvRegisterParams
+{
+ KVoIPRegTypes Register;
+ sbyte User[ KMAX_ADDRESS + 1 ];
+ sbyte ProxyIP[ KMAX_ADDRESS + 1 ];
+};
+
+struct KVoIPSeize
+{
+ sbyte FromUser[ KMAX_ADDRESS + 1 ];
+ sbyte ToUser[ KMAX_ADDRESS + 1 ];
+ sbyte ProxyIP[ KMAX_ADDRESS + 1 ];
+};
+
+#endif
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/k3l.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/k3l.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,583 @@
+#if !defined K3L_H
+#define K3L_H
+
+#include "k3lVersion.h"
+#include "KDefs.h"
+#include "KTypeDefs.h"
+#include "KVoIP.h"
+#include "KISDN.h"
+#include "KGSM.h"
+
+enum KDeviceType
+{
+ kdtE1 = 0,
+ kdtFXO = 1,
+ kdtConf = 2,
+ kdtPR = 3,
+ kdtE1GW = 4,
+ kdtFXOVoIP = 5,
+ kdtE1IP = 6,
+ kdtE1Spx = 7,
+ kdtGWIP = 8,
+ kdtFXS = 9,
+ kdtFXSSpx = 10,
+ kdtGSM = 11,
+ kdtGSMSpx = 12
+};
+
+enum KSignaling
+{
+ ksigInactive = 0,
+ ksigR2Digital = 1,
+ ksigContinuousEM = 2,
+ ksigPulsedEM = 3,
+ ksigUserR2Digital = 4,
+ ksigAnalog = 5,
+ ksigOpenCAS = 6,
+ ksigOpenR2 = 7,
+ ksigSIP = 8,
+ ksigOpenCCS = 9,
+ ksigPRI_EndPoint = 10,
+ ksigAnalogTerminal = 11,
+ ksigPRI_Network = 12,
+ ksigPRI_Passive = 13,
+ ksigLineSide = 14,
+ ksigCAS_EL7 = 15,
+ ksigGSM = 16,
+ ksigE1LC = 17,
+};
+
+enum KE1DeviceModel
+{
+ kdmE1600 = 0,
+ kdmE1600E = 1,
+ kdmE1600EX = 2
+};
+
+enum KE1GWDeviceModel //Mirror of KE1DeviceModel
+{
+ kdmE1GW640 = 1,
+ kdmE1GW640EX = 2
+};
+
+enum KE1IPDeviceModel //Mirror of KE1DeviceModel
+{
+ kdmE1IP = 1,
+ kdmE1IPEX = 2
+};
+
+enum KGWIPDeviceModel //Mirror of KE1DeviceModel
+{
+ kdmGWIP = 1,
+ kdmGWIPEX = 2
+};
+
+enum KFXODeviceModel
+{
+ kdmFXO80 = 0,
+ kdmFXOHI = 1,
+ kdmFXO160HI = 2
+};
+
+enum KFXOVoIPDeviceModel //Mirror of KFXDeviceModel
+{
+ kdmFXGW180 = kdmFXO80
+};
+
+enum KConfDeviceModel
+{
+ kdmConf240 = 0,
+ kdmConf120 = 1,
+ kdmConf240EX = 2,
+ kdmConf120EX = 3
+};
+
+enum KPRDeviceModel
+{
+ kdmPR300v1 = 0,
+ kdmPR300 = 1,
+ kdmPR300SpxBased = 2,
+ kdmPR300EX = 3
+};
+
+enum KFXSDeviceModel
+{
+ kdmFXS300 = 1,
+ kdmFXS300EX = 2
+};
+
+enum KFXSSpxDeviceModel
+{
+ kdmFXSSpx300 = 0,
+ kdmFXSSpx2E1Based = 1,
+ kdmFXSSpx300EX = 2
+};
+
+enum KE1SpxDeviceModel
+{
+ kdmE1Spx = 0,
+ kdm2E1Based = 1,
+ kdmE1SpxEX = 2
+};
+
+enum KGSMDeviceModel
+{
+ kdmGSM = 0
+};
+
+enum KGSMSpxDeviceModel
+{
+ kdmGSMSpx = 0
+};
+
+enum KSystemObject
+{
+ ksoLink = 0x00, // K3L_LINK_STATUS, K3L_LINK_CONFIG (ksoLink + LinkNumber).
+ ksoLinkMon = 0x20, // K3L_LINK_ERROR_COUNTER.
+ ksoChannel = 0x1000, // K3L_CHANNEL_STATUS, K3L_CHANNEL_CONFIG (ksoChannel + ChannelNumber).
+ ksoH100 = 0x200, // H100 individual configs. Used by adding the same value passed to CM_SETUP_H100.
+ ksoFirmware = 0x80, // Structures described below (ksoFirmware + KFirmwareId).
+ ksoDevice = 0x100, // K3L_DEVICE_CONFIG
+ ksoAPI = 0x150 // K3L_API_CONFIG
+};
+
+enum KFirmwareId
+{
+ kfiE1600A, // K3L_E1600A_FW_CONFIG
+ kfiE1600B, // K3L_E1600B_FW_CONFIG
+ kfiFXO80, // K3L_FX80_FW_CONFIG
+ kfiGSM40 // K3L_GSM40_FW_CONFIG
+};
+
+enum KE1Status
+{
+ kesOk = 0x00, // Link OK
+ kesSignalLost = 0x01, // Lost of signal
+ kesNetworkAlarm = 0x02, // Central office reporting a fail in some point
+ kesFrameSyncLost = 0x04, // Frame is out of sync
+ kesMultiframeSyncLost = 0x08, // Multiframe alingment fail
+ kesRemoteAlarm = 0x10, // Central office reporting fail
+ kesHighErrorRate = 0x20, // Excessive error rate
+ kesUnknownAlarm = 0x40, // Unknown alarm
+ kesE1Error = 0x80, // E1 controller damaged
+ kesNotInitialized = 0xFF // Framer not initilialized
+};
+
+enum KE1ChannelStatus
+{
+ kecsFree = 0x00, // Channel is free for use
+ kecsBusy = 0x01, // Channel busy (not free)
+ kecsOutgoing = 0x02, // Channel busy by outgoing call
+ kecsIncoming = 0x04, // Channel busy by incoming call
+ kecsLocked = 0x06, // Channel locked
+ kecsOutgoingLock = 0x10, // Channel locked for outgoing calls
+ kecsLocalFail = 0x20, // Channel fail
+ kecsIncomingLock = 0x40, // Channel locked for incoming calls
+ kecsRemoteLock = 0x80 // Channel remotelly locked
+};
+
+enum KVoIPChannelStatus
+{
+ kipcsFree = kecsFree,
+ kipcsOutgoingLock = kecsOutgoingLock,
+ kipcsIncomingLock = kecsIncomingLock
+};
+
+enum KFXOChannelStatus
+{
+ kfcsDisabled = 0x00, // Channel is not activated
+ kfcsEnabled = 0x01 // Channel is actived
+};
+
+enum KFXSChannelStatus
+{
+ kfxsOnHook,
+ kfxsOffHook,
+ kfxsRinging,
+ kfxsFail
+};
+
+enum KGsmChannelStatus
+{
+ kgsmIdle,
+ kgsmCallInProgress,
+ kgsmSMSInProgress,
+ kgsmModemError,
+ kgsmSIMCardError,
+ kgsmNetworkError,
+ kgsmNotReady
+};
+
+enum KCallStatus
+{
+ kcsFree = 0x00, // Channel is free for use
+ kcsIncoming = 0x01, // Channel in incoming call
+ kcsOutgoing = 0x02, // Channel in outgoing call
+ kcsFail = 0x04 // Channel fail
+};
+
+enum KCallStartInfo
+{
+ kcsiHumanAnswer,
+ kcsiAnsweringMachine,
+ kcsiCellPhoneMessageBox,
+ kcsiUnknown,
+ kcsiCarrierMessage
+};
+
+enum KChannelFeatures
+{
+ kcfDtmfSuppression = 0x0001,
+ kcfCallProgress = 0x0002,
+ kcfPulseDetection = 0x0004,
+ kcfAudioNotification= 0x0008,
+ kcfEchoCanceller = 0x0010,
+ kcfAutoGainControl = 0x0020,
+ kcfHighImpEvents = 0x0080,
+ kcfCallAnswerInfo = 0x0100,
+ kcfOutputVolume = 0x0200,
+ kcfPlayerAGC = 0x0400
+};
+
+enum KMixerSource
+{
+ kmsChannel,
+ kmsPlay,
+ kmsGenerator,
+ kmsCTbus,
+ kmsNoDelayChannel
+};
+
+struct KMixerCommand
+{
+ int32 Track;
+ int32 Source; // KMixerSource
+ int32 SourceIndex;
+};
+
+struct KPlayFromStreamCommand
+{
+ void *Buffer;
+ uint32 BufferSize;
+ int32 CodecIndex;
+};
+
+struct KBufferParam
+{
+ void *Buffer;
+ uint32 BufferSize;
+};
+
+enum KMixerTone
+{
+ kmtSilence = 0x00, // geracao/deteccao
+ kmtDial = 0x01, // geracao/deteccao
+ kmtBusy = 0x02, // geracao
+ kmtFax = 0x03, // geracao/deteccao
+ kmtVoice = 0x04, // deteccao
+ kmtEndOf425 = 0x05, // deteccao
+ kmtCollect = 0x06, // deteccao
+ kmtEndOfDtmf= 0x07, // deteccao
+};
+
+struct K3L_CHANNEL_STATUS
+{
+ KCallStatus CallStatus;
+ KMixerTone AudioStatus;
+ int32 AddInfo; // KE1ChannelStatus for E1 Channels, KFXOChannelStatus for Analog...
+ int32 EnabledFeatures; // KChannelFeatures bitwise
+};
+
+struct K3L_LINK_STATUS
+{
+ int16 E1; // (KE1Status) int16 used for compatibility between different memory aligniments
+ byte Channels[ KMAX_E1_CHANNELS ]; // (KE1ChannelStatus) Channel number indexed vector with firmware information.
+};
+
+enum KPllErrors
+{
+ kpeClockAError = 0x01,
+ kpeClockBError = 0x02,
+ kpeSCbusError = 0x04,
+ kpeMVIPError = 0x08,
+ kpeMasterPllError = 0x10,
+ kpeModeError = 0x20,
+ kpeLocalRefError = 0x40,
+ kpeInternalError = 0x80
+
+};
+
+struct K3L_H100_STATUS
+{
+ int32 Mode;
+ int32 MasterClock;
+ int32 Enable;
+ int32 Reference;
+
+ int32 SCbus;
+ int32 HMVIP;
+ int32 MVIP90;
+ int32 CT_NETREF;
+ int32 PllLocalRef;
+
+ int32 PllErrors; // bitwise, defined in KPllErrors
+};
+
+enum KEchoLocation
+{
+ kelNetwork = 0x0,
+ kelCtBus = 0x1
+};
+
+enum KCodecIndex
+{
+ kci8kHzALAW = 0x00,
+ kci8kHzPCM = 0x01, // not suitable for CM_RECORD_TO_FILE_EX
+ kci11kHzPCM = 0x02, // not suitable for CM_RECORD_TO_FILE_EX
+ kci8kHzGSM = 0x03,
+ kci8kHzADPCM= 0x04,
+ kci8kHzULAW = 0x05,
+ kciLastCodecEntryMark
+};
+
+enum KEchoCancellerConfig
+{
+ keccNotPresent,
+ keccOneSingleBank,
+ keccOneDoubleBank,
+ keccTwoSingleBank,
+ keccTwoDoubleBank,
+ keccFail
+};
+
+struct K3L_DEVICE_CONFIG
+{
+ int32 LinkCount;
+ int32 ChannelCount;
+ int32 EnabledChannelCount;
+ int32 MixerCount;
+ int32 MixerCapacity;
+ int32 WorkStatus;
+ int32 DeviceModel; // KE1DeviceModel, KFXODeviceModel...
+ int32 H100_Mode; // KH100Mode
+ int32 PciBus;
+ int32 PciSlot;
+ int32 PlayerCount;
+ int32 VoIPChannelCount;
+ int32 CTbusCount;
+ KEchoCancellerConfig EchoConfig;
+ KEchoLocation EchoLocation;
+ sbyte SerialNumber[ KMAX_SERIAL_NUMBER ];
+};
+
+// Compatibility
+typedef K3L_DEVICE_CONFIG K3L_E1_DEVICE_CONFIG;
+typedef K3L_DEVICE_CONFIG K3L_FX_DEVICE_CONFIG;
+
+struct K3L_API_CONFIG
+{
+ int32 MajorVersion;
+ int32 MinorVersion;
+ int32 BuildVersion;
+ int32 SvnRevision;
+ int32 RawCmdLogging;
+ int32 VpdVersionNeeded;
+ sbyte StrVersion[ KMAX_STR_VERSION ];
+};
+
+struct K3L_LINK_CONFIG
+{
+ KSignaling Signaling;
+ int32 IncomingDigitsRequest;
+ int32 IdentificationRequestPos;
+ int32 ChannelCount;
+ int32 ReceivingClock;
+ sbyte NumberA[ KMAX_DIAL_NUMBER + 1 + 3 ]; // +3 = compatibility between different memory alignments
+};
+
+struct K3L_CHANNEL_CONFIG
+{
+ KSignaling Signaling;
+ int32 AutoEnableFeatures; // KChannelFeatures bitwise
+ int32 CapableFeatures; // future implementation
+};
+
+struct K3L_E1600A_FW_CONFIG
+{
+ int32 MfcExchangersCount;
+ int32 MonitorBufferSize;
+ sbyte FwVersion[ KMAX_STR_VERSION ];
+ sbyte DspVersion[ KMAX_DSP_NAME ];
+};
+
+struct K3L_E1600B_FW_CONFIG
+{
+ int32 AudioBufferSize;
+ int32 FilterCount;
+ int32 MixerCount;
+ int32 MixerCapacity;
+ sbyte FwVersion[ KMAX_STR_VERSION ];
+ sbyte DspVersion[ KMAX_DSP_NAME ];
+};
+
+typedef K3L_E1600B_FW_CONFIG K3L_GSM40_FW_CONFIG;
+typedef K3L_E1600B_FW_CONFIG K3L_FXO80_FW_CONFIG;
+
+struct K3L_COMMAND
+{
+ int32 Object; // Object index, dependent of the context
+ int32 Cmd; // Command code
+ byte *Params; // pointer to parameters
+};
+
+// Used to specify the object passed in the first parameter when executing the
+// event handler callback function.
+enum KEventObjectId
+{
+ koiDevice = 0x00,
+ koiChannel = 0x01,
+ koiPlayer = 0x02,
+ koiLink = 0x03
+};
+
+
+struct K3L_EVENT
+{
+ int32 Code; // API code
+ int32 AddInfo; // Parameter 1
+ int32 DeviceId; // Hardware information
+ int32 ObjectInfo; // Additional object information
+ void *Params; // Pointer to the parameter buffer
+ int32 ParamSize; // Size of parameter buffer
+ int32 ObjectId; // KEventObjectId: Event thrower object id
+};
+
+struct KIncomingSeizeParams
+{
+ sbyte NumberB[ KMAX_DIAL_NUMBER + 1 ];
+ sbyte NumberA[ KMAX_DIAL_NUMBER + 1 ];
+
+ sbyte Padding[2]; // for compatibility between different memory alignments
+};
+
+struct KCtbusCommand
+{
+ int32 Stream;
+ int32 TimeSlot;
+ int32 Enable;
+};
+
+struct KUserInformation
+{
+ int32 ProtocolDescriptor;
+ int32 UserInfoLength;
+ byte UserInfo[ KMAX_USER_USER_LEN ];
+};
+
+struct KISDNSubaddressInformation
+{
+ KQ931TypeOfSubaddress TypeOfSubaddress;
+ bool OddNumberOfSignals;
+ int32 InformationLength;
+ byte Information[ KMAX_SUBADRESS_INFORMATION_LEN ];
+};
+
+struct KISDNSubaddresses
+{
+ KISDNSubaddressInformation Called;
+ KISDNSubaddressInformation Calling;
+};
+
+enum KLinkErrorCounter
+{
+ klecChangesToLock = 0,
+ klecLostOfSignal = 1,
+ klecAlarmNotification = 2,
+ klecLostOfFrame = 3,
+ klecLostOfMultiframe = 4,
+ klecRemoteAlarm = 5,
+ klecUnknowAlarm = 6,
+ klecPRBS = 7,
+ klecWrogrBits = 8,
+ klecJitterVariation = 9,
+ klecFramesWithoutSync = 10,
+ klecMultiframeSignal = 11,
+ klecFrameError = 12,
+ klecBipolarViolation = 13,
+ klecCRC4 = 14,
+ klecCount = 15
+};
+
+struct K3L_LINK_ERROR_COUNTER
+{
+ int32 ErrorCounters[ klecCount ];
+};
+
+struct KSipData
+{
+ int32 DataLength;
+ byte Data[ KMAX_SIP_DATA ];
+};
+
+
+enum KLibParams
+{
+ klpDebugFirmware, // starts low level depuration
+ klpResetFwOnStartup, // force firmware (re)boot on startup
+ klpResetFwOnShutdown, // force board reset on exit
+ klpSeizureEventCompat, // keep compatibility of EV_SEIZURE/EV_VOIP_SEIZURE instead of the new EV_NEW_CALL
+ klpDisableTDMBufferWarnings,// don't log TDM buffer warning messages.
+ klpDisableInternalVoIP, // disables ALL VoIP channels!
+ klpLogCallControl, // starts k3l's call control logging
+ klpMaxParams
+};
+
+// Definition of K3L_CALLBACK
+typedef stt_code ( Kstdcall K3L_CALLBACK )();
+typedef stt_code ( Kstdcall K3L_MONITOR_CALLBACK )( byte *, byte );
+typedef stt_code ( Kstdcall K3L_EVENT_CALLBACK )( int32 Object, K3L_EVENT * );
+typedef stt_code ( Kstdcall *K3L_THREAD_CALLBACK )( void * );
+typedef void ( Kstdcall K3L_AUDIO_CALLBACK )( int32 DevId, int32 Channel, byte *Buffer, int32 Size );
+
+#if __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
+extern "C"
+{
+
+sbyte *Kstdcall k3lStart( int32 Major, int32 Minor, int32 Build );
+
+void Kstdcall k3lStop();
+
+void Kstdcall k3lRegisterEventHandler( K3L_EVENT_CALLBACK *Function );
+
+void Kstdcall k3lRegisterAudioListener( K3L_AUDIO_CALLBACK *Player, K3L_AUDIO_CALLBACK *Recorder );
+
+int32 Kstdcall k3lSendCommand( int32 DeviceId, K3L_COMMAND *Cmd );
+
+int32 Kstdcall k3lSendRawCommand( int32 DeviceId, int32 IntfId, void *Command, int32 CmdSize );
+
+int32 Kstdcall k3lRegisterMonitor( K3L_MONITOR_CALLBACK *EventMonitor, K3L_MONITOR_CALLBACK *CommandMonitor, K3L_MONITOR_CALLBACK *BufferMonitor );
+
+int32 Kstdcall k3lGetDeviceConfig( int32 DeviceId, int32 Object, void *Data, int32 DataSize );
+
+int32 Kstdcall k3lGetDeviceStatus( int32 DeviceId, int32 Object, void *Data, int32 DataSize );
+
+int32 Kstdcall k3lGetDeviceCount();
+
+int32 Kstdcall k3lGetDeviceType( int32 DeviceId );
+
+int32 Kstdcall k3lGetEventParam( K3L_EVENT *Evt, const sbyte *Name, sbyte *Buffer, int32 BufferSize );
+
+int32 Kstdcall k3lSetGlobalParam( int32 ParamIndex, int32 ParamValue );
+
+}
+
+#if __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
+#endif
+
+
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/k3lVersion.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/include/k3lVersion.h Tue Jun 9 10:36:45 2009
@@ -0,0 +1,9 @@
+#ifndef k3lVersion_h
+#define k3lVersion_h
+
+#define k3lApiMajorVersion 2
+#define k3lApiMinorVersion 0
+#define k3lApiBuildVersion 0
+
+#endif
+
Added: freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/mod_khomp.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/jmesquita/mod_khomp/mod_khomp.cpp Tue Jun 9 10:36:45 2009
@@ -0,0 +1,646 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm at freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * 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 the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm at freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <mesquita at khomp.com.br>
+ *
+ *
+ * mod_khomp.c -- Khomp board Endpoint Module
+ *
+ */
+
+/* Our includes */
+#include "k3l.h"
+
+extern "C"
+{
+ #include <switch.h>
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown);
+//SWITCH_MODULE_RUNTIME_FUNCTION(mod_khomp_runtime);
+SWITCH_MODULE_DEFINITION(mod_khomp, mod_khomp_load, mod_khomp_shutdown, NULL); //mod_khomp_runtime);
+
+
+switch_endpoint_interface_t *khomp_endpoint_interface;
+static switch_memory_pool_t *module_pool = NULL;
+static int running = 1;
+
+
+typedef enum {
+ TFLAG_IO = (1 << 0),
+ TFLAG_INBOUND = (1 << 1),
+ TFLAG_OUTBOUND = (1 << 2),
+ TFLAG_DTMF = (1 << 3),
+ TFLAG_VOICE = (1 << 4),
+ TFLAG_HANGUP = (1 << 5),
+ TFLAG_LINEAR = (1 << 6),
+ TFLAG_CODEC = (1 << 7),
+ TFLAG_BREAK = (1 << 8)
+} TFLAGS;
+
+typedef enum {
+ GFLAG_MY_CODEC_PREFS = (1 << 0)
+} GFLAGS;
+
+
+static struct {
+ int debug;
+ char *ip;
+ int port;
+ char *dialplan;
+ char *codec_string;
+ char *codec_order[SWITCH_MAX_CODECS];
+ int codec_order_last;
+ char *codec_rates_string;
+ char *codec_rates[SWITCH_MAX_CODECS];
+ int codec_rates_last;
+ unsigned int flags;
+ int calls;
+ switch_mutex_t *mutex;
+} globals;
+
+struct private_object {
+ unsigned int flags;
+ switch_codec_t read_codec;
+ switch_codec_t write_codec;
+ switch_frame_t read_frame;
+ unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+ switch_core_session_t *session;
+ switch_caller_profile_t *caller_profile;
+ switch_mutex_t *mutex;
+ switch_mutex_t *flag_mutex;
+ //switch_thread_cond_t *cond;
+};
+
+typedef struct private_object private_t;
+
+
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, globals.ip);
+
+
+
+static switch_status_t channel_on_init(switch_core_session_t *session);
+static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_routing(switch_core_session_t *session);
+static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
+static switch_status_t channel_on_soft_execute(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_memory_pool_t **pool, switch_originate_flag_t flags);
+static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
+static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
+static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
+
+
+
+static void tech_init(private_t *tech_pvt, switch_core_session_t *session)
+{
+ tech_pvt->read_frame.data = tech_pvt->databuf;
+ tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
+ switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+ switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+ switch_core_session_set_private(session, tech_pvt);
+ tech_pvt->session = session;
+}
+
+/*
+ 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.
+*/
+static switch_status_t channel_on_init(switch_core_session_t *session)
+{
+ switch_channel_t *channel;
+ private_t *tech_pvt = NULL;
+
+ tech_pvt = static_cast< private_t* >(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+ switch_set_flag_locked(tech_pvt, TFLAG_IO);
+
+ /* Move channel's state machine to ROUTING. This means the call is trying
+ to get from the initial start where the call because, to the point
+ where a destination has been identified. If the channel is simply
+ left in the initial state, nothing will happen. */
+ switch_channel_set_state(channel, CS_ROUTING);
+ switch_mutex_lock(globals.mutex);
+ globals.calls++;
+ switch_mutex_unlock(globals.mutex);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_routing(switch_core_session_t *session)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<private_t *>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel));
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_execute(switch_core_session_t *session)
+{
+
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
+
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_hangup(switch_core_session_t *session)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+ switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ //switch_thread_cond_signal(tech_pvt->cond);
+
+ 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);
+ }
+
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
+ switch_mutex_lock(globals.mutex);
+ globals.calls--;
+ if (globals.calls < 0) {
+ globals.calls = 0;
+ }
+ switch_mutex_unlock(globals.mutex);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+ switch (sig) {
+ case SWITCH_SIG_KILL:
+ switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ //switch_thread_cond_signal(tech_pvt->cond);
+ break;
+ case SWITCH_SIG_BREAK:
+ switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
+ break;
+ default:
+ break;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_exchange_media(switch_core_session_t *session)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_soft_execute(switch_core_session_t *session)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+{
+ private_t *tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
+ switch_assert(tech_pvt != NULL);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+ //switch_time_t started = switch_time_now();
+ //unsigned int elapsed;
+ switch_byte_t *data;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+ tech_pvt->read_frame.flags = SFF_NONE;
+ *frame = NULL;
+
+ while (switch_test_flag(tech_pvt, TFLAG_IO)) {
+
+ if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
+ switch_clear_flag(tech_pvt, TFLAG_BREAK);
+ goto cng;
+ }
+
+ if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) {
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ if (!tech_pvt->read_frame.datalen) {
+ continue;
+ }
+ *frame = &tech_pvt->read_frame;
+#ifdef BIGENDIAN
+ if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+ switch_swap_linear((*frame)->data, (int) (*frame)->datalen / 2);
+ }
+#endif
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ switch_cond_next();
+ }
+
+
+ return SWITCH_STATUS_FALSE;
+
+ cng:
+ data = (switch_byte_t *) tech_pvt->read_frame.data;
+ data[0] = 65;
+ data[1] = 0;
+ tech_pvt->read_frame.datalen = 2;
+ tech_pvt->read_frame.flags = SFF_CNG;
+ *frame = &tech_pvt->read_frame;
+ return SWITCH_STATUS_SUCCESS;
+
+}
+
+static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+ //switch_frame_t *pframe;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+ if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ return SWITCH_STATUS_FALSE;
+ }
+#ifdef BIGENDIAN
+ if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+ switch_swap_linear(frame->data, (int) frame->datalen / 2);
+ }
+#endif
+
+
+ return SWITCH_STATUS_SUCCESS;
+
+}
+
+static switch_status_t channel_answer_channel(switch_core_session_t *session)
+{
+ private_t *tech_pvt;
+ switch_channel_t *channel = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
+ assert(tech_pvt != NULL);
+
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
+{
+ switch_channel_t *channel;
+ private_t *tech_pvt;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = (private_t *) switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ switch (msg->message_id) {
+ case SWITCH_MESSAGE_INDICATE_ANSWER:
+ {
+ channel_answer_channel(session);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
+ that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
+*/
+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_memory_pool_t **pool, switch_originate_flag_t flags)
+{
+ if ((*new_session = switch_core_session_request(khomp_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+ private_t *tech_pvt;
+ switch_channel_t *channel;
+ switch_caller_profile_t *caller_profile;
+
+ switch_core_session_add_stream(*new_session, NULL);
+ if ((tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) != 0) {
+ channel = switch_core_session_get_channel(*new_session);
+ tech_init(tech_pvt, *new_session);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
+ switch_core_session_destroy(new_session);
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+ }
+
+ if (outbound_profile) {
+ char name[128];
+
+ snprintf(name, sizeof(name), "Khomp/%s", outbound_profile->destination_number);
+ switch_channel_set_name(channel, name);
+
+ caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
+ switch_channel_set_caller_profile(channel, caller_profile);
+ tech_pvt->caller_profile = caller_profile;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
+ switch_core_session_destroy(new_session);
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+ }
+
+
+
+ switch_channel_set_flag(channel, CF_OUTBOUND);
+ switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
+ switch_channel_set_state(channel, CS_INIT);
+ return SWITCH_CAUSE_SUCCESS;
+ }
+
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+
+}
+
+static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
+{
+ struct private_object *tech_pvt = static_cast<private_t*>(switch_core_session_get_private(session));
+ char *body = switch_event_get_body(event);
+ switch_assert(tech_pvt != NULL);
+
+ if (!body) {
+ body = "";
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+
+switch_state_handler_table_t khomp_state_handlers = {
+ /*.on_init */ channel_on_init,
+ /*.on_routing */ channel_on_routing,
+ /*.on_execute */ channel_on_execute,
+ /*.on_hangup */ channel_on_hangup,
+ /*.on_exchange_media */ channel_on_exchange_media,
+ /*.on_soft_execute */ channel_on_soft_execute
+};
+
+switch_io_routines_t khomp_io_routines = {
+ /*.outgoing_channel */ channel_outgoing_channel,
+ /*.read_frame */ channel_read_frame,
+ /*.write_frame */ channel_write_frame,
+ /*.kill_channel */ channel_kill_channel,
+ /*.send_dtmf */ channel_send_dtmf,
+ /*.receive_message */ channel_receive_message,
+ /*.receive_event */ channel_receive_event
+};
+
+static switch_status_t load_config(void)
+{
+ char *cf = "khomp.conf";
+ switch_xml_t cfg, xml, settings, param;
+
+ memset(&globals, 0, sizeof(globals));
+ switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
+ 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;
+ }
+
+ if ((settings = switch_xml_child(cfg, "settings"))) {
+ 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 (!strcmp(var, "debug")) {
+ globals.debug = atoi(val);
+ } else if (!strcmp(var, "port")) {
+ globals.port = atoi(val);
+ } else if (!strcmp(var, "ip")) {
+ set_global_ip(val);
+ } else if (!strcmp(var, "codec-master")) {
+ if (!strcasecmp(val, "us")) {
+ switch_set_flag(&globals, GFLAG_MY_CODEC_PREFS);
+ }
+ } else if (!strcmp(var, "dialplan")) {
+ set_global_dialplan(val);
+ } else if (!strcmp(var, "codec-prefs")) {
+ set_global_codec_string(val);
+ globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
+ } else if (!strcmp(var, "codec-rates")) {
+ set_global_codec_rates_string(val);
+ globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
+ }
+ }
+ }
+
+ if (!globals.dialplan) {
+ set_global_dialplan("default");
+ }
+
+ if (!globals.port) {
+ globals.port = 4569;
+ }
+
+ switch_xml_free(xml);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+bool start_k3l(void)
+{
+ k3lSetGlobalParam (klpResetFwOnStartup, 1);
+ k3lSetGlobalParam (klpDisableInternalVoIP, 1);
+
+ sbyte *Erro = k3lStart( 2,0,0 );
+
+ if ( Erro ) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "loading K3L API failed: %s.\n", Erro);
+ return false;
+ }
+
+ int _boardCount = k3lGetDeviceCount();
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Number of boards: %d.\n", _boardCount);
+
+ /* No boards */
+ if(_boardCount == 0){
+ k3lStop();
+ return false;
+ }
+
+/* _boards = new Board*[ _boardCount ];
+
+ for( int i = 0; i < _boardCount; i++ )
+ _boards[ i ] = new Board( i );
+
+
+ if(handler)
+ RegisterHandler((void *)EventCallBack); */
+
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "the K3L API have been started!\n");
+
+ bool is_ok = true;
+
+ if (!is_ok)
+ return false;
+
+ return true;
+};
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load)
+{
+
+ module_pool = pool;
+
+ memset(&globals, 0, sizeof(globals));
+
+ load_config();
+
+ *module_interface = switch_loadable_module_create_module_interface(pool, "mod_khomp");
+ khomp_endpoint_interface = static_cast<switch_endpoint_interface_t*>(switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE));
+ khomp_endpoint_interface->interface_name = "khomp";
+ khomp_endpoint_interface->io_routines = &khomp_io_routines;
+ khomp_endpoint_interface->state_handler = &khomp_state_handlers;
+
+ if (!start_k3l()) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/*
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_khomp_runtime)
+{
+ return SWITCH_STATUS_TERM;
+}
+*/
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown)
+{
+ int x = 0;
+
+ running = -1;
+
+ while (running) {
+ if (x++ > 100) {
+ break;
+ }
+ switch_yield(20000);
+ }
+
+ /* Free dynamically allocated strings */
+ switch_safe_free(globals.dialplan);
+ switch_safe_free(globals.codec_string);
+ switch_safe_free(globals.codec_rates_string);
+ switch_safe_free(globals.ip);
+
+ /* Finnish him! */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping K3L...\n");
+ k3lStop();
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "the K3L API have been stopped!\n");
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */
More information about the Freeswitch-svn
mailing list