Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

pbxdude
Friday, November 23rd, 2007 at 1:42:51am MST 

This post has 1 comment thread shown at the end of this page.

  1. #!/usr/bin/perl -w
  2.  
  3. # usage:
  4. #    cat /path/to/asterisk_source/include/asterisk/causes.h \
  5. #       | this_perl_script \
  6. #       > /path/to/extensions-include-foo.conf
  7. #
  8. # extensions.conf: (example)
  9. #    ...
  10. #    #include "/path/to/extensions-include-foo.conf"
  11. #    [macro-dial_something]
  12. #    ...
  13. #    exten => h,1,GoSub(ast_hangup_causes,hc-${HANGUPCAUSE},1)
  14. #    exten => h,n,NoOp(Hangup cause was ${HANGUPREASON})
  15. #    ...
  16.  
  17. use strict;
  18. use vars qw( $trash $reason $code );
  19.  
  20. print <<_EOM ;
  21. [ast_hangup_causes]
  22. ;
  23. ; Sets the variable HANGUPREASON
  24. _EOM
  25.  
  26. while(<>) {
  27.    chop; s/^\s+//; s/\s+$//;
  28.    next unless (/^#define\s+AST_CAUSE/o && /\d+$/o);
  29.  
  30.    ($trash,$reason,$code) = split(/\s+/, $_);
  31.    $reason =~ s/^AST_CAUSE_//;
  32.  
  33.    print <<_EOM ;
  34. ;
  35. exten => hc-$code,1,Set(HANGUPREASON=$reason)
  36. exten => hc-$code,n,Return()
  37. _EOM
  38. }
  39.  
  40. print <<_EOM ;
  41. ;
  42. exten => hc-.,1,Set(HANGUPREASON=REASON_\${EXTEN:3}_NOTINLIST)
  43. exten => hc-.,n,Return()
  44. _EOM
  45.  
  46. exit $?

Paste Details

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments on this paste

pbxdude (#794600) need help on hangup cause

Posted By: abdullah (+92-346-5765641)

Posted: January 24th, 2012 at 9:02am MST

can anyone help me to find hangup cause from asterisk . ISDN Channal . i need full script as this one is not understandable.
http://pastebin.ca/794600

i really appricate for your forward response.