posted by killarny

FreeSWITCH

I've been doing a lot of work recently with FreeSWITCH's mod_event_socket, and I wanted to comment a bit about the syntax used for commands through the socket while using asynchronous mode. I haven't tried the synchronous mode yet, as I always want to be free to be able to execute commands without waiting for other commands to finish. For instance, I need to be able to collect DTMF events while I'm playing a sound file, so that the user can do things like select menu items without listening to the entire menu first.

Asterisk's AMI protocol allows you to specify an ActionID along with every command that you send. Asterisk then includes this ActionID with every event that is related to that command, making it cake to coordinate an asynchronous client.

However, even in async mode, FreeSWITCH's mod_event_socket doesn't communicate any identifying information for command responses, or for events triggered by a previous command, unless one uses the bgapi command set. This command set is not applicable to every situation, though. It only applies to commands which manipulate the call; if one needs to manipulate the channel, then messages must be used through the sendmsg command set, which doesn't provide any specific identifying information.

Now, to complicate things, with all commands (even bgapi) the protocol works something like this: you send a command, and wait for a response from mod_event_socket. This response is assumed to be immediate before anything else the client might receive from mod_event_socket, and in the case of bgapi, this response will contain a job-id to use for comparing job-related events later.

For example, for the following command:

sendmsg
call-command: execute execute-app-name: answer\n\n

The response is this:

Content-Type: command/reply Reply-Text: +OK

That response is generic to nearly every single command sent, and is only really saying "The last transmission was a valid command, and didn't immediately fail". The command may actually fail later, and command specific feedback is generally contained in later events (which have no unique identifying information).

My issue here is that this seems to be forcing an asynchronous client to rely upon a synchronous ordering of response directly following command, thus violating the very concepts of an asynchronous protocol in which there should be no assumed order. Not only that, but this method increases the complexity of a client, which must be aware of limitations that wouldn't ordinarily be required by a true asynchronous protocol. An asynchronous client should be unconcerned with listening for a synchronous response to every command.

My suggested solution is to apply the job-id concept from bgapi to messages as well, and to go a step further; borrow the Asterisk idea of the client transmitting an identifier along with each command. Every response and event related to that command should then contain the very same identifier in the header.

posted by killarny

The Elements of Moral Philosophy, James Rachels

Morality and Religion

I once was asked what reason there is to do good things without belief in God. After reading a book on western moral philosophy, I have found that there are many different theories that attempt to explain human behavior. My earlier post included a summary of the behavior theory of Buddhism. (Once I stripped away the religious lingo, it became a rather scientific outline, to me.)

I like that the ten states of Buddhism serve to categorize human behavior, and also to place those categories in a hierarchy. The lowest in the order are those which cause the greatest harm to society, and to yourself. Behaviors ranked higher are encouraged because they create more value, and temper the lower behaviors with wisdom and experience.

So, on the simplest level, killing people and doing harm to society will eventually cause you to suffer. If a man or woman is strong in youth, but alienates society though evil actions, during sickness and old age, who will help them? Even a human with the most selfish ego will see benefit in modifying their behavior to foster good will in society.

Through the ages, I think that humanity has evolved mentally. Some people still show signs of barbarity, a fact that I am reminded of daily. Others are just naturally more philosophical and less ruled by baser behaviors. Humanity in general is better educated and more aware of the world today than 2000 years ago. We are less likely to be impressed by mystical and magical explanations of life. What is religion but magical theories of the complexities of life and human behavior?

Four thousand years ago, give or take 500 years, Judaism and Buddhism began to take shape. Initially they were both a series of instructions, rules for successful societies. Most people were unable to read, and stupid to boot. Hardly anyone thought about consequences to society for their actions. So the more enlightened people of the day played on superstition and wrote out rules, to be orated to the others. Jewish writings were clear; don't do this, or you will be damned eternally; do this, and God will bless you. Ancient writings from Buddhism are similar, except that the rewards and penalties differed. The people didn't need to know why they couldn't do something, only that it was forbidden. Few would have understood why anyway.

Roughly two millennia later, both Jewish and Buddhist thought began to change. Jesus brought the idea of atonement and forgiveness to the Jews, creating a new religion, Christianity. Buddhists divided their teachings into two schools; one stuck with the old rules, the other encouraged attaining enlightenment in this lifetime. To me, this signals two similarities - people began to want to know why the old rules were made, and they questioned the idea of being eternally responsible for the actions of earlier humanity. Surely there is a way to change your destiny! Jesus and the new-age Buddhists both said yes, with slightly different methods. The main is that humanity was mentally evolving, and could no longer be contented with the old rules alone.

Today, we are even more evolved, and the trappings of religion are again feeling too inadequate for modern thought. Most Christians do not accept every teaching in the Bible, and can not decide whether to disregard some of them, or to insist they be followed. Buddhism required large amounts of time to be dedicated to ceremonies and chanting, which makes many forms of the religion difficult to follow in our modern world. Buddhist variants like Nichiren Buddhism have come about as a reformation that fits better with modern life, and hopefully Christians have a similar solution.

I believe that human thought is evolving, and that old superstition and mystical mumbo-jumbo is insufficient for us. We are highly rational and analytical beings, something which religion is not suited for. To me, it seems that religion came from human morality, not the other way around. Moral questions should be considered by our inherent human natures, not by referring to ancient rules developed to control stupid people who couldn't understand the morality behind those rules.

Creative Commons License

posted by killarny

Soka Gakkai International

Ten States of Life

  1. Enlightenment: wisdom to create value in every situation
  2. Altruism: empathizing with, and helping others
  3. Realization: gaining insight through introspection
  4. Learning: learning from others and gathering information
  5. Exhilaration: satisfaction of achieving a desire
  6. Tranquility: calm and peaceful, listlessness
  7. Anger: outwardly directed self-righteous anger
  8. Animality: pursuit of instinctive desires
  9. Hunger: unchecked greed and ambition, improvement
  10. Hell: suffering, misery, torment, anguish

Each of these states is valuable but destructive when taken to extremes, except for enlightenment, which is wholly valuable. Also, every state contains aspects of every other state, meaning that anyone and everyone can potentially become enlightened through the proper actions. Dispassionate analysis of your attitude reveals one particular state which dominates and influences your life above the others.

The purpose of life is to raise your dominating state towards enlightenment. This is done through consistent inner reflection in an effort to determine the actions which create the most value in each life situation. Value is defined as that which brings benefit to both oneself and others.

Cause and Effect

Every thought, word and deed is a cause which results in some effect. In this way, we caused our own destiny through our attitudes and actions, which are themselves the result of effects from all prior causes. Essentially, we are the sum of our own actions.

We can do absolutely nothing to change our past causes, but we are total masters of our present. Through the application of wise causes, we will experience positive effects within our lives, and raise our state of life.

Creative Commons License

posted by killarny

I've made some massive changes to the back-end of the site, which now allow proper interaction. As a side effect, I had to delete all my old posts, but they weren't very important anyway.

I've been having recent problems with appengine, resulting in 500 Server Error constantly. Very frustrating, but finally I've fixed all my current issues.

Onward and upward!

icon artwork by Sekkyumu