Skip to content

Instantly share code, notes, and snippets.

@areski
Created April 27, 2012 14:36
Show Gist options
  • Save areski/2509756 to your computer and use it in GitHub Desktop.
Save areski/2509756 to your computer and use it in GitHub Desktop.
Attempt to add accountcode to core.db in table channels
diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c
index d436c60..b9a920a 100644
--- a/src/switch_core_sqldb.c
+++ b/src/switch_core_sqldb.c
@@ -1254,14 +1254,15 @@ static void core_event_handler(switch_event_t *event)
break;
}
case SWITCH_EVENT_CHANNEL_CREATE:
- new_sql() = switch_mprintf("insert into channels (uuid,direction,created,created_epoch, name,state,callstate,dialplan,context,hostname) "
- "values('%q','%q','%q','%ld','%q','%q','%q','%q','%q','%q')",
+ new_sql() = switch_mprintf("insert into channels (uuid,direction,created,created_epoch, name,state,accountcode,callstate,dialplan,context,hostname) "
+ "values('%q','%q','%q','%ld','%q','%q','1%q','%q','%q','%q','%q')",
switch_event_get_header_nil(event, "unique-id"),
switch_event_get_header_nil(event, "call-direction"),
switch_event_get_header_nil(event, "event-date-local"),
(long) switch_epoch_time_now(NULL),
switch_event_get_header_nil(event, "channel-name"),
switch_event_get_header_nil(event, "channel-state"),
+ switch_event_get_header_nil(event, "channel-account"),
switch_event_get_header_nil(event, "channel-call-state"),
switch_event_get_header_nil(event, "caller-dialplan"),
switch_event_get_header_nil(event, "caller-context"), switch_core_get_switchname()
@@ -1606,6 +1607,7 @@ static char create_channels_sql[] =
" cid_name VARCHAR(1024),\n"
" cid_num VARCHAR(256),\n"
" ip_addr VARCHAR(256),\n"
+ " accountcode VARCHAR(128),\n"
" dest VARCHAR(1024),\n"
" application VARCHAR(128),\n"
" application_data VARCHAR(4096),\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment