Changeset 2973
Removed the old "executing in new stack" stuff. This does nothing. I think it must be left over from a pre-threaded core
Committed by:
mjagdis
Date:
Jun 12 2007 * 00:05 (about 1 year ago)
Affected files:
callweaver/trunk/apps/app_proc.c (diff)
callweaver/trunk/corelib/pbx.c (diff)
callweaver/trunk/include/callweaver/ast.h (diff)
callweaver/trunk/include/callweaver/pbx.h (diff)
callweaver/trunk/pbx/pbx_dundi.c (diff)
callweaver/trunk/pbx/pbx_loopback.c (diff)
callweaver/trunk/pbx/pbx_realtime.c (diff)
callweaver/trunk/apps/app_proc.c (unified diff)
| r2956 | r2973 | |
|---|---|---|
| 210 | 210 | while(opbx_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) { |
| 211 | 211 | /* Reset the proc depth, if it was changed in the last iteration */ |
| 212 | 212 | pbx_builtin_setvar_helper(chan, "PROC_DEPTH", depthc); |
| 213 | if ((res = opbx_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num))) { | |
| 213 | if ((res = opbx_exec_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num))) { | |
| 214 | 214 | /* Something bad happened, or a hangup has been requested. */ |
| 215 | 215 | if (((res >= '0') && (res <= '9')) || ((res >= 'A') && (res <= 'F')) || |
| 216 | 216 | (res == '*') || (res == '#')) { |
callweaver/trunk/corelib/pbx.c (unified diff)
| r2972 | r2973 | |
|---|---|---|
| 657 | 657 | #define OPBX_PBX_MAX_STACK 128 |
| 658 | 658 | |
| 659 | 659 | #define HELPER_EXISTS 0 |
| 660 | #define HELPER_SPAWN 1 | |
| 661 | #define HELPER_EXEC 2 | |
| 662 | #define HELPER_CANMATCH 3 | |
| 663 | #define HELPER_MATCHMORE 4 | |
| 664 | #define HELPER_FINDLABEL 5 | |
| 660 | #define HELPER_EXEC 1 | |
| 661 | #define HELPER_CANMATCH 2 | |
| 662 | #define HELPER_MATCHMORE 3 | |
| 663 | #define HELPER_FINDLABEL 4 | |
| 665 | 664 | |
| 666 | 665 | struct opbx_app *pbx_findapp(const char *app) |
| 667 | 666 | { |
| --- | --- | |
| 975 | 974 | switch (action) |
| 976 | 975 | { |
| 977 | 976 | case HELPER_EXISTS: |
| 978 | case HELPER_SPAWN: | |
| 979 | 977 | case HELPER_EXEC: |
| 980 | 978 | case HELPER_FINDLABEL: |
| 981 | 979 | /* We are only interested in exact matches */ |
| --- | --- | |
| 2006 | 2004 | struct opbx_switch *sw; |
| 2007 | 2005 | char *data; |
| 2008 | 2006 | const char *foundcontext=NULL; |
| 2009 | int newstack = 0; | |
| 2010 | 2007 | int res; |
| 2011 | 2008 | int status = 0; |
| 2012 | 2009 | char *incstack[OPBX_PBX_MAX_STACK]; |
| --- | --- | |
| 2042 | 2039 | case HELPER_MATCHMORE: |
| 2043 | 2040 | opbx_mutex_unlock(&conlock); |
| 2044 | 2041 | return -1; |
| 2045 | case HELPER_SPAWN: | |
| 2046 | newstack++; | |
| 2047 | /* Fall through */ | |
| 2048 | 2042 | case HELPER_EXEC: |
| 2049 | 2043 | app = pbx_findapp(e->app); |
| 2050 | 2044 | opbx_mutex_unlock(&conlock); |
| --- | --- | |
| 2057 | 2051 | c->priority = priority; |
| 2058 | 2052 | pbx_substitute_variables(passdata, sizeof(passdata), c, e); |
| 2059 | 2053 | if (option_verbose > 2) |
| 2060 | opbx_verbose( VERBOSE_PREFIX_3 "Executing %s(\"%s\", \"%s\") %s\n", | |
| 2054 | opbx_verbose( VERBOSE_PREFIX_3 "Executing %s(\"%s\", \"%s\")\n", | |
| 2061 | 2055 | opbx_term_color(tmp, app->name, COLOR_BRCYAN, 0, sizeof(tmp)), |
| 2062 | 2056 | opbx_term_color(tmp2, c->name, COLOR_BRMAGENTA, 0, sizeof(tmp2)), |
| 2063 | opbx_term_color(tmp3, (!opbx_strlen_zero(passdata) ? (char *)passdata : ""), COLOR_BRMAGENTA, 0, sizeof(tmp3)), | |
| 2064 | (newstack ? "in new stack" : "in same stack")); | |
| 2057 | opbx_term_color(tmp3, (!opbx_strlen_zero(passdata) ? (char *)passdata : ""), COLOR_BRMAGENTA, 0, sizeof(tmp3))); | |
| 2065 | 2058 | manager_event(EVENT_FLAG_CALL, "Newexten", |
| 2066 | 2059 | "Channel: %s\r\n" |
| 2067 | 2060 | "Context: %s\r\n" |
| --- | --- | |
| 2097 | 2090 | case HELPER_FINDLABEL: |
| 2098 | 2091 | opbx_mutex_unlock(&conlock); |
| 2099 | 2092 | return -1; |
| 2100 | case HELPER_SPAWN: | |
| 2101 | newstack++; | |
| 2102 | /* Fall through */ | |
| 2103 | 2093 | case HELPER_EXEC: |
| 2104 | 2094 | opbx_mutex_unlock(&conlock); |
| 2105 | 2095 | if (sw->exec) |
| 2106 | 2096 | { |
| 2107 | res = sw->exec(c, foundcontext ? foundcontext : context, exten, priority, callerid, newstack, data); | |
| 2097 | res = sw->exec(c, foundcontext ? foundcontext : context, exten, priority, callerid, data); | |
| 2108 | 2098 | } |
| 2109 | 2099 | else |
| 2110 | 2100 | { |
| --- | --- | |
| 2635 | 2625 | return pbx_extension_helper(c, NULL, context, exten, priority, NULL, callerid, HELPER_MATCHMORE); |
| 2636 | 2626 | } |
| 2637 | 2627 | |
| 2638 | int opbx_spawn_extension(struct opbx_channel *c, const char *context, const char *exten, int priority, const char *callerid) | |
| 2639 | { | |
| 2640 | return pbx_extension_helper(c, NULL, context, exten, priority, NULL, callerid, HELPER_SPAWN); | |
| 2641 | } | |
| 2642 | ||
| 2643 | 2628 | int opbx_exec_extension(struct opbx_channel *c, const char *context, const char *exten, int priority, const char *callerid) |
| 2644 | 2629 | { |
| 2645 | 2630 | return pbx_extension_helper(c, NULL, context, exten, priority, NULL, callerid, HELPER_EXEC); |
| --- | --- | |
| 2711 | 2696 | while (opbx_exists_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) |
| 2712 | 2697 | { |
| 2713 | 2698 | memset(exten, 0, sizeof(exten)); |
| 2714 | if ((res = opbx_spawn_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) | |
| 2699 | if ((res = opbx_exec_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) | |
| 2715 | 2700 | { |
| 2716 | 2701 | /* Something bad happened, or a hangup has been requested. */ |
| 2717 | 2702 | if (((res >= '0') && (res <= '9')) || ((res >= 'A') && (res <= 'F')) || |
| --- | --- | |
| 2915 | 2900 | c->priority = 1; |
| 2916 | 2901 | while (opbx_exists_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) |
| 2917 | 2902 | { |
| 2918 | if ((res = opbx_spawn_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) | |
| 2903 | if ((res = opbx_exec_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) | |
| 2919 | 2904 | { |
| 2920 | 2905 | /* Something bad happened, or a hangup has been requested. */ |
| 2921 | 2906 | if (option_debug) |
callweaver/trunk/include/callweaver/ast.h (unified diff)
| r2961 | r2973 | |
|---|---|---|
| 601 | 601 | #define ast_socket opbx_socket |
| 602 | 602 | #define ast_softhangup_nolock opbx_softhangup_nolock |
| 603 | 603 | #define ast_softhangup opbx_softhangup |
| 604 | #define ast_spawn_extension opbx_spawn_extension | |
| 604 | #define ast_spawn_extension opbx_spawn_extension_incompatible_api | |
| 605 | 605 | #define ast_startuptime opbx_startuptime |
| 606 | 606 | #define ast_state2str opbx_state2str |
| 607 | 607 | #define ast_stopstream opbx_stopstream |
callweaver/trunk/include/callweaver/pbx.h (unified diff)
| r2956 | r2973 | |
|---|---|---|
| 125 | 125 | |
| 126 | 126 | int (*canmatch)(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data); |
| 127 | 127 | |
| 128 | int (*exec)(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data); | |
| 128 | int (*exec)(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data); | |
| 129 | 129 | |
| 130 | 130 | int (*matchmore)(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data); |
| 131 | 131 | }; |
| --- | --- | |
| 428 | 428 | */ |
| 429 | 429 | int opbx_extension_pattern_match(const char *destination, const char *pattern); |
| 430 | 430 | |
| 431 | /*! Launch a new extension (i.e. new stack) */ | |
| 432 | /*! | |
| 433 | * \param c not important | |
| 434 | * \param context which context to generate the extension within | |
| 435 | * \param exten new extension to add | |
| 436 | * \param priority priority of new extension | |
| 437 | * \param callerid callerid of extension | |
| 438 | * This adds a new extension to the callweaver extension list. | |
| 439 | * It returns 0 on success, -1 on failure. | |
| 440 | */ | |
| 441 | int opbx_spawn_extension(struct opbx_channel *c, const char *context, const char *exten, int priority, const char *callerid); | |
| 442 | ||
| 443 | 431 | /*! Execute an extension. */ |
| 444 | 432 | /*! |
| 445 | 433 | \param c channel to execute upon |
callweaver/trunk/pbx/pbx_dundi.c (unified diff)
| r2956 | r2973 | |
|---|---|---|
| 4452 | 4452 | return dundi_helper(chan, context, exten, priority, data, DUNDI_FLAG_CANMATCH); |
| 4453 | 4453 | } |
| 4454 | 4454 | |
| 4455 | static int dundi_exec(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data) | |
| 4455 | static int dundi_exec(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) | |
| 4456 | 4456 | { |
| 4457 | 4457 | struct dundi_result results[MAX_RESULTS]; |
| 4458 | 4458 | int res; |
callweaver/trunk/pbx/pbx_loopback.c (unified diff)
| r2956 | r2973 | |
|---|---|---|
| 172 | 172 | return res; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | static int loopback_exec(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data) | |
| 175 | static int loopback_exec(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) | |
| 176 | 176 | { |
| 177 | 177 | LOOPBACK_COMMON; |
| 178 | 178 | |
| 179 | if (newstack) | |
| 180 | res = opbx_spawn_extension(chan, newcontext, newexten, newpriority, callerid); | |
| 181 | else | |
| 182 | res = opbx_exec_extension(chan, newcontext, newexten, newpriority, callerid); | |
| 179 | res = opbx_exec_extension(chan, newcontext, newexten, newpriority, callerid); | |
| 183 | 180 | if (newpattern) |
| 184 | 181 | { |
| 185 | 182 | switch (opbx_extension_pattern_match(exten, newpattern)) |
callweaver/trunk/pbx/pbx_realtime.c (unified diff)
| r2956 | r2973 | |
|---|---|---|
| 185 | 185 | return res > 0 ? res : 0; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | static int realtime_exec(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data) | |
| 188 | static int realtime_exec(struct opbx_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) | |
| 189 | 189 | { |
| 190 | 190 | char app[256]; |
| 191 | 191 | char appdata[512]=""; |
![Home changeset 2973 [home]](/images/logo.png?1180520111)
RSS Feeds