• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

how to split the particular datas from group of datas  RSS feed

 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting an output below when i run my java code:


Channel Location State Application(Data)
SIP/5104-09a08098 5104@from-internal:1 Ringing AppDial((Outgoing Line))
SIP/5102-099f9700 s@macro-dial:7 Ring Dial(SIP/5104||tr)
2 active channels
1 active call


Here i need to store the channel name and state in the database in separate field.

How can i split the channel separately and state to the partcular channel.please guide me to do this.

Thanks

 
Marshal
Posts: 60914
190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please explain more details about the problem.

[This might be a database-specific problem, which we usually discuss on a different forum.]
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can make use of StringTokeniser Class see java docs for more details
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies.Sorry for the delayed reply.Actually i need to find how many active channels in asterisk using java.I can able to get the active channels like the following:


Channel Location State Application(Data)
SIP/5104-0a0bb988 (None) Up Bridged Call(SIP/5102-0a0a9cf8
SIP/5102-0a0a9cf8 s@macro-dial:7 Up Dial(SIP/5104||tr)
2 active channels
1 active call


But I need to match the state and the channel like "SIP/5104-0a0bb988=Up " and i have to store it in database in the field channel "SIP/5104-0a0bb988" and in state "Up".How can I link the channel and the state?

I have looked at string tokeniser.But if i get any sample code it will be very useful.

Thanks
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
By doing like the following ,I can able to take the datas below the channel from


Channel Location State Application(Data)
SIP/5104-0a0bb988 (None) Up Bridged Call(SIP/5102-0a0a9cf8
SIP/5102-0a0a9cf8 s@macro-dial:7 Up Dial(SIP/5104||tr)
2 active channels
1 active call


like


for (String line : response.getResult())
{
String channel=line.substring(0,line.indexOf(" "));
System.out.print(channel);
}


gave me the result


Channel
SIP/5104-0a0bb988
SIP/5102-0a0a9cf8
2 active channels
1 active call



But Now i need to take the datas below the Application(Data) .How can i take those datas.please assist me to do this.

Thanks.
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
By doing like the following ,I can able to take the datas below the channel from


Channel Location State Application(Data)
SIP/5104-0a0bb988 (None) Up Bridged Call(SIP/5102-0a0a9cf8
SIP/5102-0a0a9cf8 s@macro-dial:7 Up Dial(SIP/5104||tr)
2 active channels
1 active call


like


for (String line : response.getResult())
{
String channel=line.substring(0,line.indexOf(" "));
System.out.print(channel);
}


gave me the result


Channel
SIP/5104-0a0bb988
SIP/5102-0a0a9cf8
2 active channels
1 active call



But Now i need to take the datas below the Application(Data) .How can i take those datas.please assist me to do this.

Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!