[asterisk-addons-commits] mnicholson: branch mnicholson/chan-mobile-refactor r774 - /team/mnicholson/ch...

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Wed Feb 11 15:52:00 CST 2009


Author: mnicholson
Date: Wed Feb 11 15:52:00 2009
New Revision: 774

URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=774
Log:
replaced calls to rfcomm_write("AT+CHUP") with new hfp_send_chup() function

Modified:
    team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c

Modified: team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c
URL: http://svn.digium.com/svn-view/asterisk-addons/team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c?view=diff&rev=774&r1=773&r2=774
==============================================================================
--- team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c (original)
+++ team/mnicholson/chan-mobile-refactor/channels/chan_mobile.c Wed Feb 11 15:52:00 2009
@@ -372,6 +372,7 @@
 static int hfp_send_dtmf(struct hfp_pvt *pvt, char digit);
 static int hfp_send_cmgf(struct hfp_pvt *pvt, int mode);
 static int hfp_send_cnmi(struct hfp_pvt *pvt);
+static int hfp_send_chup(struct hfp_pvt *pvt);
 
 static int hfp_read_brsf(struct hfp_pvt *pvt);
 static int hfp_read_cind(struct hfp_pvt *pvt);
@@ -879,7 +880,7 @@
 
 	if ((pvt->state == MBL_STATE_INCOMING || pvt->state == MBL_STATE_OUTGOING || pvt->state == MBL_STATE_DIAL1 || pvt->state == MBL_STATE_RING3) && pvt->type == MBL_TYPE_PHONE) {
 		if (pvt->do_hangup) {
-			rfcomm_write(pvt->rfcomm_socket, "AT+CHUP\r");
+			hfp_send_chup(pvt->hfp);
 		}
 		pvt->state = MBL_STATE_HANGUP;
 		pvt->hangup_count = 0;
@@ -1836,6 +1837,15 @@
 static int hfp_send_cnmi(struct hfp_pvt *pvt)
 {
 	return rfcomm_write(pvt->rsock, "AT+CNMI=2,1,0,1,0\r");
+}
+
+/*
+ * \brief Send AT+CHUP.
+ * \param pvt an hfp_pvt struct
+ */
+static int hfp_send_chup(struct hfp_pvt *pvt)
+{
+	return rfcomm_write(pvt->rsock, "AT+CHUP\r");
 }
 
 /*
@@ -2458,7 +2468,7 @@
 							pvt->state = MBL_STATE_RING3;
 					} else {
 						ast_log(LOG_ERROR, "Unable to allocate channel for incoming call.\n");
-						rfcomm_write(pvt->rfcomm_socket, "AT+CHUP\r");
+						hfp_send_chup(hfp);
 						pvt->state = MBL_STATE_IDLE;
 					}
 				}
@@ -2473,7 +2483,7 @@
 						pvt->state = MBL_STATE_RING3;
 				} else {
 					ast_log(LOG_ERROR, "Unable to allocate channel for incoming call.\n");
-					rfcomm_write(pvt->rfcomm_socket, "AT+CHUP\r");
+					hfp_send_chup(hfp);
 					pvt->state = MBL_STATE_IDLE;
 				}
 				break;
@@ -2604,7 +2614,7 @@
 						ast_debug(1, "Device %s failed to hangup after 6 tries, disconnecting.\n", pvt->id);
 						break;
 					}
-					rfcomm_write(pvt->rfcomm_socket, "AT+CHUP\r");
+					hfp_send_chup(hfp);
 					pvt->hangup_count++;
 				} else
 					pvt->state = MBL_STATE_IDLE;




More information about the asterisk-addons-commits mailing list