From: <jpg...@us...> - 2008-04-16 21:29:11
|
Revision: 1414 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1414&view=rev Author: jpgrayson Date: 2008-04-16 14:29:18 -0700 (Wed, 16 Apr 2008) Log Message: ----------- Patch from Steven Henke adding radio tranceiver functionality to iaxclient. Modified Paths: -------------- trunk/lib/iaxclient.h trunk/lib/iaxclient_lib.c trunk/lib/libiax2/src/frame.h trunk/lib/libiax2/src/iax-client.h trunk/lib/libiax2/src/iax.c Modified: trunk/lib/iaxclient.h =================================================================== --- trunk/lib/iaxclient.h 2008-04-16 14:29:08 UTC (rev 1413) +++ trunk/lib/iaxclient.h 2008-04-16 21:29:18 UTC (rev 1414) @@ -143,6 +143,7 @@ #define IAXC_CALL_STATE_SELECTED (1<<5) /*!< Indicates the call is selected */ #define IAXC_CALL_STATE_BUSY (1<<6) /*!< Indicates a call is busy */ #define IAXC_CALL_STATE_TRANSFER (1<<7) /*!< Indicates the call transfer has been released */ +#define IAXC_CALL_STATE_KEYED (1<<8) /*!< Indicates the call radio is activated */ /*! Indicates that text is for an IAXClient status change */ #define IAXC_TEXT_TYPE_STATUS 1 @@ -773,6 +774,18 @@ EXPORT void iaxc_answer_call(int callNo); /*! + Radio Transmitter and Receiver Control Activiate + \param callNo The number of the call to activate +*/ +EXPORT void iaxc_key_radio(int callNo); + +/*! + Radio Transmitter and Receiver Control Deactivate + \param callNo The number of the call to deactivate +*/ +EXPORT void iaxc_unkey_radio(int callNo); + +/*! Initiate a blind call transfer of \a callNo to \a number. \param callNo The active call to transfer. \param number The number to transfer the call to. See draft-guy-iax-03 section 8.4.1 for further details. Modified: trunk/lib/iaxclient_lib.c =================================================================== --- trunk/lib/iaxclient_lib.c 2008-04-16 14:29:08 UTC (rev 1413) +++ trunk/lib/iaxclient_lib.c 2008-04-16 21:29:18 UTC (rev 1414) @@ -1153,6 +1153,16 @@ // XXX does the session go away now? iaxc_clear_call(callNo); break; + case IAX_EVENT_KEY: + calls[callNo].state |= IAXC_CALL_STATE_KEYED; + iaxci_do_state_callback(callNo); + iaxci_usermsg(IAXC_STATUS,"Call %d Radio Key", callNo); + break; + case IAX_EVENT_UNKEY: + calls[callNo].state &= ~IAXC_CALL_STATE_KEYED; + iaxci_do_state_callback(callNo); + iaxci_usermsg(IAXC_STATUS,"Call %d Radio Unkey", callNo); + break; case IAX_EVENT_REJECT: iaxci_usermsg(IAXC_STATUS, "Call rejected by remote"); iaxc_clear_call(callNo); @@ -1425,6 +1435,22 @@ iaxci_do_state_callback(callNo); } +EXPORT void iaxc_key_radio(int callNo) +{ + if ( callNo < 0 ) + return; + + iax_key_radio(calls[callNo].session); +} + +EXPORT void iaxc_unkey_radio(int callNo) +{ + if ( callNo < 0 ) + return; + + iax_unkey_radio(calls[callNo].session); +} + EXPORT void iaxc_blind_transfer_call(int callNo, const char * dest_extension) { if ( callNo < 0 || !(calls[callNo].state & IAXC_CALL_STATE_ACTIVE) ) Modified: trunk/lib/libiax2/src/frame.h =================================================================== --- trunk/lib/libiax2/src/frame.h 2008-04-16 14:29:08 UTC (rev 1413) +++ trunk/lib/libiax2/src/frame.h 2008-04-16 21:29:18 UTC (rev 1414) @@ -99,6 +99,8 @@ #define AST_CONTROL_FLASH 9 /* Flash hook */ #define AST_CONTROL_WINK 10 /* Wink */ #define AST_CONTROL_OPTION 11 /* Set an option */ +#define AST_CONTROL_KEY 12 /* Key Radio */ +#define AST_CONTROL_UNKEY 13 /* Unkey Radio */ #define AST_FRIENDLY_OFFSET 64 /* Reserved header space */ Modified: trunk/lib/libiax2/src/iax-client.h =================================================================== --- trunk/lib/libiax2/src/iax-client.h 2008-04-16 14:29:08 UTC (rev 1413) +++ trunk/lib/libiax2/src/iax-client.h 2008-04-16 21:29:18 UTC (rev 1414) @@ -80,8 +80,9 @@ #define IAX_EVENT_CNG 32 /* Comfort-noise (almost silence) */ #define IAX_EVENT_POKE 33 #define IAX_EVENT_VIDEO 34 /* Send/receive video */ +#define IAX_EVENT_KEY 35 /* Radio Control Key */ +#define IAX_EVENT_UNKEY 36 /* Radio Control UnKey */ - /* moved from iax.c to support attended transfer */ #define IAX_EVENT_REREQUEST 999 #define IAX_EVENT_TXREPLY 1000 @@ -195,6 +196,9 @@ extern int iax_send_video(struct iax_session *session, int format, unsigned char *data, int datalen, int fullframe); extern int iax_send_video_trunk(struct iax_session *session, int format, char *data, int datalen, int fullframe, int ntrunk); +extern int iax_key_radio(struct iax_session *session); +extern int iax_unkey_radio(struct iax_session *session); + extern void iax_destroy(struct iax_session * session); extern void iax_enable_debug(void); Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-04-16 14:29:08 UTC (rev 1413) +++ trunk/lib/libiax2/src/iax.c 2008-04-16 21:29:18 UTC (rev 1414) @@ -1878,6 +1878,16 @@ return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_ANSWER, 0, NULL, 0, -1); } +int iax_key_radio(struct iax_session *session) +{ + return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_KEY, 0, NULL, 0, -1); +} + +int iax_unkey_radio(struct iax_session *session) +{ + return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_UNKEY, 0, NULL, 0, -1); +} + int iax_load_complete(struct iax_session *session) { return send_command(session, AST_FRAME_HTML, AST_HTML_LDCOMPLETE, 0, NULL, 0, -1); @@ -2958,6 +2968,14 @@ e->etype = IAX_EVENT_RINGA; e = schedule_delivery(e, ts, updatehistory); break; + case AST_CONTROL_KEY: + e->etype = IAX_EVENT_KEY; + e = schedule_delivery(e, ts, updatehistory); + break; + case AST_CONTROL_UNKEY: + e->etype = IAX_EVENT_UNKEY; + e = schedule_delivery(e, ts, updatehistory); + break; default: DEBU(G "Don't know what to do with AST control %d\n", subclass); free(e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |