Projekat

Općenito

Profil

Akcije

Nove funkcije #17002

Zatvoren

ifold, adhearison, ruby asterisk manager inteface (AMI)

Dodano od Ernad Husremović prije oko 16 godina. Izmjenjeno prije skoro 15 godina.

Status:
Odbačeno
Prioritet:
Normalan
Odgovorna osoba:
Kategorija:
-
Početak:
09.04.2009
Završetak:
% završeno:

50%

Procjena vremena:

Povezani tiketi 2 (0 otvoreno2 zatvorenih)

korelira sa voip - Podrška #17000: rmlh asterisk/isdn/voip sramotaZatvorenoErnad Husremović09.04.2009

Akcije
korelira sa system toolbox - Nove funkcije #18351: sysadmin: aktivni monitoring korisnika moramo uspostavitiZatvorenoJasmin Beganović15.09.200930.06.2010

Akcije
Akcije #1

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~# gem --version
0.9.4                      
root@ifold:~# gem install rubygems-update
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rubygems-update-1.3.1                 

root@ifold:~# gem update --system                          
Updating RubyGems...                                       
Attempting remote update of rubygems-update                
Successfully installed rubygems-update-1.3.1               
Updating version of RubyGems to 1.3.1                      
Installing RubyGems 1.3.1                                  
mkdir -p /usr/local/lib/site_ruby/1.8                      
mkdir -p /usr/bin                                          
install -c -m 0644 rubygems.rb /usr/local/lib/site_ruby/1.8/rubygems.rb
install -c -m 0644 rubygems/ext.rb /usr/local/lib/site_ruby/1.8/rubygems/ext.rb
install -c -m 0644 rubygems/gem_openssl.rb /usr/local/lib/site_ruby/1.8/rubygems/gem_openssl.rb
install -c -m 0644 rubygems/remote_fetcher.rb /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb
install -c -m 0644 rubygems/source_info_cache_entry.rb /usr/local/lib/site_ruby/1.8/rubygems/source_info_cache_entry.rb
install -c -m 0644 rubygems/command_manager.rb /usr/local/lib/site_ruby/1.8/rubygems/command_manager.rb                
install -c -m 0644 rubygems/test_utilities.rb /usr/local/lib/site_ruby/1.8/rubygems/test_utilities.rb                  
....

install -c -m 0644 rubygems/package.rb /usr/local/lib/site_ruby/1.8/rubygems/package.rb                                                
install -c -m 0644 rubygems/require_paths_builder.rb /usr/local/lib/site_ruby/1.8/rubygems/require_paths_builder.rb                    
install -c -m 0644 rubygems/gem_path_searcher.rb /usr/local/lib/site_ruby/1.8/rubygems/gem_path_searcher.rb                            
install -c -m 0644 rubygems/format.rb /usr/local/lib/site_ruby/1.8/rubygems/format.rb                                                  
install -c -m 0644 rubygems/timer.rb /usr/local/lib/site_ruby/1.8/rubygems/timer.rb                                                    
install -c -m 0644 rubygems/uninstaller.rb /usr/local/lib/site_ruby/1.8/rubygems/uninstaller.rb                                        

install -c -m 0644 rubygems/specification.rb /usr/local/lib/site_ruby/1.8/rubygems/specification.rb                                    
install -c -m 0644 rubygems/installer.rb /usr/local/lib/site_ruby/1.8/rubygems/installer.rb                                            
install -c -m 0644 rubygems/validator.rb /usr/local/lib/site_ruby/1.8/rubygems/validator.rb                                            
install -c -m 0644 rubygems/local_remote_options.rb /usr/local/lib/site_ruby/1.8/rubygems/local_remote_options.rb                      
install -c -m 0644 rubygems/user_interaction.rb /usr/local/lib/site_ruby/1.8/rubygems/user_interaction.rb                              
install -c -m 0644 rbconfig/datadir.rb /usr/local/lib/site_ruby/1.8/rbconfig/datadir.rb                                                
install -c -m 0644 ubygems.rb /usr/local/lib/site_ruby/1.8/ubygems.rb                                                                  
cp gem /tmp/gem                                                                                                                        
install -c -m 0755 /tmp/gem /usr/bin/gem1.8                                                                                            
rm /tmp/gem                                                                                                                            
rm -f /usr/lib/ruby/gems/1.8/source_cache                                                                                              
Removing old RubyGems RDoc and ri                                                                                                      
rm -rf /usr/lib/ruby/gems/1.8/doc/rubygems-0.9.4                                                                                       
Installing rubygems-1.3.1 ri into /usr/lib/ruby/gems/1.8/doc/rubygems-1.3.1/ri                                                         
Installing rubygems-1.3.1 rdoc into /usr/lib/ruby/gems/1.8/doc/rubygems-1.3.1/rdoc                                                     

------------------------------------------------------------------------------

= Announce: RubyGems Release 1.3.0

NOTE:  RubyGems 1.1 and 1.2 have problems upgrading when there is no
rubygems-update installed.  You will need to follow the second set of update
instructions if you see "Nothing to update".                                

Release 1.3.0 fixes some bugs.

Bugs fixed:

* Disregard ownership of ~ under Windows while creating ~/.gem.  Fixes
  issues related to no uid support under Windows.                     
* Fix requires for Gem::inflate, Gem::deflate, etc.                   
* Make Gem.dir respect :gemhome value from config.  (Note: this feature may be
  removed since it is hard to implement on 1.9.)                              
* Kernel methods are now private.  Patch #20801 by Stefan Rusterholz.         
* Gem::location_of_caller now behaves on Windows.  Patch by Daniel Berger.    
* Silence PATH warning.                                                       

Deprecation Notices:

* Gem::manage_gems will be removed on or after March 2009.

For a full list of changes to RubyGems and the contributor for each change, see
the ChangeLog file.                                                            

Special thanks to Chad Wooley for backwards compatibility testing and Luis
Lavena for continuing windows support.                                    

== How can I get RubyGems?

NOTE:  If you have installed RubyGems using a package system you may want to
install a new RubyGems through the same packaging system.                   

If you have a recent version of RubyGems (0.8.5 or later), then all
you need to do is:                                                 

  $ gem update --system   (you might need to be admin/root)

NOTE:  RubyGems 1.1 and 1.2 have problems upgrading when there is no
rubygems-update installed.  You will need to follow the second set of update
instructions if you see "Nothing to update".                                

NOTE: You may have to run the command twice if you have any previosly
installed rubygems-update gems.                                      

If you have an older version of RubyGems installed, then you can still
do it in two steps:                                                   

  $ gem install rubygems-update  (again, might need to be admin/root)
  $ update_rubygems              (... here too)                      

If you don't have any gems install, there is still the pre-gem
approach to getting software ... doing it manually:           

1. DOWNLOAD FROM: http://rubyforge.org/frs/?group_id=126
2. UNPACK INTO A DIRECTORY AND CD THERE                 
3. INSTALL WITH:  ruby setup.rb  (you may need admin/root privilege)

== To File Bugs

The RubyGems bug tracker can be found on RubyForge at:
http://rubyforge.org/tracker/?func=add&group_id=126&atid=575

When filing a bug, `gem env` output will be helpful in diagnosing the issue.

If you find a bug where RubyGems crashes, please provide debug output. You can
do that with `gem --debug the_command`.                                       

== Thanks

Keep those gems coming!

-- Jim & Chad & Eric (for the RubyGems team)

------------------------------------------------------------------------------

RubyGems installed the following executables:
        /usr/bin/gem1.8

If `gem` was installed by a previous RubyGems installation, you may need
to remove it by hand.

RubyGems system software updated
root@ifold:~# gem --version
/usr/bin/gem:10:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

root@ifold:~# rm /usr/bin/gem
root@ifold:~# ln -s /usr/bin/gem
gem1.8      gemlock     gem_mirror  gemri       gem_server  gemwhich
root@ifold:~# ln -s /usr/bin/gem
gem1.8      gemlock     gem_mirror  gemri       gem_server  gemwhich
root@ifold:~# ln -s /usr/bin/gem1.8  /usr/bin/gem
root@ifold:~# gem --version
1.3.1
Akcije #2

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~# gem install adhearsion

Successfully installed activesupport-2.3.2
Successfully installed rubigen-1.5.2
Successfully installed log4r-1.0.5
Successfully installed adhearsion-0.8.2
4 gems installed
Installing ri documentation for activesupport-2.3.2...

Akcije #3

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~# ahn create ah_1

      create
      create  components/simon_game
      create  components/disabled/stomp_gateway
      create  components/disabled/sandbox
      create  components/ami_remote
      create  components/disabled/restful_rpc/spec
      create  config
      create  .ahnrc
      create  components/simon_game/simon_game.rb
      create  components/ami_remote/ami_remote.rb
      create  components/disabled/stomp_gateway/stomp_gateway.rb
      create  components/disabled/stomp_gateway/stomp_gateway.yml
      create  components/disabled/stomp_gateway/README.markdown
      create  components/disabled/restful_rpc/restful_rpc.rb
      create  components/disabled/restful_rpc/restful_rpc.yml
      create  components/disabled/restful_rpc/README.markdown
      create  components/disabled/restful_rpc/example-client.rb
      create  components/disabled/restful_rpc/spec/restful_rpc_spec.rb
      create  components/disabled/sandbox/sandbox.yml
      create  components/disabled/sandbox/sandbox.rb
      create  config/startup.rb
      create  dialplan.rb
      create  events.rb
      create  README
      create  Rakefile

Akcije #4

Izmjenjeno od Ernad Husremović prije oko 16 godina

/etc/asterisk/manager.conf

[ahn_ami]
secret = sar...
read     = system,call,log,verbose,command,agent,user
write     = system,call,log,verbose,command,agent,user

Akcije #5

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~/ah_1# cat config/startup.rb | grep enable_ami

  config.asterisk.enable_ami :host => "127.0.0.1", :username => "ahn_ami", :password => "sar....", :events => true

Akcije #6

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~/ah_1# cat dialplan.rb

bringoutba {
  play 'hello-world'
  hangup
}

context adhearsion {


   55 => {
        AGI(agi://127.0.0.1);
   };
}

context out {

   includes {
       adhearsion;
   }

   _711 => {
            NoOp("via gizmo echo cal");
            Dial(${GIZMO_TRUNK}/17474743246,400,tT);
          };

  ...

Akcije #7

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~/ah_1# ahn start .

 INFO ahn: Adhearsion initialized!
DEBUG ami: Sending AMI action:
>>> Action: login
>>> ActionID: cI8FBHSU-Uk3Q-1YFK-75jU-mLcaKeDRI8Gk
>>> Username: ahn_ami
>>> Secret: sar...
>>> Events: Off
>>>
 INFO ami: Successful AMI actions-only connection into ahn_ami@127.0.0.1
 INFO ami: Successful AMI events-only connection into ahn_ami@127.0.0.1
 INFO ahn: Got a new call with extension 55
 INFO agi: Handling call with variables {:request=>#<URI::Generic:0xfdbc33326 URL:agi://127.0.0.1>, :type=>"SIP", :callingpres=>0, :calleridname=>"officesa_hernad", :priority=>1, :query=>{}, :callingtns=>0, :rdnis=>nil, :context=>"bringoutba", :network=>true, :extension=>55, :type_of_calling_number=>:unknown, :callingani2=>0, :language=>"bs", :channel=>"SIP/20-081fc5d0", :accountcode=>"", :callerid=>20, :enhanced=>0.0, :dnid=>55, :uniqueid=>"asterisk-5244-1239288754.16"}
DEBUG agi: >>> ANSWER
DEBUG agi: <<< 200 result=0

DEBUG agi: >>> EXEC playback hello-world
DEBUG agi: <<< 200 result=0

DEBUG agi: >>> HANGUP
DEBUG agi: <<< 200 result=1

Akcije #8

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~/ah_1# ahn enable component sandbox

Enabled component sandbox

Akcije #9

Izmjenjeno od Ernad Husremović prije oko 16 godina

adhearsion restful

root@ifold:~/ah_1# ahn enable component restful_rpc
Enabled component restful_rpc
root@ifold:~/ah_1# gem sources -a http://gems.github.com
http://gems.github.com added to sources
root@ifold:~/ah_1# gem install jsgoecke-restful_adhearsion
Building native extensions.  This could take a while...
Successfully installed json-1.1.3
Successfully installed rest-client-0.8.2
Successfully installed jsgoecke-restful_adhearsion-0.1.1
3 gems installed
Installing ri documentation for json-1.1.3...

No definition for cState_configure

No definition for cState_configure
Installing ri documentation for rest-client-0.8.2...
Installing RDoc documentation for json-1.1.3...

No definition for cState_configure

No definition for cState_configure
Installing RDoc documentation for rest-client-0.8.2...

Akcije #10

Izmjenjeno od Ernad Husremović prije oko 16 godina

AMI events http://www.voip-info.org/wiki/view/asterisk+manager+events

          o Agent Status Events
                + 'Agentcallbacklogin' Event
                + 'Agentcallbacklogoff' Event
                + 'AgentCalled' Event
                + 'AgentComplete' Event
                + 'AgentConnect' Event
                + 'AgentDump' Event
                + 'Agentlogin' Event
                + 'Agentlogoff' Event
                + 'QueueMemberAdded' Event
                + 'QueueMemberPaused' Event
                + 'QueueMemberStatus' Event 
          o Command Status Events
          o Call Status Events
                + 'Cdr' Event
                + 'Dial' Event
                + 'ExtensionStatus' Event
                + 'Hangup' Event
                + 'MusicOnHold' Event
                + 'Join' Event
                + 'Leave' Event
                + 'Link' Event
                + 'MeetmeJoin' Event
                + 'MeetmeLeave' Event
                + 'MeetmeStopTalking' Event
                + 'MeetmeTalking' Event
                + 'MessageWaiting' Event
                + 'Newcallerid' Event
                + 'Newchannel' Event
                + 'Newexten' Event
                + 'ParkedCall' Event
                + 'Rename' Event
                + 'SetCDRUserField' Event
                + 'Unlink' Event
                + 'UnParkedCall' Event 
          o Log Status Events
          o System Status Events
                + 'Alarm' Event:
                + 'AlarmClear' Event:
                + 'DNDState' Event:
                + 'LogChannel' Event
                + 'PeerStatus' Event
                + 'Registry' Event
                + 'Reload' Event
                + 'Shutdown' Event 
          o User Status Events
                + 'UserEvent' Event 
          o Verbose Status Events
          o Unformatted and Undocumented

Akcije #11

Izmjenjeno od Ernad Husremović prije oko 16 godina

events.rb

When you create a new Adhearsion application, you will notice there is a file in the root directory of the app called "events.rb". This file is yours to freely modify by registering callbacks with the namespaces you may have available. For example

A namespace could be something such as...
  • /asterisk/before_call
  • /shutdown
  • /xmpp/my_username/incoming_message

When one part of the framework must notify another part of the framework of something, it should go through this events subsystem. The /xmpp/my_username/incoming_message example above shows how a hypothetical XMPP component might allow you to receive incoming messages asynchronously.

A sample callback definition in events.rb looks like this:

events.asterisk.before_call.each do |call|
  extension = call.variables[:extension]
  ahn_log "New call with extension #{extension}" 
end

Notice how, for this namespace (the /asterisk/before_call namespace), a Call object is passed in case your callback may want to use its behavior or state somehow.

Akcije #12

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~/ah_1# gem install rack

Successfully installed rack-0.9.1
1 gem installed
Installing ri documentation for rack-0.9.1...

Akcije #13

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~/ah_1# ahn start .

/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- mongrel (MissingSourceFile)
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
        from /usr/lib/ruby/gems/1.8/gems/rack-0.9.1/lib/rack/handler/mongrel.rb:1
        from /root/ah_1/components/restful_rpc/restful_rpc.rb:71:in `const_get'
        from /root/ah_1/components/restful_rpc/restful_rpc.rb:71:in `load_file'
        from /usr/lib/ruby/gems/1.8/gems/adhearsion-0.8.2/lib/adhearsion/component_manager.rb:103:in `call'
         ... 10 levels...
        from /usr/lib/ruby/gems/1.8/gems/adhearsion-0.8.2/lib/adhearsion/cli.rb:19:in `execute!'
        from /usr/lib/ruby/gems/1.8/gems/adhearsion-0.8.2/bin/ahn:28
        from /usr/bin/ahn:19:in `load'
        from /usr/bin/ahn:19

trebam i http server, ovo mi očigledno traži nova restful komponenta adhearsion-a

root@ifold:~/ah_1# gem install mongrel --no-ri --no-rdoc

Akcije #14

Izmjenjeno od Ernad Husremović prije oko 16 godina

čučno zaptel na ifold-u

ne vjerujem da je razlog rad sa adhearsion ali evo je čučno moj asterisk

root@ifold:~/ah_1# ztcfg -a
ZT_SPANCONFIG failed on span 2: No such device or address (6)
root@ifold:~/ah_1# ztcfg -a2
Zaptel startup failed: Success
root@ifold:~/ah_1# ztcfg -s2
Zaptel shutdown failed: Success
root@ifold:~/ah_1# ztcfg -a2
Zaptel startup failed: Success
root@ifold:~/ah_1# ztcfg -f
ZT_SPANCONFIG failed on span 2: No such device or address (6)
root@ifold:~/ah_1# ztcfg -v

Zaptel Version: 1.4.11
Echo Canceller: MG2
Configuration
======================

SPAN 1: CCS/ AMI Build-out: 0 db (CSU)/0-133 feet (DSX-1)

3 channels to configure.

ZT_SPANCONFIG failed on span 2: No such device or address (6)

kaže problem sa span-om 2 a to je ISDN kartica (ztdummy je sada span 1)

Akcije #15

Izmjenjeno od Ernad Husremović prije oko 16 godina

vidim da je ztdumy nestao iz liste, dodaću ga ?!

root@ifold:~/ah_1# lsmod | grep zap
zaphfc                 15516  0
zaptel                201220  3 zaphfc
crc_ccitt               3072  1 zaptel
root@ifold:~/ah_1# modprobe ztdummy
root@ifold:~/ah_1# lsmod | grep zap
zaphfc                 15516  0
zaptel                201220  4 ztdummy,zaphfc
crc_ccitt               3072  1 zaptel
root@ifold:~/ah_1# ztcfg -v

Zaptel Version: 1.4.11
Echo Canceller: MG2
Configuration
======================

SPAN 1: CCS/ AMI Build-out: 0 db (CSU)/0-133 feet (DSX-1)

3 channels to configure.

ZT_SPANCONFIG failed on span 2: Invalid argument (22)
root@ifold:~/ah_1# ztcfg -a2
Zaptel startup failed: Success
root@ifold:~/ah_1# ztcfg -a1
root@ifold:~/ah_1# ztcfg -a2
Zaptel startup failed: Success
root@ifold:~/ah_1# ztcfg -a
ZT_SPANCONFIG failed on span 2: Invalid argument (22)

Akcije #16

Izmjenjeno od Ernad Husremović prije oko 16 godina

evo šta kaže ztscan sada

root@ifold:~/ah_1# ztscan

[1]
active=yes
alarms=UNCONFIGURED
description=HFC-S PCI A ISDN card 1 [TE]
name=ZTHFC1
manufacturer=
devicetype=
location=
basechan=1
totchans=3
irq=0
type=digital-
syncsrc=0
lbo=0 db (CSU)/0-133 feet (DSX-1)
coding_opts=AMI
framing_opts=CCS
coding=
framing=

[2]
active=yes
alarms=UNCONFIGURED
description=ZTDUMMY/1 (source: HRtimer) 1
name=ZTDUMMY/1
manufacturer=
devicetype=Zaptel Dummy Timing Driver
location=
basechan=4
totchans=0
irq=0

Akcije #17

Izmjenjeno od Ernad Husremović prije oko 16 godina

restartovao asterisk (ali nisam dirao zaptel)

opte asterisk ne vidi zaptel

Akcije #18

Izmjenjeno od Ernad Husremović prije oko 16 godina

zaphfc undefined simbol ?

root@ifold:~/ah_1# /etc/init.d/zaptel start
Zaptel telephony kernel driver: modprobe zaphfc
s-1
s-2
ZT_SPANCONFIG failed on span 2: Invalid argument (22)

root@ifold:~/ah_1# /etc/init.d/zaptel stop
root@ifold:~/ah_1# ps ax | grep zaptel
 7658 pts/1    R+     0:00 grep zaptel

root@ifold:~/ah_1# lsmod | grep zaptel
zaptel                201220  2 ztdummy,zaphfc
crc_ccitt               3072  1 zaptel
root@ifold:~/ah_1# modprobe -r zaptel
FATAL: Module zaptel is in use.

root@ifold:~/ah_1# modprobe -r zaphfc ztdummy zaptel

root@ifold:~/ah_1# lsmod | grep zaptel

root@ifold:~/ah_1# modprobe -r zaphfc ztdummy
root@ifold:~/ah_1# lsmod | grep zaptel
root@ifold:~/ah_1# modprobe  zaphfc ztdummy
FATAL: Error inserting zaphfc (/lib/modules/2.6.24-23-openvz/misc/zaphfc.ko): Unknown symbol in module, or unknown parameter (see dmesg)

Akcije #19

Izmjenjeno od Ernad Husremović prije oko 16 godina

uh on je ztdummy shvatio kao parametar to je bio problem

ovo je ok

root@ifold:~/ah_1# modprobe zaphfc
root@ifold:~/ah_1# modprobe ztdummy
root@ifold:~/ah_1# lsmod | grep zaptel
zaptel                201220  2 ztdummy,zaphfc
crc_ccitt               3072  1 zaptel

Akcije #20

Izmjenjeno od Ernad Husremović prije oko 16 godina

aha

sad sam skontao, bitan je redoslijed učitavanja modula, jer je prvi ztdummy, pa onda zaphfc

root@ifold:~/ah_1# ztcfg
root@ifold:~/ah_1# ztscan
[1]                      
active=yes               
alarms=UNCONFIGURED      
description=ZTDUMMY/1 (source: HRtimer) 1
name=ZTDUMMY/1
manufacturer=
devicetype=Zaptel Dummy Timing Driver
location=
basechan=1
totchans=0
irq=0
type=digital-
syncsrc=0
lbo=0 db (CSU)/0-133 feet (DSX-1)
coding_opts=
framing_opts=
coding=
framing=
[2]
active=yes
alarms=OK
description=HFC-S PCI A ISDN card 0 [TE] layer 1 AC
name=ZTHFC1
manufacturer=
devicetype=
location=
basechan=1
totchans=3
irq=0
type=digital-
syncsrc=0
lbo=0 db (CSU)/0-133 feet (DSX-1)
coding_opts=AMI
framing_opts=CCS
coding=AMI
framing=CCS

inače ovaj ztdummy je skroz bezpotrebno ovdje, trebam ga ukloniti (iz učitavanja u rc.d zaptel startup-u ali neću sada)

Akcije #21

Izmjenjeno od Ernad Husremović prije oko 16 godina

e sad i asterisk vidi zaptel kanale kako treba

root@ifold:~/ah_1# ztscan | grep alarms

alarms=UNCONFIGURED
alarms=OK

znači neophodno je da ztcfg konfiguiše karticu

Akcije #22

Izmjenjeno od Ernad Husremović prije oko 16 godina

podesio events na ahn-u i fino registrujem pozive

evo kada zovem iz stana kancelariju - vidimo CallerID1, CallerID2

 INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f954c8 @name="Unlink", @headers={"CallerID1"=>"269290", "CallerID2"=>"269291", "Channel1"=>"SIP/12-081fd3b8", "Channel2"=>"Zap/1-1", "Uniqueid1"=>"asterisk-1239453148.9", "Uniqueid2"=>"asterisk-1239453148.10", "Privilege"=>"call,all"}>

super

Akcije #23

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~/ah_1# cat restful_client.rb

require 'rubygems'                       
require 'rest_client'                    
require 'json'                           

class RESTfulAdhearsion

  DEFAULT_OPTIONS = {  
    # Note: :user and :password are non-existent by default
    :host => "localhost",                                  
    :port => "5000",                                       
    :path_nesting => "/"                                   
  }                                                        

  def initialize(options={})                               
    @options = DEFAULT_OPTIONS.merge options               

    @path_nesting = @options.delete :path_nesting          
    @host = @options.delete :host                          
    @port = @options.delete :port                          

    @url_beginning = "http://#{@host}:#{@port}#{@path_nesting}" 
  end                                                          

  def method_missing(method_name, *args)                       
    JSON.parse RestClient::Resource.new(@url_beginning + method_name.to_s, @options).post(args.to_json)
  end

end

Adhearsion = RESTfulAdhearsion.new :host => "localhost", :port => 5000, :user => "hernad", :password => "sarabon" 

# ### Sample component code. Try doing "ahn create component testing123" and pasting this code in.
#
#methods_for :rpc do
#   def i_like_hashes(options={})
#     options.has_key?(:foo)
#   end
#   def i_like_arrays(*args)
#     args.reverse
#   end
#end

# Note: everything returned will be wrapped in an Array

p Adhearsion.i_like_hashes(:foo => "bar")
p Adhearsion.i_like_arrays(1,2,3,4,5)

options = {   :channel  => "SIP/12",
              :priority => 1,
              :exten    => "061141311",
              :context  => "bringoutba",
              :async    => "true",
              :variable => "bill_this=true"  }

p Adhearsion.originate options


ovaj gore code preko restful interfejsa se kači na adhearison i onda zvoni lokal SIP/12, kada se javim na taj lokal, onda se vrši poziv na moj mobitel

Akcije #24

Izmjenjeno od Ernad Husremović prije oko 16 godina

na kraj gornje skripte stavio

Adhearsion.call_into_context("Zap/g1/269291","bringoutba", options)

odmah adhearsion očitava da se radi o pinganju samog sebe:


INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f691c0 @name="Newexten", @headers={"AppData"=>"\"pingam sam sebe 269290   .................\"", "Channel"=>"Zap/2-1", "Context"=>"bringoutba", "Uniqueid"=>"asterisk-1239456373.68", "Application"=>"NoOp", "Privilege"=>"call,all", "Priority"=>"2", "Extension"=>"33269291"}>                                                                               
 INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f67f78 @name="Newexten", @headers={"AppData"=>"5", "Channel"=>"Zap/2-1", "Context"=>"bringoutba", "Uniqueid"=>"asterisk-1239456373.68", "Application"=>"Wait", "Privilege"=>"call,all", "Priority"=>"3", "Extension"=>"33269291"}>                                                                                                                            
 INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f66650 @name="Newstate", @headers={"Channel"=>"Zap/1-1", "Uniqueid"=>"asterisk-1239456373.67", "CallerID"=>"032242188", "State"=>"Ringing", "Privilege"=>"call,all", "CallerIDName"=>"<unknown>"}>             
 INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f6550c @name="Newexten", @headers={"AppData"=>"", "Channel"=>"Zap/2-1", "Context"=>"bringoutba", "Uniqueid"=>"asterisk-1239456373.68", "Application"=>"Answer", "Privilege"=>"call,all", "Priority"=>"4", "Extension"=>"33269291"}>
 INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f64508 @name="Newstate", @headers={"Channel"=>"Zap/2-1", "Uniqueid"=>"asterisk-1239456373.68", "CallerID"=>"269290", "State"=>"Up", "Privilege"=>"call,all", "CallerIDName"=>"<unknown>"}>
 INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f634a0 @name="Newexten", @headers={"AppData"=>"", "Channel"=>"Zap/2-1", "Context"=>"bringoutba", "Uniqueid"=>"asterisk-1239456373.68", "Application"=>"Hangup", "Privilege"=>"call,all", "Priority"=>"5", "Extension"=>"33269291"}>
 INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f5f274 @name="Hangup", @headers={"Cause-txt"=>"Normal Clearing", "Cause"=>"16", "Channel"=>"Zap/2-1", "Uniqueid"=>"asterisk-1239456373.68", "Privilege"=>"call,all"}>
 INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f5e25c @name="Newstate", @headers={"Channel"=>"Zap/1-1", "Uniqueid"=>"asterisk-1239456373.67", "CallerID"=>"032242188", "State"=>"Up", "Privilege"=>"call,all", "CallerIDName"=>"<unknown>"}>
 INFO events: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb6f5d028 @name="Newexten", @headers={"AppData"=>"invalid", "Channel"=>"Zap/1-1", "Context"=>"default", "Uniqueid"=>"asterisk-1239456373.67", "Application"=>"Playback", "Privilege"=>"call,all", "Priority"=>"1", "Extension"=>"i"}>

Akcije #25

Izmjenjeno od Ernad Husremović prije oko 16 godina

evo desio se onaj problem sa asteriskom, 99% zauzeće procesora

 7853 root      20   0 33044  12m 7216 S 99.0  2.6   4:54.40 asterisk

Akcije #26

Izmjenjeno od Ernad Husremović prije oko 16 godina

evo syslog-a zadnji dio

Apr 11 15:45:50 ifold postfix/qmgr[6095]: 8ABE32044DA: from=<FaxMaster@ifold.sigma-com.net>, size=4970, nrcpt=1 (queue active)                 
Apr 11 15:45:50 ifold FaxGetty[14561]: MODEM set DTR OFF                                                                                       
Apr 11 15:45:50 ifold FaxGetty[14561]: MODEM set baud rate: 0 baud (flow control unchanged)                                                    
Apr 11 15:45:50 ifold FaxGetty[14561]: DELAY 75 ms                                                                                             
Apr 11 15:45:51 ifold FaxGetty[14561]: MODEM set DTR ON                                                                                        
Apr 11 15:45:51 ifold FaxGetty[14561]: DELAY 2600 ms                                                                                           
Apr 11 15:45:51 ifold postfix/smtp[15125]: 8ABE32044DA: to=<bjasko@bring.out.ba>, relay=zimbra.bring.out.ba[192.168.45.9]:25, delay=1.1, delays=0.41/0.02/0.58/0.14, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as C0FF2C02F)                                                               
Apr 11 15:45:51 ifold postfix/qmgr[6095]: 8ABE32044DA: removed                                                                                 
Apr 11 15:45:54 ifold FaxGetty[14561]: MODEM set baud rate: 19200 baud, input flow XON/XOFF, output flow XON/XOFF                              
Apr 11 15:45:54 ifold FaxGetty[14561]: DELAY 10 ms                                                                                             
Apr 11 15:45:54 ifold FaxGetty[14561]: MODEM flush i/o                                                                                         
Apr 11 15:45:54 ifold FaxGetty[14561]: <-- [4:ATZ\r]                                                                                           
Apr 11 15:45:54 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:54 ifold FaxGetty[14561]: DELAY 3000 ms                                                                                           
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM flush i/o                                                                                         
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [5:ATH1\r]                                                                                          
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [4:ATH1]                                                                                            
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [10:AT+VCID=1\r]                                                                                    
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [9:AT+VCID=1]                                                                                       
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [7:ATS0=0\r]                                                                                        
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [6:ATS0=0]                                                                                          
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [5:ATE0\r]                                                                                          
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [4:ATE0]                                                                                            
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [5:ATV1\r]                                                                                          
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [5:ATQ0\r]                                                                                          
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [7:ATS8=2\r]                                                                                        
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [8:ATS7=60\r]                                                                                       
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [12:AT+FCLASS=?\r]                                                                                  
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [7:0,1,1.0]                                                                                         
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports "Data"                                                                                   
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports "Class 1"                                                                                
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports "Class 1.0"                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [12:AT+FCLASS=1\r]                                                                                  
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [5:ATI3\r]                                                                                          
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [19:www.soft-switch.org]                                                                            
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM: Mfr www.soft-switch.org                                                                          
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [5:ATI0\r]                                                                                          
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [7:spandsp]                                                                                         
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM: Model spandsp                                                                                    
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [9:AT+FTM=?\r]                                                                                      
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [39:24,48,72,73,74,96,97,98,121,122,145,146]                                                        
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]                                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 3.85 line/mm                                                                             
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 7.7 line/mm                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 15.4 line/mm                                                                             
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports R16 x 15.4 line/mm                                                                       
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 200 x 100 dpi                                                                            
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 200 x 200 dpi                                                                            
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 200 x 400 dpi                                                                            
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 300 x 300 dpi                                                                            
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 2400 bit/s                                                                               
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 4800 bit/s                                                                               
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 7200 bit/s                                                                               
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 9600 bit/s                                                                               
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 12000 bit/s                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 14400 bit/s                                                                              
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports A4 page width (215 mm)                                                                   
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports B4 page width (255 mm)                                                                   
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports A3 page width (303 mm)                                                                   
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports A4 page length (297 mm)                                                                  
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports B4 page length (364 mm)                                                                  
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports unlimited page length                                                                    
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 1-D MH                                                                                   
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 2-D MR                                                                                   
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 2-D MMR                                                                                  
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports no ECM                                                                                   
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports T.30 Annex A, 64-byte ECM                                                                
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports T.30 Annex A, 256-byte ECM                                                               
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 0 ms/scanline
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 5 ms/scanline
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 10 ms, 5 ms/scanline
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 10 ms/scanline
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 20 ms, 10 ms/scanline
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 20 ms/scanline
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 40 ms, 20 ms/scanline
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM Supports 40 ms/scanline
Apr 11 15:45:57 ifold FaxGetty[14561]: MODEM WWW.SOFT-SWITCH.ORG spandsp/
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [5:ATM0\r]
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [9:AT+FAR=1\r]
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]
Apr 11 15:45:57 ifold FaxGetty[14561]: <-- [5:ATH0\r]
Apr 11 15:45:57 ifold FaxGetty[14561]: --> [2:OK]
Apr 11 15:45:57 ifold FaxGetty[14561]: STATE CHANGE: LOCKWAIT -> RUNNING (timeout 30)
Apr 11 15:46:34 ifold kernel: [ 7694.969113] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:47:21 ifold kernel: [ 7741.118566] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:48:06 ifold kernel: [ 7786.409319] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:48:52 ifold kernel: [ 7832.529768] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:49:21 ifold asterisk[7853]: rc_avpair_new: unknown attribute 1490026597
Apr 11 15:50:01 ifold kernel: [ 7901.619567] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:50:01 ifold /USR/SBIN/CRON[15142]: (root) CMD (/usr/share/vzctl/scripts/vpsreboot)
Apr 11 15:50:01 ifold /USR/SBIN/CRON[15149]: (root) CMD (/usr/share/vzctl/scripts/vpsnetclean)
Apr 11 15:50:47 ifold kernel: [ 7947.743975] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:51:33 ifold kernel: [ 7993.852435] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:52:20 ifold kernel: [ 8039.975890] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:53:59 ifold kernel: [ 8139.515335] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:54:45 ifold kernel: [ 8185.650786] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:55:01 ifold /USR/SBIN/CRON[15197]: (root) CMD (/usr/share/vzctl/scripts/vpsreboot)
Apr 11 15:55:01 ifold /USR/SBIN/CRON[15204]: (root) CMD (/usr/share/vzctl/scripts/vpsnetclean)
Apr 11 15:55:31 ifold kernel: [ 8231.761225] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 15:56:18 ifold kernel: [ 8277.884672] zaphfc[0]: received d channel frame with bad CRC.

Akcije #27

Izmjenjeno od Ernad Husremović prije oko 16 godina

moram ubiti asterisk

root@ifold:/etc/asterisk# killall -s KILL /usr/sbin/asterisk

root@ifold:/etc/asterisk# killall -s KILL /usr/sbin/asterisk

/usr/sbin/asterisk: no process killed

Akcije #28

Izmjenjeno od Ernad Husremović prije oko 16 godina

nakon toga uradio

root@ifold:/etc/asterisk# modprobe -r zaphfc
root@ifold:/etc/asterisk# modprobe zaphfc
root@ifold:/etc/asterisk# ztcfg
root@ifold:/etc/asterisk# /etc/init.d/asterisk start
Starting Asterisk PBX: asterisk.

Akcije #29

Izmjenjeno od Ernad Husremović prije oko 16 godina

evo opet čučnulo ?!?

[Apr 11 16:08:48] WARNING[15657]: app_dial.c:1202 dial_exec_full: Unable to create channel of type 'zap' (cause 34 - Circuit/channel congestion)
  == Everyone is busy/congested at this time (1:0/1/0)
  == Auto fallthrough, channel 'SIP/12-081ed1a8' status is 'CONGESTION'
Akcije #30

Izmjenjeno od Ernad Husremović prije oko 16 godina

asterisk 99% cpu

syslog

zaphfc

Apr 11 17:15:23 ifold kernel: [13021.494763] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 17:16:09 ifold kernel: [13067.595150] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 17:16:55 ifold kernel: [13113.740585] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 17:17:41 ifold kernel: [13159.852026] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 17:18:27 ifold kernel: [13205.953473] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 17:19:14 ifold kernel: [13252.124891] zaphfc[0]: received d channel frame with bad CRC.
Apr 11 17:20:00 ifold kernel: [13298.320299] zaphfc[0]: received d channel frame with bad CRC.

zaphfc

...
Apr 11 16:05:07 ifold asterisk[15363]: rc_avpair_new: unknown attribute 1490026597
Apr 11 16:48:25 ifold asterisk[15363]: rc_avpair_new: unknown attribute 1490026597
Apr 11 16:48:36 ifold asterisk[15363]: rc_avpair_new: unknown attribute 1490026597
Apr 11 17:06:37 ifold asterisk[15363]: rc_avpair_new: unknown attribute 1490026597
Apr 11 17:06:56 ifold asterisk[15363]: rc_avpair_new: unknown attribute 1490026597
Apr 11 17:18:08 ifold asterisk[15363]: rc_avpair_new: unknown attribute 1490026597
Apr 11 17:18:49 ifold asterisk[15363]: rc_avpair_new: unknown attribute 1490026597
Apr 11 17:19:16 ifold asterisk[15363]: rc_avpair_new: unknown attribute 1490026597

Akcije #31

Izmjenjeno od Ernad Husremović prije oko 16 godina

zap restart - problem D chanell-a, kaže ISDN PRI signalling ??!

ifold*CLI> zap show channels
   Chan Extension  Context         Language   MOH Interpret       
 pseudo            default                    default             
      1            bringoutba                 default             
      2            bringoutba                 default             
ifold*CLI> zap 
destroy  restart  show     
ifold*CLI> zap restart     
 Destroying channels and reloading zaptel configuration.
  == Parsing '/etc/asterisk/zapata.conf': Found
  == Parsing '/etc/asterisk/zapata-channels.conf': Found
    -- Registered channel 1, ISDN PRI signalling
    -- Registered channel 2, ISDN PRI signalling
    -- Automatically generated pseudo channel
  == Parsing '/etc/asterisk/users.conf': Found
[Apr 11 17:23:40] ERROR[16413]: chan_zap.c:10406 start_pri: Unable to open D-channel 3 (Device or resource busy)
[Apr 11 17:23:40] ERROR[16413]: chan_zap.c:12745 setup_zap: Unable to start D-channel on span 2
[Apr 11 17:23:40] WARNING[16413]: chan_zap.c:11188 zap_restart: Reload channels from zap config failed!

otkud isdn PRI signalling ?

Akcije #32

Izmjenjeno od Ernad Husremović prije oko 16 godina

otišo pa iskopčo isdn kabl

ifold*CLI> zap restart

 Destroying channels and reloading zaptel configuration.
  == Parsing '/etc/asterisk/zapata.conf': Found
  == Parsing '/etc/asterisk/zapata-channels.conf': Found
    -- Registered channel 1, ISDN PRI signalling
[Apr 11 17:27:32] WARNING[16457]: chan_zap.c:957 zt_open: Unable to specify channel 2: Device or resource busy
[Apr 11 17:27:32] ERROR[16457]: chan_zap.c:7414 mkintf: Unable to open channel 2: Device or resource busy
here = 0, tmp->channel = 2, channel = 2
[Apr 11 17:27:32] ERROR[16457]: chan_zap.c:11900 build_channels: Unable to register channel '1-2'
[Apr 11 17:27:32] WARNING[16457]: chan_zap.c:11188 zap_restart: Reload channels from zap config failed!

Akcije #33

Izmjenjeno od Ernad Husremović prije oko 16 godina

sada mi je ostao samo jedan kanal

ifold*CLI> zap show channels

   Chan Extension  Context         Language   MOH Interpret
      1            bringoutba                 default

Akcije #34

Izmjenjeno od Ernad Husremović prije oko 16 godina

sljedeći restart

ifold*CLI> zap restart

 Destroying channels and reloading zaptel configuration.
  == Parsing '/etc/asterisk/zapata.conf': Found
  == Parsing '/etc/asterisk/zapata-channels.conf': Found
[Apr 11 17:29:15] WARNING[16457]: chan_zap.c:957 zt_open: Unable to specify channel 1: Device or resource busy
[Apr 11 17:29:15] ERROR[16457]: chan_zap.c:7414 mkintf: Unable to open channel 1: Device or resource busy
here = 0, tmp->channel = 1, channel = 1
[Apr 11 17:29:15] ERROR[16457]: chan_zap.c:11900 build_channels: Unable to register channel '1-2'
[Apr 11 17:29:15] WARNING[16457]: chan_zap.c:11188 zap_restart: Reload channels from zap config failed!

ifold*CLI> zap show channels

   Chan Extension  Context         Language   MOH Interpret

Akcije #35

Izmjenjeno od Ernad Husremović prije oko 16 godina

a onda novi restart

ifold*CLI> zap restart

 Destroying channels and reloading zaptel configuration.
  == Parsing '/etc/asterisk/zapata.conf': Found
  == Parsing '/etc/asterisk/zapata-channels.conf': Found
    -- Registered channel 1, ISDN PRI signalling
    -- Registered channel 2, ISDN PRI signalling
    -- Automatically generated pseudo channel
  == Parsing '/etc/asterisk/users.conf': Found
[Apr 11 17:30:22] ERROR[16486]: chan_zap.c:10406 start_pri: Unable to open D-channel 3 (Device or resource busy)
[Apr 11 17:30:22] ERROR[16486]: chan_zap.c:12745 setup_zap: Unable to start D-channel on span 2
[Apr 11 17:30:22] WARNING[16486]: chan_zap.c:11188 zap_restart: Reload channels from zap config failed!

Akcije #36

Izmjenjeno od Ernad Husremović prije oko 16 godina

interesantno je da sam nadošao da sa tri uzastopna restarta (zap restart sa asterisk konzole) asterisk oslobađa onog cpu 99% zauzeća

Akcije #37

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~# ztcfg -vv

Zaptel Version: 1.4.11
Echo Canceller: MG2
Configuration
======================

SPAN 1: CCS/ AMI Build-out: 0 db (CSU)/0-133 feet (DSX-1)

Channel map:

Channel 01: Clear channel (Default) (Slaves: 01)
Channel 02: Clear channel (Default) (Slaves: 02)
Channel 03: D-channel (Default) (Slaves: 03)

3 channels to configure.

Akcije #38

Izmjenjeno od Ernad Husremović prije oko 16 godina

ifold*CLI> show manager commands

  Action           Privilege        Synopsis                                                                          
  ------           ---------        --------                                                                          
  AbsoluteTimeout  call,all         Set Absolute Timeout                                                              
  AgentCallbackLo  agent,all        Sets an agent as logged in by callback                                            
  AgentLogoff      agent,all        Sets an agent as no longer logged in                                              
  Agents           agent,all        Lists agents and their status                                                     
  Bridge           command,all      Bridge two channels already in the PBX                                            
  ChangeMonitor    call,all         Change monitoring filename of a channel                                           
  Command          command,all      Execute Asterisk CLI Command                                                      
  DBdel            system,all       Delete DB Entry                                                                   
  DBget            system,all       Get DB Entry                                                                      
  DBput            system,all       Put DB Entry                                                                      
  Devstate         call,all         Change a device state                                                             
  Events           <none>           Control Event Flow                                                                
  ExtensionState   call,all         Check Extension Status                                                            
  GetConfig        config,all       Retrieve configuration                                                            
  Getvar           call,all         Gets a Channel Variable                                                           
  Hangup           call,all         Hangup Channel                                                                    
  IAXnetstats      <none>           Show IAX Netstats                                                                 
  IAXpeers         <none>           List IAX Peers                                                                    
  JabberSend       system,all       Sends a message to a Jabber Client                                                
  ListCommands     <none>           List available manager commands                                                   
  Logoff           <none>           Logoff Manager                                                                    
  MailboxCount     call,all         Check Mailbox Message Count                                                       
  MailboxStatus    call,all         Check Mailbox                                                                     
  MeetmeMute       call,all         Mute a Meetme user                                                                
  MeetmeUnmute     call,all         Unmute a Meetme user
  Message          call,all         Send Message
  Monitor          call,all         Monitor a channel
  Originate        call,all         Originate Call
  Park             call,all         Park a channel
  ParkedCalls      <none>           List parked calls
  PauseMonitor     call,all         Pause monitoring of a channel
  Ping             <none>           Keepalive command
  PlayDTMF         call,all         Play DTMF signal on a specific channel.
  QueueAdd         agent,all        Add interface to queue.
  QueuePause       agent,all        Makes a queue member temporarily unavailable
  QueueRemove      agent,all        Remove interface from queue.
  Queues           <none>           Queues
  QueueStatus      <none>           Queue Status
  Redirect         call,all         Redirect (transfer) a call
  SetCDRUserField  call,all         Set the CDR UserField
  Setvar           call,all         Set Channel Variable
  SIPpeers         system,all       List SIP peers (text format)
  SIPshowpeer      system,all       Show SIP peer (text format)
  Status           call,all         Lists channel status
  StopMonitor      call,all         Stop monitoring a channel
  UnpauseMonitor   call,all         Unpause monitoring of a channel
  UpdateConfig     config,all       Update basic configuration
  UserEvent        user,all         Send an arbitrary event
  WaitEvent        <none>           Wait for an event to occur
  ZapDialOffhook   <none>           Dial over Zap channel while offhook
  ZapDNDoff        <none>           Toggle Zap channel Do Not Disturb status OFF
  ZapDNDon         <none>           Toggle Zap channel Do Not Disturb status ON
  ZapHangup        <none>           Hangup Zap Channel
  ZapRestart       <none>           Fully Restart zaptel channels (terminates calls)
  ZapShowChannels  <none>           Show status zapata channels
  ZapTransfer      <none>           Transfer Zap Channel
The 'show manager commands' command is deprecated and will be removed in a future release. Please use 'manager show commands' instead.

Akcije #39

Izmjenjeno od Ernad Husremović prije oko 16 godina

http://advantia.ca/references/asterisk-manager-api

Monitor :: Monitor a channel


    Description: The 'Monitor' action may be used to record the audio on a specified channel.
    Privilege: call,all

    Action: Monitor
    Channel: <channel> - Required
    File: <file>       - Optional
    Format: <format>   - Optional  defaults to "wav".
    Mix: [true | false]      - Optional 

Akcije #40

Izmjenjeno od Ernad Husremović prije oko 16 godina

adhearsion tracking the number of open calls:

#Define our hash and a Mutex since we are in a multi-threaded environment
BILLING_CALLS      = {}
BILLING_CALLS_LOCK = Mutex.new

events.asterisk.manager_interface.each do |event|
  case event.name
  #When a new call is established add the channel and desired variable value to BILLING_CALLS
  when "Newchannel" 

    channel        = event.headers["Channel"]  
    variable_value = Adhearsion::VoIP::Asterisk.manager_interface.send_action("GetVar", 
                                                                              :channel => event.headers["Channel"], 
                                                                              :variable => "BILLING_RATE").headers["Value"]
    BILLING_CALLS_LOCK.synchronize do
      BILLING_CALLS[channel] = variable_value
    end

    #Log the details say we may see that the variables are being set
    ahn_log.events "Found #{channel} with variable #{variable_value}" 
    ahn_log.events BILLING_CALLS

  #When the call is hungup then remove that entry from BILLING_CALLS since Asterisk may immediately
  #reuse the channel reference
  when "Hangup" 
    channel = event.headers["Channel"]
    if BILLING_CALLS.has_key? channel

      BILLING_CALLS_LOCK.synchronize do
        BILLING_CALLS.delete channel
      end

      #Log the details say we may see that the variables are being set
      ahn_log.events "Received hangup for channel #{channel} with variable #{variable_value}, deleting " 
      ahn_log.events BILLING_CALLS
    end
  end
end
Akcije #41

Izmjenjeno od Ernad Husremović prije oko 16 godina

root@ifold:~/ah_1# cat ami_sh.sh

#!/bin/bash
#
echo "open localhost 5038" 
sleep 1
echo "Action: Login" 
echo "UserName: ahn_ami" 
echo "Secret: sar..." 
echo "" 
sleep 2
echo "Action: Command" 
echo "Command: core show version" 
echo "" 
sleep 5
echo "Action: Command" 
echo "Command: core show channels" 
echo "" 
sleep 5
echo "Action: Command" 
echo "Command: sip show peers" 
echo "" 
sleep 5

root@ifold:~/ah_1# bash ami_sh.sh | telnet

telnet> Trying 127.0.0.1...               
Connected to localhost.                   
Escape character is '^]'.                 
Asterisk Call Manager/1.0                 
Response: Success                         
Message: Authentication accepted          

Response: Follows
Privilege: Command
Asterisk 1.4.21.2~dfsg-3ubuntu4 built by root @ vz-test-5501.bring.out.ba on a i686 running Linux on 2009-04-12 15:19:10 UTC
--END COMMAND--                                                                                                             

Response: Follows
Privilege: Command
Channel              Location             State   Application(Data)             
0 active channels                                                               
0 active calls                                                                  
--END COMMAND--                                                                 

Response: Follows
Privilege: Command
Name/username              Host            Dyn Nat ACL Port     Status
ahn1/ahn1                  (Unspecified)    D          0        UNKNOWN
fbde/fbde                  (Unspecified)    D   N      0        UNKNOWN
89/skype1                  192.168.45.115              5060     UNREACHABLE
pc_hernad/pc_hernad        (Unspecified)    D          0        UNKNOWN
hernad_zimbra/hernad_zimb  (Unspecified)    D          0        UNKNOWN
90/90                      (Unspecified)    D          0        UNKNOWN
proxy01.sipphone.com/1747  198.65.166.131       N      5060     Unmonitored
52/52                      (Unspecified)    D   N      0        UNKNOWN
51/51                      77.239.26.4      D   N      5061     OK (55 ms)
50/50                      (Unspecified)    D   N      0        UNKNOWN
43/43                      (Unspecified)    D          0        UNKNOWN
42/42                      (Unspecified)    D          0        UNKNOWN
41/41                      (Unspecified)    D          0        UNKNOWN
38/38                      (Unspecified)    D          0        UNKNOWN
37/37                      (Unspecified)    D          0        UNKNOWN
34/34                      (Unspecified)    D          0        UNKNOWN
33/33                      (Unspecified)    D          0        UNKNOWN
32/32                      (Unspecified)    D          0        UNKNOWN
31/31                      192.168.45.119   D          5060     OK (56 ms)
21/21                      (Unspecified)    D          0        UNKNOWN
20/20                      192.168.45.126   D          5060     OK (3 ms)
13/13                      192.168.45.155   D          5060     OK (19 ms)
12/12                      192.168.45.155   D          5060     OK (19 ms)
11/11                      (Unspecified)    D          0        UNKNOWN
24 sip peers [Monitored: 5 online, 18 offline Unmonitored: 1 online, 0 offline]
--END COMMAND--

Connection closed by foreign host.

Akcije #42

Izmjenjeno od Ernad Husremović prije oko 16 godina

adhearsion koristi http://www.complang.org/ragel/

irb(main):003:0> eval File.read('examples/ami_3.rb')

Akcije #43

Izmjenjeno od Ernad Husremović prije oko 16 godina

  • Naslov promijenjeno iz ifold, adhearison u ifold, adhearison, ruby asterisk manager inteface (AMI)
Akcije #45

Izmjenjeno od Ernad Husremović prije oko 16 godina

juče sam čitav dan ostavio boreći se sa adhearsion-om ... ali nikako da dobijem response od asterisk servera ...

adhearsion fakat ima lošu dokumentaciju. Na kraju mislim da mu je podrška za AMI skroz loša

sa ovom skriptom sam prvo na ifold-u prvo pokušavao

root@ifold:~/ah_1# cat ami_standalone.rb

PATH_TO_ADHEARSION = File.join(File.dirname(__FILE__), "/../..")

MANAGER_CONNECTION_INFORMATION = {
  :host     => "localhost",       
  :username => "ahn_ami",         
  :password => "sarabon",         
  :events   => true               
}                                 

require 'rubygems'
begin             
  require 'adhearsion'
rescue LoadError      
  begin               
    require File.join(PATH_TO_ADHEARSION, "/lib/adhearsion")
  rescue LoadError                                          
    abort "Could not find Adhearsion! Please update the PATH_TO_ADHEARSION constant in this file" 
  end                                                                                            
end                                                                                              

def status_zap(interface, zapno)

 begin
   response = interface.send_action "Status", "Channel" => "Zap/#{zapno}" 
   p response                                                            
   p response[0].headers["Status"]                                       

 rescue ManagerInterfaceError                                            

   puts "zap/#{zapno}  nije aktivan" 
 end                                

  puts "*" * 80
end            

def status_misdn(interface, chan_no)

 begin
   response = interface.send_action "Status", "Channel" => "misdn/#{chan_no}" 
   p response                                                                
   p response[0].headers["Status"]                                           

 rescue ManagerInterfaceError                                                

   puts "misdn/#{chan_no}  nije aktivan" 
 end                                    

  puts "*" * 80
end            

require 'adhearsion/voip/asterisk/manager_interface'

# If you'd like to see the AMI protocol data, change this to :debug
Adhearsion::Logging.logging_level = :debug                         

# This makes addressing the ManagerInterface class a little cleaner
include Adhearsion::VoIP::Asterisk::Manager                        

# Let's instantiate a new ManagerInterface object and have it automatically connect using the Hash we defined above.
interface = ManagerInterface.connect MANAGER_CONNECTION_INFORMATION                                                 

if false

# Send an AMI action with our new ManagerInterface object. This will return an Array of SIPPeer events.
sip_peers = interface.send_action "SIPPeers"                                                           

# Pretty-print the SIP peers on the server

if sip_peers.any?
  sip_peers.each do |peer|
    # Uncomment the following line to view all the headers for each peer.
    # p peer.headers                                                     

    peer_name   = peer.headers["ObjectName"]                             
    peer_status = peer.headers["Status"]                                 

    puts "#{peer_name}: #{peer_status}"                                  
  end                                                                    
else                                                                     
  puts "This Asterisk server has no SIP peers!"                          
end                                                                      

end

# Send an AMI action with our new ManagerInterface object. This will return an Array of SIPPeer events.
#zap_channels = interface.send_action "ZapShowChannels"                                                

# Pretty-print the Zap channels on the server

#p zap_channels

if false
# and zap_channels.any?
  zap_channels.each do |channel|
    # Uncomment the following line to view all the headers for each peer.
    p channel.headers                                                    

    #peer_name   = peer.headers["ObjectName"]                            
    #peer_status = peer.headers["Status"]                                

    #puts "#{peer_name}: #{peer_status}"                                 
  end                                                                    
else                                                                     
#  puts "This Asterisk server has no ZAP channels!"                      
end                                                                      

#status = interface.send_action "Status" 

#p status.inspect
#                
#                

#status_misdn(interface, "1")
#status_misdn(interface, "2")

#ovo radi
response = interface.send_action "Originate", "Channel" => "misdn/g:extern/269291", "Context" => "bringoutba", "Priority" => 1, "Async" => "true" 

#    "Application" => "Playback", "Args" => "hello-world" 

#puts response.headers.inspect

response = interface.send_action_synchronously "command", "command" => "core show channels" 
p response

exit 0

if false
result = interface.send_action 'queuestatus'

prag_hash = {}
result.each do |x|
        prag_hash[x['Queue']] = { :members => {}, :callers => {} } .merge(x.headers) if x.name =~ /queueparams/i
        prag_hash[x['Queue']][:members].merge!(x.headers['Name'] => {}.merge(x.headers)) if x.name =~ /queuemember/i
        prag_hash[x['Queue']][:callers].merge!(x.headers['Position'] => {}.merge(x.headers)) if x.name =~ /queueentry/i
end

p prag_hash
end

status_misdn(interface, "1")
status_misdn(interface, "2")


ali to više nije radilo nego što je radilo, jedina stvar koja je od početka radila je interface.originate poziva

Akcije #46

Izmjenjeno od Ernad Husremović prije oko 16 godina

onda sam počeo da debugiram git repos pa sam tu stavio niz puts "..." poruka da upratim gdje se podaci primaju, kako stvar funkcioniše

hernad@nmraka-5:~/devel/git/adhearsion$ cat examples/ami_3.rb

PATH_TO_ADHEARSION = File.join(File.dirname(__FILE__), "/../..")                                                                       

MANAGER_CONNECTION_INFORMATION = {
  :host     => "ifold.bring.out.ba",
  :username => "ahn_ami",           
  :password => "sarabon",           
  :events   => true
}

PATH_TO_ADHEARSION="." 

require 'rubygems'
#begin
#  require 'adhearsion'
#rescue LoadError
  begin
    require File.join(PATH_TO_ADHEARSION, "/lib/adhearsion")
  rescue LoadError
    abort "Could not find Adhearsion! Please update the PATH_TO_ADHEARSION constant in this file" 
  end
#end

#require 'adhearsion/voip/asterisk/manager_interface'
require "./lib/adhearsion/voip/asterisk/manager_interface.rb" 

# If you'd like to see the AMI protocol data, change this to :debug
Adhearsion::Logging.logging_level = :debug

# This makes addressing the ManagerInterface class a little cleaner
include Adhearsion::VoIP::Asterisk::Manager

# Let's instantiate a new ManagerInterface object and have it automatically connect using the Hash we defined above.
interface = ManagerInterface.connect MANAGER_CONNECTION_INFORMATION

response = interface.send_action "Command" , "Command" => "core show version" 

p response

vrlo slabo sam se snašao u kodu. Nigdje nisam uspio uloviti prijem podataka nakon što pošalje interface.command.

Manifestacija je da se (pogledaj kod gore) komanda pošalje, ali response-a nigdje

izgleda da su se adhearsion autori bacili na dialplan i AGI komande a da je podrška asterisk manager interfejsu skroz loša.

Akcije #47

Izmjenjeno od Ernad Husremović prije oko 16 godina

  • Status promijenjeno iz Novo u Dodijeljeno
  • Odgovorna osoba postavljeno na Ernad Husremović
  • % završeno promijenjeno iz 0 u 50

i kad sam bio skroz očajan za totalno izgubljen dan, palo mi je na pamet da pokušam sa RAGI ruby asterisk manager library-jem.

Nisam to htio jer se biblioteka ne održava ... ali sam začudo vrlo brzo dobio željene rezultate.

Radi se o vrlo usko fokusiranoj biblioteci koja je nemjerjljivo manja i jednostavnija nego li je to adhearsion. Ovaj zadnji je očigledno ambiciozno zamišljen da radi sve živo sa asteriskom ... ali ono što je meni trebalo baš ne radi :(

Akcije #48

Izmjenjeno od Ernad Husremović prije oko 16 godina

krenuću od kraja

hernad@nmraka-5:~/devel/asterisk/RAMI$ ruby bin/example1.rb

================================================================================                                                               
1 2 3$#a b c$#                                                                                                                                 
================================================================================                                                               
"1"                                                                                                                                            
"a"                                                                                                                                            
"b"                                                                                                                                            
Tue Apr 14 11:01:53 +0200 2009 SEND 1: Action: login                                                                                           
Tue Apr 14 11:01:53 +0200 2009 SEND 1: Username: ahn_ami                                                                                       
Tue Apr 14 11:01:53 +0200 2009 SEND 1: Secret: sar...                                                                                   
Tue Apr 14 11:01:53 +0200 2009 SEND 1: Events: On                                                                                              
Tue Apr 14 11:01:53 +0200 2009 SEND 1:                                                                                                         
Tue Apr 14 11:01:53 +0200 2009 RECV 1: Asterisk Call Manager/1.0                                                                               
Tue Apr 14 11:01:53 +0200 2009 RECV 1: Response: Success                                                                                       
Tue Apr 14 11:01:53 +0200 2009 RECV 1: Message: Authentication accepted                                                                        
Tue Apr 14 11:01:53 +0200 2009 RECV 1:                                                                                                         
Tue Apr 14 11:01:53 +0200 2009 MSG: LOGGED IN                                                                                                  
Tue Apr 14 11:01:53 +0200 2009 SEND 2: Action: Ping                                                                                            
Tue Apr 14 11:01:53 +0200 2009 SEND 2: ActionID: 1239699713.11137                                                                              
Tue Apr 14 11:01:53 +0200 2009 SEND 2:                                                                                                         
Tue Apr 14 11:01:53 +0200 2009 RECV 2: Response: Pong                                                                                          
Tue Apr 14 11:01:53 +0200 2009 RECV 2: ActionID: 1239699713.11137                                                                              
Tue Apr 14 11:01:53 +0200 2009 RECV 2:                                                                                                         
Tue Apr 14 11:01:53 +0200 2009 MSG 2: finished (type=action)                                                                                   
pocetak================================================================================                                                        
-x- Response: Pong                                                                                                                             
-x- ActionID: 1239699713.11137                                                                                                                 
krajXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                                                           

Tue Apr 14 11:01:53 +0200 2009 SEND 3: Action: MailboxCount
Tue Apr 14 11:01:53 +0200 2009 SEND 3: Mailbox: 1002       
Tue Apr 14 11:01:53 +0200 2009 SEND 3: ActionID: 1239699713.25386
Tue Apr 14 11:01:53 +0200 2009 SEND 3:                           
Tue Apr 14 11:01:53 +0200 2009 RECV 3: Response: Success         
Tue Apr 14 11:01:53 +0200 2009 RECV 3: ActionID: 1239699713.25386
Tue Apr 14 11:01:53 +0200 2009 RECV 3: Message: Mailbox Message Count
Tue Apr 14 11:01:53 +0200 2009 RECV 3: Mailbox: 1002                 
Tue Apr 14 11:01:53 +0200 2009 RECV 3: NewMessages: 0                
Tue Apr 14 11:01:53 +0200 2009 RECV 3: OldMessages: 0                
Tue Apr 14 11:01:53 +0200 2009 RECV 3:                               
Tue Apr 14 11:01:53 +0200 2009 MSG 3: finished (type=action)         
pocetak================================================================================
-x- Message: Mailbox Message Count                                                     
-x- NewMessages: 0                                                                     
-x- OldMessages: 0                                                                     
-x- Response: Success                                                                  
-x- Mailbox: 1002                                                                      
-x- ActionID: 1239699713.25386                                                         
krajXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   

client.get_events
pocetak================================================================================
krajXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   

Tue Apr 14 11:01:53 +0200 2009 SEND 4: Action: Command
Tue Apr 14 11:01:53 +0200 2009 SEND 4: Command: core show version
Tue Apr 14 11:01:53 +0200 2009 SEND 4: ActionID: 1239699713.39926
Tue Apr 14 11:01:53 +0200 2009 SEND 4:                           
Tue Apr 14 11:01:53 +0200 2009 RECV 4: Response: Follows         
Tue Apr 14 11:01:53 +0200 2009 RECV 4: Privilege: Command        
Tue Apr 14 11:01:53 +0200 2009 RECV 4: ActionID: 1239699713.39926
Tue Apr 14 11:01:53 +0200 2009 RECV 4: Asterisk 1.4.21.2~dfsg-3ubuntu4 built by root @ vz-test-5501.bring.out.ba on a i686 running Linux on 2009-04-12 15:19:10 UTC                                                                                                                           
--END COMMAND--                                                                                                                                
Tue Apr 14 11:01:53 +0200 2009 RECV 4:                                                                                                         
Tue Apr 14 11:01:53 +0200 2009 MSG 4: finished (type=action)                                                                                   
pocetak================================================================================                                                        
-x- Response: Follows                                                                                                                          
-x- 14: Asterisk 1.4.21.2~dfsg-3ubuntu4 built by root @ vz-test-5501.bring.out.ba on a i686 running Linux on 2009-04-12 15:19:10 UTC           
--END COMMAND--                                                                                                                                
-x- Privilege: Command                                                                                                                         
-x- ActionID: 1239699713.39926                                                                                                                 
krajXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                                                           

Tue Apr 14 11:01:53 +0200 2009 SEND 5: Action: Command
Tue Apr 14 11:01:53 +0200 2009 SEND 5: Command: core show channels
Tue Apr 14 11:01:53 +0200 2009 SEND 5: ActionID: 1239699713.55586 
Tue Apr 14 11:01:53 +0200 2009 SEND 5:                            
Tue Apr 14 11:01:53 +0200 2009 RECV 5: Response: Follows          
Tue Apr 14 11:01:53 +0200 2009 RECV 5: Privilege: Command         
Tue Apr 14 11:01:53 +0200 2009 RECV 5: ActionID: 1239699713.55586 
Tue Apr 14 11:01:53 +0200 2009 RECV 5: Channel              Location             State   Application(Data)             
0 active channels                                                                                                      
0 active calls                                                                                                         
--END COMMAND--                                                                                                        
Tue Apr 14 11:01:53 +0200 2009 RECV 5:                                                                                 
Tue Apr 14 11:01:53 +0200 2009 MSG 5: finished (type=action)                                                           
(?m-ix:^(\d+)\sactive\schannel.*[\n])                                                                                  
****************************************************************************************************                   
active channels = 0                                                                                                    
----------------------------------------------------------------------------------------------------                   
[{"no_active_channels"=>0}]                                                                                            
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$                   
Tue Apr 14 11:01:53 +0200 2009 SEND 6: Action: Originate                                                               
Tue Apr 14 11:01:53 +0200 2009 SEND 6: Channel: misdn/g:extern/269291                                                  
Tue Apr 14 11:01:53 +0200 2009 SEND 6: Context: bringoutba                                                             
Tue Apr 14 11:01:53 +0200 2009 SEND 6: Async: true                                                                     
Tue Apr 14 11:01:53 +0200 2009 SEND 6: Priority: 1                                                                     
Tue Apr 14 11:01:53 +0200 2009 SEND 6: ActionID: 1239699713.69366                                                      
Tue Apr 14 11:01:53 +0200 2009 SEND 6:                                                                                 
Tue Apr 14 11:01:53 +0200 2009 RECV 6: Response: Success                                                               
Tue Apr 14 11:01:53 +0200 2009 RECV 6: ActionID: 1239699713.69366                                                      
Tue Apr 14 11:01:53 +0200 2009 RECV 6: Message: Originate successfully queued                                          
Tue Apr 14 11:01:53 +0200 2009 RECV 6: Uniqueid: asterisk-22988-1239699717.251                                         
Tue Apr 14 11:01:53 +0200 2009 RECV 6:                                                                                 
Tue Apr 14 11:01:53 +0200 2009 MSG 6: finished (type=action)                                                           
Tue Apr 14 11:01:53 +0200 2009 RECV 7: Event: Newchannel                                                               
Tue Apr 14 11:01:53 +0200 2009 RECV 7: Privilege: call,all                                                             
Tue Apr 14 11:01:53 +0200 2009 RECV 7: Channel: mISDN/tmp0-u196                                                        
Tue Apr 14 11:01:53 +0200 2009 RECV 7: State: Rsrvd                                                                    
Tue Apr 14 11:01:53 +0200 2009 RECV 7: CallerIDNum: <unknown>                                                          
Tue Apr 14 11:01:53 +0200 2009 RECV 7: CallerIDName: <unknown>                                                         
Tue Apr 14 11:01:53 +0200 2009 RECV 7: Uniqueid: asterisk-1239699717.252                                               
Tue Apr 14 11:01:53 +0200 2009 RECV 7:                                                                                 
Tue Apr 14 11:01:53 +0200 2009 MSG 7: finished (type=state)                                                            
Tue Apr 14 11:01:53 +0200 2009 RECV 8: Event: Newcallerid                                                              
Tue Apr 14 11:01:53 +0200 2009 RECV 8: Privilege: call,all                                                             
Tue Apr 14 11:01:53 +0200 2009 RECV 8: Channel: mISDN/tmp0-u196                                                        
Tue Apr 14 11:01:53 +0200 2009 RECV 8: CallerID: <Unknown>                                                             
Tue Apr 14 11:01:53 +0200 2009 RECV 8: CallerIDName: <Unknown>                                                         
Tue Apr 14 11:01:53 +0200 2009 RECV 8: Uniqueid: asterisk-1239699717.252                                               
Tue Apr 14 11:01:53 +0200 2009 RECV 8: CID-CallingPres: 0 (Presentation Allowed, Not Screened)                         
Tue Apr 14 11:01:53 +0200 2009 RECV 8:                                                                                 
Tue Apr 14 11:01:53 +0200 2009 MSG 8: finished (type=state)                                                            
Tue Apr 14 11:01:53 +0200 2009 RECV 9: Event: Newstate                                                                 
Tue Apr 14 11:01:53 +0200 2009 RECV 9: Privilege: call,all                                                             
Tue Apr 14 11:01:53 +0200 2009 RECV 9: Channel: mISDN/tmp0-u196                                                        
Tue Apr 14 11:01:53 +0200 2009 RECV 9: State: Dialing                                                                  
Tue Apr 14 11:01:53 +0200 2009 RECV 9: CallerID: <unknown>                                                             
Tue Apr 14 11:01:53 +0200 2009 RECV 9: CallerIDName: <unknown>                                                         
Tue Apr 14 11:01:53 +0200 2009 RECV 9: Uniqueid: asterisk-1239699717.252                                               
Tue Apr 14 11:01:53 +0200 2009 RECV 9:                                                                                 
Tue Apr 14 11:01:53 +0200 2009 MSG 9: finished (type=state)                                                            
pocetak================================================================================                                
-x- Message: Originate successfully queued                                                                             
-x- Uniqueid: asterisk-22988-1239699717.251                                                                            
-x- Response: Success                                                                                                  
-x- ActionID: 1239699713.69366                                                                                         
krajXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                                   

Tue Apr 14 11:01:54 +0200 2009 RECV 10: Event: Rename
Tue Apr 14 11:01:54 +0200 2009 RECV 10: Privilege: call,all
Tue Apr 14 11:01:54 +0200 2009 RECV 10: Oldname: mISDN/tmp0-u196
Tue Apr 14 11:01:54 +0200 2009 RECV 10: Newname: mISDN/1-u197   
Tue Apr 14 11:01:54 +0200 2009 RECV 10: Uniqueid: asterisk-1239699717.252
Tue Apr 14 11:01:54 +0200 2009 RECV 10:                                  
Tue Apr 14 11:01:54 +0200 2009 MSG 10: finished (type=state)             
Tue Apr 14 11:01:54 +0200 2009 RECV 11: Event: Newchannel                
Tue Apr 14 11:01:54 +0200 2009 RECV 11: Privilege: call,all              
Tue Apr 14 11:01:54 +0200 2009 RECV 11: Channel: mISDN/2-u198            
Tue Apr 14 11:01:54 +0200 2009 RECV 11: State: Rsrvd                     
Tue Apr 14 11:01:54 +0200 2009 RECV 11: CallerIDNum: 269290              
Tue Apr 14 11:01:54 +0200 2009 RECV 11: CallerIDName: <unknown>          
Tue Apr 14 11:01:54 +0200 2009 RECV 11: Uniqueid: asterisk-1239699717.253
Tue Apr 14 11:01:54 +0200 2009 RECV 11:                                  
Tue Apr 14 11:01:54 +0200 2009 MSG 11: finished (type=state)             
Tue Apr 14 11:01:54 +0200 2009 RECV 12: Event: Newcallerid               
Tue Apr 14 11:01:54 +0200 2009 RECV 12: Privilege: call,all              
Tue Apr 14 11:01:54 +0200 2009 RECV 12: Channel: mISDN/2-u198            
Tue Apr 14 11:01:54 +0200 2009 RECV 12: CallerID: 269290                 
Tue Apr 14 11:01:54 +0200 2009 RECV 12: CallerIDName: <Unknown>          
Tue Apr 14 11:01:54 +0200 2009 RECV 12: Uniqueid: asterisk-1239699717.253
Tue Apr 14 11:01:54 +0200 2009 RECV 12: CID-CallingPres: 0 (Presentation Allowed, Not Screened)
Tue Apr 14 11:01:54 +0200 2009 RECV 12:                                                        
Tue Apr 14 11:01:54 +0200 2009 MSG 12: finished (type=state)                                   
Tue Apr 14 11:01:54 +0200 2009 RECV 13: Event: Newstate                                        
Tue Apr 14 11:01:54 +0200 2009 RECV 13: Privilege: call,all                                    
Tue Apr 14 11:01:54 +0200 2009 RECV 13: Channel: mISDN/2-u198                                  
Tue Apr 14 11:01:54 +0200 2009 RECV 13: State: Ringing                                         
Tue Apr 14 11:01:54 +0200 2009 RECV 13: CallerID: 269290                                       
Tue Apr 14 11:01:54 +0200 2009 RECV 13: CallerIDName: <unknown>                                
Tue Apr 14 11:01:54 +0200 2009 RECV 13: Uniqueid: asterisk-1239699717.253                      
Tue Apr 14 11:01:54 +0200 2009 RECV 13:                                                        
Tue Apr 14 11:01:54 +0200 2009 MSG 13: finished (type=state)                                   
Tue Apr 14 11:01:54 +0200 2009 RECV 14: Event: Newexten                                        
Tue Apr 14 11:01:54 +0200 2009 RECV 14: Privilege: call,all                                    
Tue Apr 14 11:01:54 +0200 2009 RECV 14: Channel: mISDN/2-u198                                  
Tue Apr 14 11:01:54 +0200 2009 RECV 14: Context: bringoutba                                    
Tue Apr 14 11:01:54 +0200 2009 RECV 14: Extension: 033269291                                   
Tue Apr 14 11:01:54 +0200 2009 RECV 14: Priority: 1                                            
Tue Apr 14 11:01:54 +0200 2009 RECV 14: Application: Goto                                      
Tue Apr 14 11:01:54 +0200 2009 RECV 14: AppData: in|269291|1                                   
Tue Apr 14 11:01:54 +0200 2009 RECV 14: Uniqueid: asterisk-1239699717.253                      
Tue Apr 14 11:01:54 +0200 2009 RECV 14:                                                        
Tue Apr 14 11:01:54 +0200 2009 MSG 14: finished (type=state)                                   
Tue Apr 14 11:01:54 +0200 2009 RECV 15: Event: Newexten                                        
Tue Apr 14 11:01:54 +0200 2009 RECV 15: Privilege: call,all                                    
Tue Apr 14 11:01:54 +0200 2009 RECV 15: Channel: mISDN/2-u198                                  
Tue Apr 14 11:01:54 +0200 2009 RECV 15: Context: in                                            
Tue Apr 14 11:01:54 +0200 2009 RECV 15: Extension: 269291                                      
Tue Apr 14 11:01:54 +0200 2009 RECV 15: Priority: 1                                            
Tue Apr 14 11:01:54 +0200 2009 RECV 15: Application: GotoIf                                    
Tue Apr 14 11:01:54 +0200 2009 RECV 15: AppData: 5?2:7                                         
Tue Apr 14 11:01:54 +0200 2009 RECV 15: Uniqueid: asterisk-1239699717.253                      
Tue Apr 14 11:01:54 +0200 2009 RECV 15:                                                        
Tue Apr 14 11:01:54 +0200 2009 MSG 15: finished (type=state)                                   
Tue Apr 14 11:01:54 +0200 2009 RECV 16: Event: Newexten                                        
Tue Apr 14 11:01:54 +0200 2009 RECV 16: Privilege: call,all                                    
Tue Apr 14 11:01:54 +0200 2009 RECV 16: Channel: mISDN/2-u198                                  
Tue Apr 14 11:01:54 +0200 2009 RECV 16: Context: in                                            
Tue Apr 14 11:01:54 +0200 2009 RECV 16: Extension: 269291                                      
Tue Apr 14 11:01:54 +0200 2009 RECV 16: Priority: 2                                            
Tue Apr 14 11:01:54 +0200 2009 RECV 16: Application: NoOp                                      
Tue Apr 14 11:01:54 +0200 2009 RECV 16: AppData: "pingam sam sebe 269290   ................."  
Tue Apr 14 11:01:54 +0200 2009 RECV 16: Uniqueid: asterisk-1239699717.253                      
Tue Apr 14 11:01:54 +0200 2009 RECV 16:                                                        
Tue Apr 14 11:01:54 +0200 2009 MSG 16: finished (type=state)                                   
Tue Apr 14 11:01:54 +0200 2009 RECV 17: Event: Newexten                                        
Tue Apr 14 11:01:54 +0200 2009 RECV 17: Privilege: call,all                                    
Tue Apr 14 11:01:54 +0200 2009 RECV 17: Channel: mISDN/2-u198                                  
Tue Apr 14 11:01:54 +0200 2009 RECV 17: Context: in                                            
Tue Apr 14 11:01:54 +0200 2009 RECV 17: Extension: 269291                                      
Tue Apr 14 11:01:54 +0200 2009 RECV 17: Priority: 3                                            
Tue Apr 14 11:01:54 +0200 2009 RECV 17: Application: Wait                                      
Tue Apr 14 11:01:54 +0200 2009 RECV 17: AppData: 10                                            
Tue Apr 14 11:01:54 +0200 2009 RECV 17: Uniqueid: asterisk-1239699717.253                      
Tue Apr 14 11:01:54 +0200 2009 RECV 17:                                                        
Tue Apr 14 11:01:54 +0200 2009 MSG 17: finished (type=state)                                   
Tue Apr 14 11:01:54 +0200 2009 RECV 18: Event: Newstate                                        
Tue Apr 14 11:01:54 +0200 2009 RECV 18: Privilege: call,all                                    
Tue Apr 14 11:01:54 +0200 2009 RECV 18: Channel: mISDN/1-u197                                  
Tue Apr 14 11:01:54 +0200 2009 RECV 18: State: Ringing                                         
Tue Apr 14 11:01:54 +0200 2009 RECV 18: CallerID: <unknown>                                    
Tue Apr 14 11:01:54 +0200 2009 RECV 18: CallerIDName: <unknown>                                
Tue Apr 14 11:01:54 +0200 2009 RECV 18: Uniqueid: asterisk-1239699717.252                      
Tue Apr 14 11:01:54 +0200 2009 RECV 18:                                                        
Tue Apr 14 11:01:54 +0200 2009 MSG 18: finished (type=state)                                   
Tue Apr 14 11:01:55 +0200 2009 SEND 19: Action: Command                                        
Tue Apr 14 11:01:55 +0200 2009 SEND 19: Command: core show channels                            
Tue Apr 14 11:01:55 +0200 2009 SEND 19: ActionID: 1239699715.03319                             
Tue Apr 14 11:01:55 +0200 2009 SEND 19:                                                        
Tue Apr 14 11:01:55 +0200 2009 RECV 19: Response: Follows                                      
Tue Apr 14 11:01:55 +0200 2009 RECV 19: Privilege: Command                                     
Tue Apr 14 11:01:55 +0200 2009 RECV 19: ActionID: 1239699715.03319                             
Tue Apr 14 11:01:55 +0200 2009 RECV 19: Channel              Location             State   Application(Data)             
mISDN/2-u198         269291@in:3          Ringing Wait(10)                                                              
mISDN/1-u197         269291@bringoutba:1  Ringing (None)                                                                
2 active channels                                                                                                       
1 active call                                                                                                           
--END COMMAND--                                                                                                         
Tue Apr 14 11:01:55 +0200 2009 RECV 19:                                                                                 
Tue Apr 14 11:01:55 +0200 2009 MSG 19: finished (type=action)                                                           
(?m-ix:^(\d+)\sactive\schannel.*[\n])                                                                                   
****************************************************************************************************                    
active channels = 2         <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<                                                                                            
(?m-ix:Application\(Data\)\s*[\n](.*)[\n](.*)[\n]^(\d+)\sactive\schannel.*[\n])                                         
/(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/                                                                                         
/(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/                                                                                         
[{"no_active_channels"=>2}, {"location"=>"269291@in:3", "channel"=>"mISDN/2-u198", "app_data"=>"Wait(10)", "state"=>"Ringing"}, {"location"=>"269291@bringoutba:1", "channel"=>"mISDN/1-u197", "app_data"=>"(None)", "state"=>"Ringing"}]                                                     
chan = mISDN/2-u198                                                                                                                            
Tue Apr 14 11:01:55 +0200 2009 SEND 20: Action: Hangup                                                                                         
Tue Apr 14 11:01:55 +0200 2009 SEND 20: Channel: mISDN/2-u198                                                                                  
Tue Apr 14 11:01:55 +0200 2009 SEND 20: ActionID: 1239699715.19077                                                                             
Tue Apr 14 11:01:55 +0200 2009 SEND 20:                                                                                                        
Tue Apr 14 11:01:55 +0200 2009 RECV 20: Response: Success                                                                                      
Tue Apr 14 11:01:55 +0200 2009 RECV 20: ActionID: 1239699715.19077                                                                             
Tue Apr 14 11:01:55 +0200 2009 RECV 20: Message: Channel Hungup                                                                                
Tue Apr 14 11:01:55 +0200 2009 RECV 20:                                                                                                        
Tue Apr 14 11:01:55 +0200 2009 MSG 20: finished (type=action)                                                                                  
Tue Apr 14 11:01:55 +0200 2009 RECV 21: Event: Hangup                                                                                          
Tue Apr 14 11:01:55 +0200 2009 RECV 21: Privilege: call,all                                                                                    
Tue Apr 14 11:01:55 +0200 2009 RECV 21: Channel: mISDN/2-u198                                                                                  
Tue Apr 14 11:01:55 +0200 2009 RECV 21: Uniqueid: asterisk-1239699717.253                                                                      
Tue Apr 14 11:01:55 +0200 2009 RECV 21: Cause: 0                                                                                               
Tue Apr 14 11:01:55 +0200 2009 RECV 21: Cause-txt: Unknown                                                                                     
Tue Apr 14 11:01:55 +0200 2009 RECV 21:                                                                                                        
Tue Apr 14 11:01:55 +0200 2009 MSG 21: finished (type=state)                                                                                   
chan = mISDN/1-u197                                                                                                                            
Tue Apr 14 11:01:55 +0200 2009 SEND 22: Action: Hangup                                                                                         
Tue Apr 14 11:01:55 +0200 2009 SEND 22: Channel: mISDN/1-u197                                                                                  
Tue Apr 14 11:01:55 +0200 2009 SEND 22: ActionID: 1239699715.33172                                                                             
Tue Apr 14 11:01:55 +0200 2009 SEND 22:                                                                                                        
Tue Apr 14 11:01:55 +0200 2009 RECV 22: Response: Success                                                                                      
Tue Apr 14 11:01:55 +0200 2009 RECV 22: ActionID: 1239699715.33172                                                                             
Tue Apr 14 11:01:55 +0200 2009 RECV 22: Message: Channel Hungup                                                                                
Tue Apr 14 11:01:55 +0200 2009 RECV 22:                                                                                                        
Tue Apr 14 11:01:55 +0200 2009 MSG 22: finished (type=action)                                                                                  
Tue Apr 14 11:01:55 +0200 2009 RECV 23: Event: Hangup                                                                                          
Tue Apr 14 11:01:55 +0200 2009 RECV 23: Privilege: call,all                                                                                    
Tue Apr 14 11:01:55 +0200 2009 RECV 23: Channel: mISDN/1-u197                                                                                  
Tue Apr 14 11:01:55 +0200 2009 RECV 23: Uniqueid: asterisk-1239699717.252                                                                      
Tue Apr 14 11:01:55 +0200 2009 RECV 23: Cause: 19                                                                                              
Tue Apr 14 11:01:55 +0200 2009 RECV 23: Cause-txt: User alerting, no answer                                                                    
Tue Apr 14 11:01:55 +0200 2009 RECV 23:                                                                                                        
Tue Apr 14 11:01:55 +0200 2009 MSG 23: finished (type=state)
Tue Apr 14 11:01:55 +0200 2009 RECV 24: Event: OriginateResponse
Tue Apr 14 11:01:55 +0200 2009 RECV 24: Privilege: call,all
Tue Apr 14 11:01:55 +0200 2009 RECV 24: ActionID: 1239699713.69366
Tue Apr 14 11:01:55 +0200 2009 RECV 24: Response: Failure
Tue Apr 14 11:01:55 +0200 2009 RECV 24: Channel: misdn/g:extern/269291
Tue Apr 14 11:01:55 +0200 2009 RECV 24: Context: bringoutba
Tue Apr 14 11:01:55 +0200 2009 RECV 24: Exten:
Tue Apr 14 11:01:55 +0200 2009 RECV 24: Reason: 1
Tue Apr 14 11:01:55 +0200 2009 RECV 24: Uniqueid: <null>
Tue Apr 14 11:01:55 +0200 2009 RECV 24: CallerID: <unknown>
Tue Apr 14 11:01:55 +0200 2009 RECV 24: CallerIDNum: <unknown>
Tue Apr 14 11:01:55 +0200 2009 RECV 24: CallerIDName: <unknown>
Tue Apr 14 11:01:55 +0200 2009 RECV 24:
Tue Apr 14 11:01:55 +0200 2009 MSG 24: finished (type=action)
Tue Apr 14 11:01:55 +0200 2009 SEND 25: Action: Command
Tue Apr 14 11:01:55 +0200 2009 SEND 25: Command: core show channels
Tue Apr 14 11:01:55 +0200 2009 SEND 25: ActionID: 1239699715.87244
Tue Apr 14 11:01:55 +0200 2009 SEND 25:
Tue Apr 14 11:01:55 +0200 2009 RECV 25: Response: Follows
Tue Apr 14 11:01:55 +0200 2009 RECV 25: Privilege: Command
Tue Apr 14 11:01:55 +0200 2009 RECV 25: ActionID: 1239699715.87244
Tue Apr 14 11:01:55 +0200 2009 RECV 25: Channel              Location             State   Application(Data)
0 active channels
0 active calls
--END COMMAND--
Tue Apr 14 11:01:55 +0200 2009 RECV 25:
Tue Apr 14 11:01:55 +0200 2009 MSG 25: finished (type=action)
(?m-ix:^(\d+)\sactive\schannel.*[\n])
****************************************************************************************************
active channels = 0
[{"no_active_channels"=>0}]   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Socket disconnected stream closed

Akcije #49

Izmjenjeno od Ernad Husremović prije oko 16 godina

šta se ovdje dešava:
  1. logiram se na ami interfejs
  2. radim poziv (originate) sam sebe preko isdn interfejsa
  3. u extensions.ael je podešeno da kada sam sebe zovem, uđem u wait režim
  4. sačekam nešto više od sekunde (sleep 1.2)
  5. provjerim da li je poziv detektovan - kanali aktivni
  6. izvršim hangup svih aktivnih izlaznih kanala (koji u mom slučaju sadrže mISDN)
    • vidi se na reportu da je nakon poziva active channels = 2
    • nakon hangup-a active channels = 0
Akcije #50

Izmjenjeno od Ernad Husremović prije oko 16 godina

dijagnosticiraje traje nešto više od 3 sec

hernad@nmraka-5:~/devel/asterisk/RAMI$ time ruby bin/example1.rb

real    0m3.248s
user    0m0.180s
sys     0m0.036s

Akcije #51

Izmjenjeno od Ernad Husremović prije oko 16 godina

hernad@nmraka-5:~/devel/asterisk/RAMI$ cat bin/example1.rb

#!/usr/local/bin/ruby                                      

## This shows how to use the Server and Client classes together, without using Server to create a separate proxy server. 
require 'rubygems'                                                                                                       
require 'lib/rami'                                                                                                       
include Rami                                                                                                             

def str_results(t)
#  puts "str_results ............." 
#  p t                             

  str = ""                         
  if t.size > 0                    
    t.each do |array|              
      array.each do  |key,value|   
            str +=  "#{key}: #{value}\n" 
      end                               
    end                                 
  end                                   

# puts "str = ///////////////////////////////////////////////" 
#  puts str                                                   
#  puts "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<str = ///////////////////////////////////////////////" 
  str                                                                                                         
end                                                                                                           

def print_results(t)

  puts "pocetak" + ("=" * 80)
  if t.size > 0              
    t.each do |array|        
      array.each {|key,value| puts "-x- #{key}: #{value}"}
    end                                                   
  end                                                     
  puts "kraj" + ("X" * 80)                                
  puts "\n\n"                                             
end                                                       

str = <<STR
1 2 3      
a b c      
STR        

puts "=" * 80
puts str.gsub(/[\n]/x, "$#")
puts "=" * 80               

re = /(\d).*[\n]^(\D)\s(\D)\s(\D)/x
#Regexp::MULTILINE                 

match_data = re.match(str)

#p match_data[0]
p match_data[1] 
p match_data[2] 
p match_data[3] 

#================================================================================
#1 2 3$#a b c$#                                                                  
#================================================================================
#"1"                                                                             
#"a"                                                                             
#"b"                                                                             

str_1 = <<STR
pocetak================================================================================
-x- Response: Follows                                                                  
-x- Privilege: Command                                                                 
-x- ActionID: 1239649072.87843                                                         
-x- 42: Channel              Location             State   Application(Data)            
mISDN/2-u46          269291@in:3          Ringing Wait(10)                             
mISDN/1-u45          269291@bringoutba:1  Ringing (None)                               
2 active channels                                                                      
1 active call                                                                          
--END COMMAND--                                                                        
krajXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX            
STR                                                                                    

str_2 = <<STR
Response: Follows
Privilege: Command
ActionID: 1239661689.07127
53: Channel              Location             State   Application(Data)
mISDN/tmp0-u100      269291@bringoutba:1  Dialing (None)               
1 active channel                                                       
0 active calls                                                         
--END COMMAND--                                                        

STR

def command_show_channels_response( str )

  #re = /Application\(Data\).*[\n](.*)[\n]/x
  re_str_active_channels = '^(\d+)\sactive\schannel.*[\n]'
  re_active_channels = Regexp.new(re_str_active_channels, Regexp::MULTILINE)

  puts re_active_channels
  puts "*" * 100         
  match_data = re_active_channels.match(str)
  no_active_channels = match_data[1].to_i   

  puts "active channels = #{no_active_channels}" 

  response = Array.new(no_active_channels + 1 )

  #header of response
  response[0] = { 'no_active_channels' => no_active_channels }

  if no_active_channels > 0

    re_str = 'Application\(Data\)\s*[\n]'
    re_str +=  '(.*)[\n]' * no_active_channels
    re_str += re_str_active_channels          
    re = Regexp.new(re_str, Regexp::MULTILINE)

    puts re                                   
    match_data = re.match(str)                

  end

  for i in 1..no_active_channels

   #match_data[i]
    #"mISDN/2-u46          269291@in:3          Ringing Wait(10)" 

    re = /(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/

    p re

    row_str = match_data[i]
    match_data_row = re.match(row_str)

    response[i] = { 'channel' => match_data_row[1], 'location' => match_data_row[2], 'state' => match_data_row[3], 'app_data' => match_data_row[4] }                                                                                                                                          

  end

  response

end

#p command_show_channels_response(str_2)

#p str_2.gsub(/[\n]/x, '$$')

server = Server.new({'host' => 'ifold.bring.out.ba', 'username' => 'ahn_ami', 'secret' => 'sar...'})
server.console =1                                                                                    
server.event_cache = 100                                                                             
server.run                                                                                           

client = Client.new(server)

client.timeout = 10
t =  client.ping   
print_results(t)   

t =  client.mailbox_count(1002)
print_results(t)               

puts "client.get_events" 
t =  client.get_events   
print_results(t)         

t = client.command("core show version")
print_results(t)                       

t = client.command("core show channels")
response = command_show_channels_response(str_results(t))
puts "-" * 100                                           
p response                                               
puts "$" * 100                                           

t = client.originate( "Channel" => "misdn/g:extern/269291", "Context" => "bringoutba", "Priority" => "1", "Async" => "true")
print_results(t)

sleep(1.2)

t = client.command("core show channels")

response = command_show_channels_response(str_results(t))
p response

#[{"no_active_channels"=>2}, {"location"=>"269291@in:3", "channel"=>"mISDN/2-u111", "app_data"=>"Wait(10)", "state"=>"Ringing"}, {"location"=>"269291@bringoutba:1", "channel"=>"mISDN/1-u110", "app_data"=>"(None)", "state"=>"Ringing"}

for i in 1 .. response[0]['no_active_channels'] do
   chan = response[i]['channel']
   puts "chan = #{chan}" 
   if chan =~ /mISDN/
     client.hangup(chan)
   end
end

sleep(0.4)
t = client.command("core show channels")
response = command_show_channels_response(str_results(t))
p response

client.stop

Akcije #52

Izmjenjeno od Ernad Husremović prije oko 16 godina

najviše vremena mi je trebalo da sa regularnim izrazima parsiram response komande "core show channels", ali sam barem dobio response :). To sam uradio command_show_channels_response( str )

e sada ovo trebam doraditi da radi još par stvari:
  1. da testira da li su ISDN linije aktivne, ako ima aktivnih (mISDN) linija, onda nemaš šta testirati - sve radi
  2. da pošalje email ako nakon par pokušaja stvar ne radi
  3. u slučaju greške da restartuje asterisk ? (ovo je moguće samo ako sam na istom hostu)
    • reload nije problem to je samo još jedna asterisk komanda
Akcije #53

Izmjenjeno od Ernad Husremović prije oko 16 godina

da malo pogledam šta mi misdn nudi

ifold*CLI> misdn show ports stats

Portd*CLin_calls        out_calls
1       0               0

testirao, nazvao mobitel ovo radi

ifold*CLI> misdn show ports stats

Portd*CLin_calls        out_calls
1       0               1

Akcije #54

Izmjenjeno od Ernad Husremović prije oko 16 godina

ifold*CLI> misdn show port 1

BEGIN STACK_LIST:
  * Port 1 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:0

ifold*CLI> misdn show stacks

BEGIN STACK_LIST:
  * Port 1 Type TE Prot. PMP L2Link DOWN L1Link:DOWN Blocked:0  Debug:0

Akcije #55

Izmjenjeno od Ernad Husremović prije oko 16 godina

evo šta dobijam kada imam aktivan poziv officesa -> mob

ifold*CLI> misdn show channels

Chan List: 0x82a2450
* Pid:136 Prt:1 Ch:1 Mode:TE Org:* dad: oad:061141311 rad: ctx:bringoutba state:CONNECTED

Akcije #56

Izmjenjeno od Ernad Husremović prije oko 16 godina

ako nema aktivnih poziva

ifold*CLI> misdn show channels

Chan List: (nil)

Akcije #57

Izmjenjeno od Ernad Husremović prije skoro 15 godina

  • Status promijenjeno iz Dodijeljeno u Odbačeno
Akcije

Također dostupno kao Atom PDF