|
|
@@ -126,8 +126,6 @@ typedef struct {
|
|
|
} redis_client_t;
|
|
|
|
|
|
static int BARESIP_STATUS = OFFLINE;
|
|
|
-static int key1LedStatus = Led_Off;
|
|
|
-static int key2LedStatus = Led_Off;
|
|
|
static int CURRENT_KEY = UNKEY;
|
|
|
static int DEBUG = FALSE;
|
|
|
static int ACCOUNT1_REG = REGISTER_FAIL;
|
|
|
@@ -644,31 +642,6 @@ void screenControl(int enable){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void ai_ctrl(Boolean en)
|
|
|
-{
|
|
|
- char hversion[16];
|
|
|
- GetCmdValue(SPK_CONF, "system:hard_version", hversion, sizeof(hversion));
|
|
|
- if(en)
|
|
|
- {
|
|
|
- char ai[8];
|
|
|
- GetCmdValue(SPK_CONF, "ai_settings:enable", ai, sizeof(ai));
|
|
|
- if(strcmp(ai, "yes") == 0)
|
|
|
- {
|
|
|
- if(strcmp(hversion, "Ver3.2") == 0)
|
|
|
- system("echo 1 > /sys/class/gpio/gpio143/value");
|
|
|
- else
|
|
|
- system("echo 1 > /sys/class/gpio/gpio134/value");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(strcmp(hversion, "Ver3.2") == 0)
|
|
|
- system("echo 0 > /sys/class/gpio/gpio143/value");
|
|
|
- else
|
|
|
- system("echo 0 > /sys/class/gpio/gpio134/value");
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
//relay延时控制
|
|
|
void *relayDelayControl()
|
|
|
{
|
|
|
@@ -694,9 +667,9 @@ void *screenDelayControl()
|
|
|
void *key1ScreenDelayControl()
|
|
|
{
|
|
|
char delay[8], srceen_id[16], strtmp[64];
|
|
|
- GetCmdValue(SPK_CONF, "intercom:screen_1_duration", delay, sizeof(delay));
|
|
|
+ GetCmdValue(SPK_CONF, "intercom:screen_duration", delay, sizeof(delay));
|
|
|
usleep(atoi(delay)*1000*1000);
|
|
|
- GetCmdValue(SPK_CONF, "intercom:trigger_1_id", srceen_id, sizeof(srceen_id));
|
|
|
+ GetCmdValue(SPK_CONF, "intercom:trigger_id", srceen_id, sizeof(srceen_id));
|
|
|
sprintf(strtmp,"{\"action\": \"off\", \"id\": %s}",srceen_id);
|
|
|
screen_control(strtmp);
|
|
|
if(DEBUG)
|
|
|
@@ -782,8 +755,6 @@ void answeredTrigger()
|
|
|
char screen_call_state[8], screen_state_info[16], screen_mode[16];
|
|
|
|
|
|
setAnswerCallInfo();
|
|
|
- //切换麦克风通道为通话通道
|
|
|
- ai_ctrl(FALSE);
|
|
|
//判断RELAY是否需要应答复位
|
|
|
GetCmdValue(SPK_CONF, "relay_ctrl:mode", relay_mode, sizeof(relay_mode));
|
|
|
if( strcmp(relay_mode, "answered") == 0 )
|
|
|
@@ -1017,7 +988,6 @@ void ProcessReply( redisReply * pReply )
|
|
|
{
|
|
|
//amplifier_switch(FALSE);
|
|
|
CURRENT_CALLS = 0;
|
|
|
- ai_ctrl(TRUE);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1041,7 +1011,6 @@ void ProcessReply( redisReply * pReply )
|
|
|
if(CURRENT_CALLS < 1)
|
|
|
{
|
|
|
CURRENT_CALLS = 0;
|
|
|
- ai_ctrl(TRUE);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1359,8 +1328,8 @@ void keyAction(int key)
|
|
|
case IDLE:
|
|
|
CURRENT_KEY = KEY;
|
|
|
BARESIP_STATUS = DIALING;
|
|
|
- GetCmdValue(SPK_CONF, "intercom:onekey_1_num", onekey_num, sizeof(onekey_num));
|
|
|
- GetCmdValue(SPK_CONF, "intercom:onekey_1_line", onekey_line, sizeof(onekey_line));
|
|
|
+ GetCmdValue(SPK_CONF, "intercom:onekey_num", onekey_num, sizeof(onekey_num));
|
|
|
+ GetCmdValue(SPK_CONF, "intercom:onekey_line", onekey_line, sizeof(onekey_line));
|
|
|
if(strlen(onekey_num) == 0)
|
|
|
{
|
|
|
BARESIP_STATUS = IDLE;
|
|
|
@@ -1444,7 +1413,7 @@ void keyAction(int key)
|
|
|
break;
|
|
|
case RINGING:
|
|
|
case INUSE:
|
|
|
- GetCmdValue(SPK_CONF, "intercom:repress_1_cancel", repress_cancel, sizeof(repress_cancel));
|
|
|
+ GetCmdValue(SPK_CONF, "intercom:repress_cancel", repress_cancel, sizeof(repress_cancel));
|
|
|
if(strcmp(repress_cancel, "yes") == 0){
|
|
|
strcpy(cmd,"{\"cmd\":\"hangup\",\"data\":\"\"}");
|
|
|
if(DEBUG)
|
|
|
@@ -2105,8 +2074,7 @@ void sip_reg_status_init()
|
|
|
}
|
|
|
if(ACCOUNT1_REG == REGISTER_OK || ACCOUNT2_REG == REGISTER_OK || ACCOUNT3_REG == REGISTER_OK || ACCOUNTP2P_REG == REGISTER_OK)
|
|
|
{
|
|
|
- key1LedStatus = Led_On;
|
|
|
- key2LedStatus = Led_On;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2212,26 +2180,26 @@ int main(int argc, char *argv[]){
|
|
|
if(DEBUG)
|
|
|
printf("KEY DOWN\n");
|
|
|
writeLog(BTN, "KEY", "DOWN");
|
|
|
- GetCmdValue(SPK_CONF, "intercom:key_1_action", action, sizeof(action));
|
|
|
+ GetCmdValue(SPK_CONF, "intercom:key_action", action, sizeof(action));
|
|
|
if(strcmp(action,"call") == 0)
|
|
|
{
|
|
|
keyAction(KEY);
|
|
|
}
|
|
|
if(strcmp(action,"http") == 0)
|
|
|
{
|
|
|
- GetCmdValue(SPK_CONF, "intercom:http_1_url", url, sizeof(url));
|
|
|
+ GetCmdValue(SPK_CONF, "intercom:http_url", url, sizeof(url));
|
|
|
action_url(url);
|
|
|
- writeLog(FUN, "KEY1 HTTP Request", url);
|
|
|
+ writeLog(FUN, "KEY HTTP Request", url);
|
|
|
}
|
|
|
else if(strcmp(action,"play") == 0)
|
|
|
{
|
|
|
char audiofile[32],repeat_tmp[16];
|
|
|
- GetCmdValue(SPK_CONF, "intercom:audio_1_file", audiofile, sizeof(audiofile));
|
|
|
- GetCmdValue(SPK_CONF, "intercom:audio_1_repeat", repeat_tmp, sizeof(repeat_tmp));
|
|
|
+ GetCmdValue(SPK_CONF, "intercom:audio_file", audiofile, sizeof(audiofile));
|
|
|
+ GetCmdValue(SPK_CONF, "intercom:audio_repeat", repeat_tmp, sizeof(repeat_tmp));
|
|
|
int repeat = atoi(repeat_tmp);
|
|
|
play_audio(audiofile,repeat);
|
|
|
sprintf(strtmp, "File: %s; Repeat: %d", audiofile, repeat);
|
|
|
- writeLog( FUN, "KEY1 Play Auido", strtmp );
|
|
|
+ writeLog( FUN, "KEY Play Auido", strtmp );
|
|
|
}
|
|
|
}
|
|
|
}
|