From fb3ba5328f636dc71fd230410e5a033f52ee40b9 Mon Sep 17 00:00:00 2001 From: mukaiu Date: Mon, 17 Sep 2018 17:10:59 +0800 Subject: [PATCH 1/2] #82 fix Cannot read property 'match' of undefined --- cc-switch/app/config/index.js | 4 ++-- cc-switch/app/fs.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cc-switch/app/config/index.js b/cc-switch/app/config/index.js index bfb99c93..deacb6ca 100644 --- a/cc-switch/app/config/index.js +++ b/cc-switch/app/config/index.js @@ -12,8 +12,8 @@ const MINIO_END_POINT = 'localhost'; const MINIO_ACCESS_KEY = 'key'; const MINIO_SECRET_KEY = 'secret'; -const REDIS_HOST = '192.168.2.217'; -const REDIS_PORT = 9763; +const REDIS_HOST = 'localhost'; +const REDIS_PORT = 6379; const config = { PBX_CHANNEL_ID, diff --git a/cc-switch/app/fs.js b/cc-switch/app/fs.js index a47fd712..a07b3fbd 100644 --- a/cc-switch/app/fs.js +++ b/cc-switch/app/fs.js @@ -255,7 +255,9 @@ class FreeSwitch extends EventEmitter { variable_sip_to_user: sip_to_user, variable_call_uuid, } = event; - let match = variable_bridge_channel.match(/sofia\/internal\/(\d+)@/); + let match = + variable_bridge_channel && + variable_bridge_channel.match(/sofia\/internal\/(\d+)@/); if (match) { let sip_from_user = match[1]; let call = new CallOut( From 9222674e63a107c19e0738f41f3cc7cf32279825 Mon Sep 17 00:00:00 2001 From: mukaiu Date: Mon, 17 Sep 2018 17:48:05 +0800 Subject: [PATCH 2/2] #82 prefix +0 --- cc-switch/app/fs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cc-switch/app/fs.js b/cc-switch/app/fs.js index a07b3fbd..86020cb1 100644 --- a/cc-switch/app/fs.js +++ b/cc-switch/app/fs.js @@ -93,7 +93,7 @@ const callOut = phone => new Promise((resolve, reject) => { debug('拨打电话: %s', phone); - conn.bgapi(`originate sofia/gateway/goipx/${phone} &park`, ({ body }) => { + conn.bgapi(`originate sofia/gateway/goipx/0${phone} &park`, ({ body }) => { let match = body.match(/([a-f\d]{8}(-[a-f\d]{4}){3}-[a-f\d]{12}?)/i); if (match) { resolve(match[1]);